:root {
  --navy: #0f2744;
  --teal: #0d9488;
  --slate: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --success: #059669;
  --sheet-header-green: #217346;
  --sheet-header-green-hover: #1a5c38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--navy);
}

.admin-open-as-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 16px;
  background: #f59e0b;
  color: var(--navy);
  font-weight: 700;
}

.admin-open-as-banner p {
  margin: 0;
}

.admin-open-as-back {
  color: var(--navy);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  font-weight: 800;
}

.page {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 20px clamp(16px, 2.5vw, 40px) 48px;
}

.header h1 {
  margin: 8px 0;
  font-size: 1.5rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.intro {
  color: var(--slate);
  line-height: 1.5;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-top: 16px;
}

.provider-card h2 {
  margin: 4px 0 0;
  font-size: 1.25rem;
}

.provider-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
}

.section-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.hint {
  margin: 0 0 12px;
  color: var(--slate);
  font-size: 0.85rem;
  line-height: 1.4;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}

.toolbar-hint {
  margin: 0;
  align-self: center;
}

.empty-cases {
  margin-top: 16px;
}

.inline-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
  min-width: 200px;
}

select,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='file'] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.secondary-btn {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.upload-list {
  margin-top: 12px;
}

.spreadsheet-table td.multiline-cell {
  text-align: left !important;
  white-space: pre-line;
  min-width: 160px;
  max-width: 320px;
}

.spreadsheet-table td.merged-party-cell {
  text-align: center !important;
  vertical-align: middle;
  min-width: 280px;
  max-width: 480px;
}

.patient-cell {
  font-weight: 700;
  text-align: left !important;
  min-width: 140px;
  max-width: 220px;
}

.spreadsheet-table th.sticky-col,
.spreadsheet-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--sheet-header-green);
  color: #fff;
  box-shadow: 2px 0 6px rgba(15, 39, 68, 0.14);
}

.spreadsheet-table th.sticky-col {
  z-index: 4;
}

.spreadsheet-table td.sticky-col {
  cursor: default;
}

.spreadsheet-table td.sticky-col:hover {
  background: var(--sheet-header-green-hover) !important;
}

.spreadsheet-table tbody tr:nth-child(even) td.sticky-col,
.spreadsheet-table tbody tr:nth-child(odd) td.sticky-col {
  background: var(--sheet-header-green);
}

.download-cell {
  text-align: center;
  vertical-align: middle !important;
  min-width: 72px;
}

.download-cell-btn {
  padding: 6px 12px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
}

.download-cell-btn:hover:not(:disabled) {
  background: #eef2ff;
}

.download-cell-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.spreadsheet-table td.download-cell,
.spreadsheet-table td.note-cell {
  cursor: default;
}

.spreadsheet-table td.download-cell:hover,
.spreadsheet-table td.note-cell:hover {
  background: inherit !important;
}

.action-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
}

.action-label input[type='text'],
.action-label input[type='file'] {
  margin-top: 4px;
}

.action-submit {
  width: 100%;
}

.note-cell {
  text-align: center;
  vertical-align: middle !important;
  min-width: 88px;
}

.note-cell-btn {
  padding: 6px 12px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
}

.note-cell-btn:hover {
  background: #e6fffb;
}

.note-cell-btn.attached {
  background: #e7f4ea;
  border-color: #217346;
  color: #217346;
}

.spreadsheet-table td.note-cell {
  cursor: default;
}

.spreadsheet-table td.note-cell:hover {
  background: #fff !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 39, 68, 0.45);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 320px;
  margin: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-title {
  margin: 0;
  font-size: 1rem;
}

.modal-subtitle {
  margin: 0;
  color: var(--slate);
  font-size: 0.82rem;
}

.modal-cancel {
  width: 100%;
}

.upload-status {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.spreadsheet-wrap {
  margin: 0;
  padding: 0;
  border: none;
}

.spreadsheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.spreadsheet-scroll {
  overflow-x: auto;
  border: 1px solid #b4b4b4;
  border-radius: 2px;
  background: #fff;
}

.spreadsheet-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  line-height: 1.35;
  table-layout: auto;
}

.spreadsheet-table th,
.spreadsheet-table td {
  border: 1px solid #c6c6c6;
  padding: 8px 10px;
  vertical-align: middle;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  max-width: none;
  min-width: 72px;
}

.spreadsheet-table th {
  background: var(--sheet-header-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.25;
}

.spreadsheet-table tbody tr:nth-child(even) td {
  background: #f9f9f9;
}

.spreadsheet-table tbody tr:nth-child(odd) td {
  background: #fff;
}

.spreadsheet-table td {
  cursor: copy;
  color: #1f1f1f;
}

.spreadsheet-table td:hover {
  background: #e7f4ea !important;
}

.spreadsheet-table td.copied {
  background: #fff3cd !important;
}

.upload-status.done {
  background: #d1fae5;
  color: var(--success);
}

.upload-status.pending {
  background: #fef3c7;
  color: #92400e;
}

.primary {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

.alert {
  padding: 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.9rem;
  line-height: 1.4;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.alert.success {
  background: #d1fae5;
  color: #065f46;
}

.hidden {
  display: none !important;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.auth-toggle,
.workspace-tabs,
.anesthetist-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tab-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.invoice-group {
  margin-top: 16px;
}

#logoutBtn {
  margin-top: 12px;
}

.provider-card {
  position: relative;
}

.provider-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.provider-heading h2 {
  margin: 0;
}

.icon-dots {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.legacy-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.menu-popover {
  position: absolute;
  z-index: 20;
  top: 56px;
  left: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 39, 68, 0.12);
  min-width: 280px;
  padding: 6px;
}

.menu-popover button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
}

.menu-popover button:hover {
  background: var(--bg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.password-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-field input {
  flex: 1;
}

.eye-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 1.1rem;
}

#companyForm .action-label,
#certPanel .action-label {
  margin-top: 12px;
}

#companySaveBtn,
#certSaveBtn {
  margin-top: 16px;
}

#certDownloadLink {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--teal);
}

.payable-card {
  margin-top: 12px;
}

.payable-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.payable-heading .section-title {
  margin: 0;
}

.payable-ok,
.payable-pending {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
}

.payable-ok {
  color: var(--success);
}

.payable-pending {
  color: #b45309;
}

.payable-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

#payableForm .action-label {
  margin-top: 12px;
}

.payable-kind {
  margin: 4px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy, #0f172a);
}

#payableSubmitBtn {
  margin-top: 16px;
}

