* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top left, #f7f1e3 0%, #f3f4f6 35%, #eef1f5 100%);
  color: #1f2937;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(184, 155, 94, 0.16);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}

.hidden {
  display: none !important;
}

.login-card {
  max-width: 520px;
  margin: 48px auto 0;
  padding: 34px 28px 28px;
}

.logo-wrap {
  text-align: center;
  margin-bottom: 18px;
}

.clinic-logo {
  max-width: 280px;
  height: auto;
  display: inline-block;
}

h2, h3 {
  margin: 0 0 12px;
  color: #111827;
}

.login-card h2 {
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 8px;
}

.centered {
  text-align: center;
}

.muted {
  color: #6b7280;
  font-size: 14px;
}

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

input,
button,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
}

input,
textarea {
  border: 1px solid #d8dde6;
  background: #fff;
  color: #111827;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #b89b5e;
  box-shadow: 0 0 0 4px rgba(184, 155, 94, 0.14);
}

input[type="checkbox"] {
  width: auto;
  transform: scale(1.1);
  accent-color: #b89b5e;
}

button {
  border: none;
  background: linear-gradient(135deg, #b89b5e 0%, #9c8047 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(184, 155, 94, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(184, 155, 94, 0.28);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-light {
  background: #f3f4f6;
  color: #1f2937;
  box-shadow: none;
}

.btn-light:hover {
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, #d14b4b 0%, #b91c1c 100%);
  box-shadow: none;
}

.btn-secondary {
  background: #6b7280;
  box-shadow: none;
}

.btn-small {
  width: auto;
  padding: 8px 10px;
  font-size: 12px;
}

.row {
  display: grid;
  gap: 14px;
}

.two-col {
  grid-template-columns: 1fr;
}

.three-col {
  grid-template-columns: 1fr;
}

.action-align {
  align-self: end;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo-wrap {
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fffaf0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(184, 155, 94, 0.18);
}

.header-logo {
  height: 48px;
  width: auto;
}

.header-title {
  margin: 0 0 4px;
  font-size: 24px;
}

.header-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.header-actions button {
  width: auto;
  min-width: 130px;
}

.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(184, 155, 94, 0.25), transparent);
  margin: 18px 0 20px;
}

.section-head {
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.summary-box {
  background: linear-gradient(180deg, #fffdf8 0%, #faf7f0 100%);
  border: 1px solid rgba(184, 155, 94, 0.18);
  border-radius: 16px;
  padding: 16px;
}

.summary-label {
  color: #8a6f37;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.summary-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.filter-card {
  background: #fcfbf8;
  border: 1px solid rgba(184, 155, 94, 0.14);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-row button {
  width: auto;
  min-width: 140px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #ebe7de;
  border-radius: 16px;
  background: #fff;
  margin-top: 14px;
}

.compact-table {
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid #f0ede6;
  text-align: left;
  padding: 11px 12px;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #fcfbf8;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  color: #8a6f37;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover {
  background: #fcfaf5;
}

tr.submitted-row {
  background: #fff8e8;
}

.small-note {
  display: block;
  font-size: 11px;
  color: #9a6b16;
  margin-top: 4px;
  line-height: 1.4;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.msg {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 500;
}

.msg.error {
  color: #b91c1c;
}

.msg.success {
  color: #15803d;
}

.sticky-submit {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(246, 246, 246, 0) 0%, rgba(246, 246, 246, 1) 32%);
  padding-top: 16px;
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 999;
}

.modal {
  background: #fff;
  width: 100%;
  max-width: 580px;
  border-radius: 20px;
  padding: 22px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
}

.modal h3 {
  margin-bottom: 12px;
}

.modal-text {
  margin: 0 0 10px;
  color: #4b5563;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

@media (min-width: 768px) {
  .container {
    padding: 28px 20px 50px;
  }

  .two-col {
    grid-template-columns: 1fr 1fr;
  }

  .three-col {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

@media (max-width: 767px) {
  .login-card {
    margin-top: 20px;
    padding: 26px 18px 22px;
  }

  .clinic-logo {
    max-width: 220px;
  }

  .login-card h2 {
    font-size: 25px;
  }

  .header-brand {
    align-items: flex-start;
  }

  .header-title {
    font-size: 22px;
  }

  .header-actions button {
    width: 100%;
  }

  table {
    min-width: 700px;
  }
}
