@import url("./theme.css");

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--ink-900);
}

body.no-scroll {
  overflow: hidden;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.auth-shell {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.8fr);
  gap: 24px;
}

.setup-shell {
  width: min(1020px, 100%);
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 26px;
  border: 1px solid var(--card-border);
  box-shadow: 0 16px 32px rgba(26, 21, 20, 0.08);
  display: grid;
  gap: 14px;
}

.auth-card h1 {
  margin: 0;
  font-size: 2rem;
  font-family: var(--font-heading);
}

.auth-side {
  border-radius: var(--radius);
  padding: 24px 26px;
  background: linear-gradient(160deg, #fff7f1, #f6eee6);
  border: 1px solid var(--card-border);
  display: grid;
  align-content: center;
  gap: 12px;
}

.auth-list {
  padding-left: 18px;
  margin: 0;
  color: var(--ink-700);
  display: grid;
  gap: 8px;
}

body::before {
  content: "";
  position: fixed;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--glow-rose), transparent 60%);
  z-index: -1;
}

body::after {
  content: "";
  position: fixed;
  bottom: -140px;
  left: -140px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--glow-gold), transparent 60%);
  z-index: -1;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f6efe8 100%);
  border-right: 1px solid var(--card-border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  position: relative;
  padding-bottom: 10px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--sea-500), var(--mint-500));
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 10px 20px rgba(138, 47, 58, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  position: relative;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  position: relative;
  z-index: 1;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--ink-500);
}

.brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(213, 154, 74, 0.6), rgba(138, 47, 58, 0.25), rgba(213, 154, 74, 0.6));
  border-radius: 999px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  text-decoration: none;
  color: var(--ink-700);
  padding: 10px 12px;
  border-radius: 14px;
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
  background: #f6e8dd;
  color: var(--ink-900);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--sea-500), var(--mint-500));
  color: white;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: #f8eee4;
  border: 1px solid #eddbcd;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.content {
  padding: 32px 36px 64px;
  position: relative;
  min-width: 0;
}

.content::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20px 20px, var(--pattern) 0, var(--pattern) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.6;
  z-index: -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(250, 244, 238, 0.95));
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 12px 26px rgba(26, 21, 20, 0.08);
  backdrop-filter: blur(6px);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(130, 82, 73, 0.35), rgba(201, 155, 103, 0.55), rgba(130, 82, 73, 0.35));
  border-radius: 999px;
  background-size: 200% 100%;
  animation: topbarGlow 10s ease-in-out infinite;
}

@keyframes topbarGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.topbar h1 {
  margin: 0 0 8px 0;
  font-size: 2rem;
  font-family: var(--font-heading);
  letter-spacing: 0.01em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h2,
h3,
h4 {
  font-family: var(--font-heading);
  letter-spacing: 0.01em;
}

.muted {
  color: var(--ink-500);
  margin: 0;
}

.status-bar {
  background: linear-gradient(135deg, #f9f2eb, #f1e6db);
  border: 1px solid var(--card-border);
  color: var(--ink-700);
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.status-bar[data-visible="1"] {
  opacity: 1;
  transform: translateY(0);
}

.mobile-action-bar {
  display: none;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  z-index: 60;
  padding: 8px;
  gap: 8px;
  align-items: center;
  background: rgba(255, 253, 251, 0.92);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  box-shadow: 0 14px 28px rgba(26, 21, 20, 0.16);
  backdrop-filter: blur(10px);
}

.mobile-action-bar .btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.section {
  margin-top: 32px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.collapsible-head {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff8f3;
  border: 1px solid var(--card-border);
  cursor: pointer;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-chevron {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink-700);
  border-left: 0;
  border-bottom: 0;
  transform: rotate(45deg);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
}

.section.collapsed .section-chevron {
  transform: rotate(-45deg);
  opacity: 0.5;
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topics-drawer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  background: rgba(26, 21, 20, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 70;
}

.topics-drawer.show {
  opacity: 1;
  pointer-events: auto;
}

.topics-sheet {
  width: 100%;
  max-height: 72vh;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px 24px;
  border: 1px solid var(--card-border);
  box-shadow: 0 -24px 44px rgba(26, 21, 20, 0.18);
  transform: translateY(24px);
  transition: transform 0.25s ease;
}

.topics-drawer.show .topics-sheet {
  transform: translateY(0);
}

.topics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.topics-list {
  display: grid;
  gap: 8px;
}

.topics-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff8f3;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  appearance: none;
  font-family: var(--font-body);
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topics-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(26, 21, 20, 0.12);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 14px 30px rgba(26, 21, 20, 0.08);
  padding: 20px 22px;
  border: 1px solid var(--card-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
  max-width: 100%;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(26, 21, 20, 0.12);
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid.three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 1400px) {
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--ink-700);
  gap: 6px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: #fffdfb;
  color: #2a221c;
}

.form-grid textarea {
  resize: vertical;
}

.form-grid input[readonly] {
  opacity: 0.92;
  cursor: not-allowed;
  border-style: dashed;
}

.form-grid input.auto-id-locked {
  user-select: none;
  caret-color: transparent;
}

.full-span {
  grid-column: 1 / -1;
}

.employee-intake-block {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px 12px 14px;
  background: #fffaf6;
  margin: 4px 0 0;
  min-inline-size: 0;
}

.employee-intake-block legend {
  display: none;
}

.employee-intake-heading {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-700);
}

.employee-intake-block .muted {
  margin: 0 0 10px;
  line-height: 1.35;
}

.employee-intake-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.employee-intake-grid label {
  margin: 0;
  min-width: 0;
}

@media (max-width: 820px) {
  .employee-intake-grid {
    grid-template-columns: 1fr;
  }
}

.rota-employee-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}

.rota-employee-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: #f5e9dc;
}

.rota-shift-input {
  width: 100%;
  min-width: 110px;
  background: #17120f;
  color: #f5e9dc;
  border: 1px solid rgba(196, 154, 99, 0.4);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.rota-total {
  font-weight: 700;
  white-space: nowrap;
}

.employee-workspace {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  margin: 10px 0 14px;
}

.employee-workspace-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.employee-tab {
  border: 1px solid var(--card-border);
  background: rgba(196, 154, 99, 0.1);
  color: #f6e8d6;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.employee-tab:hover,
.employee-tab:focus {
  border-color: rgba(220, 178, 118, 0.7);
  background: rgba(196, 154, 99, 0.2);
}

.employee-tab.active {
  background: linear-gradient(135deg, #d3a66b, #bd8450);
  border-color: rgba(220, 178, 118, 0.8);
  color: #1a120d;
}

.employee-workspace-body {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(25, 19, 15, 0.86);
  padding: 14px;
}

.employee-panel {
  display: none;
}

.employee-panel.active {
  display: block;
}

.employee-panel h4 {
  margin: 0 0 10px;
}

.employee-doc-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.employee-doc-split h5 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv-item {
  border: 1px solid rgba(220, 178, 118, 0.2);
  border-radius: 12px;
  background: rgba(34, 26, 20, 0.75);
  padding: 10px 12px;
}

.kv-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #d0b390;
  margin-bottom: 4px;
}

.kv-value {
  font-size: 0.95rem;
  color: #f5e9dc;
  overflow-wrap: anywhere;
}

.employee-row {
  cursor: pointer;
}

.employee-row-active {
  outline: 2px solid rgba(220, 178, 118, 0.75);
  outline-offset: -2px;
}

.overview-profile-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.overview-mini-card {
  border: 1px solid rgba(220, 178, 118, 0.25);
  border-radius: 12px;
  background: rgba(36, 27, 21, 0.72);
  padding: 12px;
}

.overview-mini-card h4 {
  margin: 0 0 8px;
}

.overview-main {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
}

.overview-highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.overview-highlight {
  border: 1px solid rgba(220, 178, 118, 0.22);
  border-radius: 12px;
  background: rgba(31, 24, 19, 0.74);
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.overview-highlight span {
  color: #d0b390;
  font-size: 0.85rem;
}

.overview-highlight strong {
  font-size: 1.25rem;
}

.overview-panels {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

#overview-role-badge {
  white-space: nowrap;
  font-weight: 700;
}

.mfa-step {
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(196, 154, 99, 0.08);
}

.mfa-step[hidden] {
  display: none !important;
}

.mfa-step:not([hidden]) {
  display: grid;
}

.tenant-register-notice {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(196, 154, 99, 0.4);
  background: rgba(196, 154, 99, 0.1);
  color: #f5e7d2;
  font-size: 0.9rem;
}

.tenant-register-notice.show {
  display: block;
}

.tenant-register-notice.error {
  border-color: rgba(224, 135, 123, 0.6);
  background: rgba(130, 35, 25, 0.2);
  color: #ffd8d3;
}

.floating-notice {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  max-width: min(460px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(196, 154, 99, 0.42);
  background: rgba(30, 21, 15, 0.95);
  color: #f7ead9;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
  z-index: 240;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-notice.show {
  opacity: 1;
  transform: translateY(0);
}

.floating-notice.error {
  border-color: rgba(224, 135, 123, 0.7);
  background: rgba(87, 24, 18, 0.97);
  color: #ffe3df;
}

@media (max-width: 720px) {
  .floating-notice {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.filter-row input,
.filter-row select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: #fffdfb;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: #2a221c;
}

.table-wrap a.doc-link {
  color: #ffe9cc;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 1px 8px rgba(255, 213, 158, 0.18);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.table-wrap a.doc-link:hover {
  color: #fff8ec;
  text-decoration: underline;
  text-decoration-color: rgba(255, 232, 196, 0.92);
  text-underline-offset: 3px;
  text-shadow: 0 2px 10px rgba(255, 226, 181, 0.28);
}

.table-wrap a.doc-link:focus-visible {
  outline: 2px solid rgba(232, 187, 126, 0.9);
  outline-offset: 2px;
  border-radius: 4px;
}

.table-wrap a.doc-link:visited {
  color: #ffdcb0;
}

.table-wrap .doc-download {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.postcode-lookup {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.postcode-lookup label {
  flex: 1 1 220px;
}

.postcode-lookup .btn {
  margin-bottom: 2px;
}

.postcode-status {
  font-size: 0.85rem;
  margin-top: 6px;
  line-height: 1.35;
  min-height: 20px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.divider {
  height: 1px;
  background: rgba(160, 140, 130, 0.14);
  margin: 16px 0;
}

.btn {
  background: linear-gradient(135deg, var(--sea-500), var(--mint-500));
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 18px rgba(130, 82, 73, 0.18);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--amber-500);
  box-shadow: 0 10px 18px rgba(201, 155, 103, 0.22);
}

.btn.ghost {
  background: transparent;
  color: var(--ink-700);
  border: 1px solid var(--card-border);
  box-shadow: none;
}

.section-toggle {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.section.collapsed > :not(.section-head) {
  display: none;
}

.details {
  margin-top: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff8f3;
}

.details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-700);
}

.service-grid {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: #fffaf6;
  padding: 10px 12px;
  margin: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.service-grid legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-700);
  padding: 0 6px;
}

.service-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--ink-700);
}

.service-grid label.service-option-disabled {
  opacity: 0.5;
}

.tenant-plan-note {
  display: none;
  margin-top: 8px;
  font-size: 0.84rem;
  color: #b88956;
}

.tenant-plan-note.show {
  display: block;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.toggle input[type="checkbox"] {
  accent-color: var(--sea-500);
  width: 18px;
  height: 18px;
}

.simple-mode .advanced-field {
  display: none;
}


.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fdf8f4;
  min-height: 80px;
  max-width: 100%;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-wrap th,
.table-wrap td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--card-border);
}

.tenant-directory-table {
  display: grid;
  gap: 8px;
}

.tenant-directory-head,
.tenant-directory-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.9fr) minmax(180px, 2fr);
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
}

.tenant-directory-head {
  background: rgba(220, 165, 107, 0.12);
  border: 1px solid rgba(212, 154, 94, 0.35);
  color: var(--cream-200);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tenant-directory-row {
  width: 100%;
  border: 1px solid rgba(212, 154, 94, 0.28);
  background: linear-gradient(115deg, rgba(48, 28, 16, 0.98), rgba(34, 21, 14, 0.95));
  color: var(--cream-100);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.tenant-directory-row:hover,
.tenant-directory-row:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(232, 185, 128, 0.7);
  box-shadow: 0 10px 22px rgba(16, 8, 3, 0.38);
}

.tenant-directory-row span:first-child {
  font-weight: 700;
  color: #ffe2bc;
}

.tenant-directory-row span:last-child {
  font-weight: 600;
}

.tenant-directory-empty {
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(220, 170, 112, 0.45);
  background: rgba(33, 21, 15, 0.72);
  color: #f0dfc8;
  font-size: 0.92rem;
}

.tenant-directory-empty.error {
  border-color: rgba(224, 126, 126, 0.7);
  color: #ffd8d8;
}

.stack {
  display: grid;
  gap: 16px;
}

.code-block {
  background: #101820;
  color: #d8e1e8;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.8rem;
  max-height: 260px;
  overflow: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: #f7efe8;
  border: 1px solid var(--card-border);
}

.signup-page {
  min-height: 100vh;
}

.signup-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.signup-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.signup-links {
  display: flex;
  gap: 18px;
}

.signup-links a {
  text-decoration: none;
  color: var(--ink-700);
  font-weight: 600;
}

.signup-shell {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(320px, 0.9fr);
  gap: 32px;
  padding: 48px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

.signup-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  margin-bottom: 12px;
}

.signup-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 22px;
}

.signup-highlights {
  display: grid;
  gap: 10px;
}

.signup-highlight {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff8f3;
  border: 1px solid var(--card-border);
  font-weight: 500;
}

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

.upgrade-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.pricing-card {
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--card-border);
  background: #fffaf6;
  display: grid;
  gap: 10px;
}

.pricing-card.featured {
  background: linear-gradient(180deg, #fff7ed 0%, #fff3e7 100%);
  border: 1px solid rgba(160, 140, 130, 0.12);
  box-shadow: 0 14px 28px rgba(130, 82, 73, 0.12);
}

.pricing-price {
  font-family: var(--font-heading);
  font-size: 1.6rem;
}

.pricing-price span {
  font-size: 0.9rem;
  color: var(--ink-500);
  margin-left: 6px;
}

.pricing-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  color: var(--ink-700);
}

.signup-card {
  position: relative;
}

.signup-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff8f3;
  border: 1px solid var(--card-border);
  color: var(--ink-700);
  font-size: 0.9rem;
}

.signup-status.error {
  background: #ffe9e9;
  border-color: #f4b3b3;
  color: #7a2b2b;
}

.payment-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.terms-panel {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: #fff8f3;
  display: grid;
  gap: 8px;
}

.camera-capture {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px;
  background: #fff8f3;
  display: grid;
  gap: 8px;
}

.camera-preview,
.camera-still {
  width: min(100%, 360px);
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #111;
}

.signup-foot {
  margin-top: 12px;
  font-size: 0.9rem;
}

.subscription-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff8f3;
  border: 1px solid var(--card-border);
  font-size: 0.9rem;
  margin: 8px 0 12px;
}

.subscription-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8a2f3a;
  display: inline-block;
}

.subscription-meta {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink-700);
}

.signup-success {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 80;
}

.signup-success.show {
  opacity: 1;
  pointer-events: auto;
}

.signup-success-card {
  max-width: 560px;
  width: 100%;
}

.signup-success-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #0f0f10;
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(15, 15, 16, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.92);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease, box-shadow 0.25s ease;
  z-index: 120;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top.show.is-scrolling {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 10px 20px rgba(15, 15, 16, 0.3);
}

.back-to-top:hover {
  background: #1a1a1c;
  box-shadow: 0 18px 32px rgba(15, 15, 16, 0.42);
}

.back-to-top:active {
  transform: translateY(0) scale(0.94);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(480px, 92vw);
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

.tenant-detail-card {
  width: min(760px, calc(100vw - 28px));
  max-height: min(80vh, 760px);
  overflow: auto;
}

.tenant-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.tenant-detail-item {
  border: 1px solid rgba(212, 154, 94, 0.3);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(20, 13, 10, 0.7);
}

.tenant-detail-item strong {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #eec995;
  margin-bottom: 5px;
}

.tenant-detail-item span,
.tenant-detail-item pre {
  margin: 0;
  color: #f8ebdd;
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.tenant-detail-actions {
  margin-top: 14px;
  flex-wrap: wrap;
}

#tenant-detail-login-note {
  margin-top: 10px;
  border: 1px dashed rgba(222, 177, 124, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(24, 15, 10, 0.6);
  color: #f0dbc0;
}

@media (max-width: 720px) {
  .back-to-top {
    bottom: 152px;
    right: 16px;
  }
}

/* Mobile polish + notch-safe layout */
@media (max-width: 900px) {
  body {
    padding-top: env(safe-area-inset-top);
  }

  .topbar {
    margin-top: 6px;
  }

  .topbar h1 {
    font-size: 1.35rem !important;
    line-height: 1.2;
  }

  .topbar-actions {
    display: none !important;
  }

  #functions-hub {
    display: none !important;
  }

  .content {
    padding-bottom: calc(138px + env(safe-area-inset-bottom)) !important;
  }

  .mobile-action-bar {
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
  }

  .back-to-top {
    right: 12px !important;
    bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    width: 46px !important;
    height: 46px !important;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 16px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .nav-link {
    white-space: nowrap;
  }

  .sidebar-foot {
    display: none;
  }

  .content {
    padding: 24px 18px 140px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .signup-shell {
    grid-template-columns: 1fr;
    padding: 28px 20px 80px;
  }

  .signup-nav {
    padding: 20px 20px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .mobile-action-bar {
    display: flex;
  }

  .section {
    scroll-margin-top: 80px;
  }

  .section-head {
    position: sticky;
    top: 10px;
    z-index: 25;
  }

  .collapsible-head {
    box-shadow: 0 10px 22px rgba(26, 21, 20, 0.12);
  }
}

@media (max-width: 600px) {
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .brand-mark {
    width: 120px;
    height: 42px;
    border-radius: 10px;
  }

  .status-bar {
    font-size: 0.85rem;
  }

  .btn {
    padding: 9px 14px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
    gap: 8px;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .section-toggle {
    width: 100%;
    text-align: center;
  }

  .card .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card .actions .btn {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .sidebar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    border-right: none;
    border-top: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
  }

  .brand {
    display: none;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .content {
    padding-bottom: 180px;
  }
}

/* Lighter warm + AI vibe refresh */
body {
  background:
    radial-gradient(900px 460px at 88% -18%, rgba(193, 129, 70, 0.12), transparent 60%),
    radial-gradient(880px 460px at 6% 110%, rgba(94, 134, 176, 0.1), transparent 62%),
    repeating-linear-gradient(
      90deg,
      rgba(193, 129, 70, 0.08) 0px,
      rgba(193, 129, 70, 0.08) 2px,
      rgba(17, 13, 10, 0.02) 2px,
      rgba(17, 13, 10, 0.02) 64px
    ),
    linear-gradient(180deg, #120d0a 0%, #0f0b09 100%);
  color: #f3e9db;
}

.sidebar {
  background: linear-gradient(180deg, #1b1410 0%, #120d0a 100%);
  border-right: 1px solid rgba(196, 154, 99, 0.24);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand-mark {
  width: 158px;
  height: 56px;
  padding: 4px;
  background: linear-gradient(145deg, #fffaf4 0%, #eadcc8 100%);
  border-radius: 14px;
  border: 1px solid rgba(158, 118, 85, 0.34);
  box-shadow: 0 10px 20px rgba(50, 35, 24, 0.18);
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.brand-title,
.brand-sub,
.nav-link,
.sidebar .tag {
  color: #f2e6d7;
}

.sidebar .tag {
  background: rgba(196, 154, 99, 0.22);
  border: 1px solid rgba(226, 191, 141, 0.68);
  color: #fff3df;
  font-weight: 700;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(196, 154, 99, 0.18);
  color: #fff6ea;
}

.nav-link.active {
  background: linear-gradient(135deg, #d3a66b, #bd8450);
  color: #1a120d;
}

.topbar,
.card,
.auth-card,
.auth-side,
.modal-card,
.signup-card,
.pricing-card,
.upgrade-card,
.status-bar,
.table-wrap,
.code-block {
  background: rgba(33, 25, 20, 0.92);
  border-color: rgba(196, 154, 99, 0.2);
  color: #f3e9db;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

/* Dark-theme section/tab contrast tune (desktop + laptop) */
.section-head,
.collapsible-head {
  background: rgba(36, 27, 21, 0.96);
  border-color: rgba(214, 170, 110, 0.28);
}

.section-head h2,
.section-head h3,
.section-title h2,
.section-title h3 {
  color: #f6e8d6;
}

.section-chevron {
  border-color: #e9caa2;
  opacity: 0.92;
}

.section-toggle.btn.ghost,
.section-head .btn.ghost,
.section-head .btn.secondary {
  color: #f8e9d4;
  border-color: rgba(220, 178, 118, 0.5);
  background: rgba(53, 39, 30, 0.7);
}

#functions-hub .card {
  background: rgba(28, 21, 16, 0.95);
  border-color: rgba(214, 170, 110, 0.24);
  overflow: hidden;
}

#functions-hub .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

#functions-hub .actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (min-width: 901px) and (max-width: 1500px) {
  #functions-hub .actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  #functions-hub .actions::-webkit-scrollbar {
    height: 8px;
  }

  #functions-hub .actions::-webkit-scrollbar-track {
    background: rgba(90, 63, 41, 0.2);
    border-radius: 999px;
  }

  #functions-hub .actions::-webkit-scrollbar-thumb {
    background: rgba(211, 166, 107, 0.7);
    border-radius: 999px;
  }
}

#functions-hub .btn.secondary {
  background: linear-gradient(90deg, #b1855e, #c99c73);
  color: #1b130d;
  border-color: rgba(220, 178, 118, 0.52);
}

.muted,
p,
label,
legend,
th,
td,
li,
.signup-status {
  color: #d3baa0;
}

.service-grid {
  background: rgba(18, 13, 10, 0.96) !important;
  border-color: rgba(214, 170, 110, 0.36) !important;
}

.service-grid legend,
.service-grid label {
  color: #f8e9d4 !important;
}

.service-grid label {
  font-weight: 600;
}

.service-grid input[type="checkbox"] {
  accent-color: #d2a065;
  opacity: 1;
}

input,
select,
textarea,
.form-grid input,
.form-grid select,
.form-grid textarea,
.filter-row input,
.filter-row select {
  background: #17120f;
  color: #f3e9db;
  border-color: rgba(196, 154, 99, 0.3);
}

input::placeholder,
textarea::placeholder,
.form-grid input::placeholder,
.form-grid textarea::placeholder,
.filter-row input::placeholder {
  color: #bca487;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.filter-row input:focus,
.filter-row select:focus {
  outline: none;
  border-color: rgba(231, 190, 132, 0.7);
  box-shadow: 0 0 0 3px rgba(196, 154, 99, 0.2);
}

.form-grid input:-webkit-autofill,
.form-grid input:-webkit-autofill:hover,
.form-grid input:-webkit-autofill:focus,
.filter-row input:-webkit-autofill,
.filter-row input:-webkit-autofill:hover,
.filter-row input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f3e9db;
  box-shadow: 0 0 0px 1000px #17120f inset;
  transition: background-color 5000s ease-in-out 0s;
}

.btn {
  background: linear-gradient(90deg, #9b6f4c, #d2a065);
  color: #1b130d;
  border: 1px solid rgba(137, 95, 63, 0.38);
  font-weight: 700;
}

.btn.ghost {
  background: rgba(196, 154, 99, 0.16);
  color: #fff0dc;
  border-color: rgba(220, 178, 118, 0.55);
  font-weight: 600;
}

.btn.secondary {
  background: linear-gradient(90deg, #8d684a, #b18863);
  color: #1b130d;
  border-color: rgba(220, 178, 118, 0.45);
}

.badge {
  background: rgba(38, 28, 22, 0.92);
  color: #f8e9d4;
  border-color: rgba(220, 178, 118, 0.45);
}

#invoice-email-status {
  color: #f8e9d4;
}

.subscription-pill {
  background: rgba(38, 28, 22, 0.92);
  color: #f8e9d4;
  border-color: rgba(220, 178, 118, 0.45);
}

#status-bar {
  background: rgba(36, 27, 21, 0.95) !important;
  color: #f3e3cc !important;
  border: 1px solid rgba(214, 170, 110, 0.34) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.mobile-form-toggle {
  border: 1px solid rgba(174, 135, 98, 0.3);
  border-radius: 12px;
  background: rgba(28, 20, 15, 0.94);
  margin-bottom: 10px;
}

.mobile-form-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
  color: #f3e3cc;
  border-bottom: 1px solid rgba(174, 135, 98, 0.24);
}

.mobile-form-toggle > summary::-webkit-details-marker {
  display: none;
}

@media (max-width: 900px) {
  .mobile-form-toggle > .form-grid {
    padding: 0 12px 12px;
  }
}

/* Final responsive overrides (kept at end to win cascade) */
@media (max-width: 1280px) {
  .app {
    grid-template-columns: 220px 1fr;
  }

  .content {
    padding: 24px 20px 56px;
  }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    flex-direction: row;
    align-items: center;
    padding: 14px 12px;
    border-right: none;
    border-bottom: 1px solid rgba(196, 154, 99, 0.24);
  }

  .brand {
    min-width: max-content;
  }

  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .nav-link {
    white-space: nowrap;
  }

  .sidebar-foot {
    display: none;
  }

  .content {
    padding: 20px 14px 120px;
  }

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

@media (max-width: 720px) {
  .sidebar {
    display: none !important;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .mobile-action-bar {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 95;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 250, 244, 0.92);
    border: 1px solid rgba(220, 178, 118, 0.35);
    backdrop-filter: blur(8px);
  }

  .mobile-action-bar .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 11px 8px;
    font-size: 0.95rem;
    color: #3a281a;
    border-color: rgba(214, 170, 110, 0.55);
    background: rgba(255, 248, 239, 0.92);
  }

  .content {
    padding: 16px 12px calc(126px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin-bottom: 16px;
    padding: 14px;
  }

  .topbar h1 {
    font-size: 1.5rem;
  }

  .topbar-actions {
    display: none;
  }

  #functions-hub {
    display: none;
  }

  .section {
    margin-bottom: 14px;
  }

  .section-head {
    position: static;
    padding: 0;
    margin-bottom: 8px;
  }

  .back-to-top {
    right: 14px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    width: 50px;
    height: 50px;
  }

  .card {
    padding: 14px;
    border-radius: 14px;
  }

  .grid {
    gap: 12px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .actions .btn {
    width: 100%;
  }

  .form-grid {
    gap: 10px;
  }

  .form-grid label {
    font-size: 0.95rem;
  }

  input,
  select,
  textarea,
  .form-grid input,
  .form-grid select,
  .form-grid textarea {
    font-size: 16px;
  }
}

/* Mobile hardening overrides */
@media (max-width: 900px) {
  .content {
    overflow-x: clip;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 640px;
  }

  .filter-row {
    flex-direction: column;
  }

  .postcode-lookup {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .postcode-lookup .btn {
    width: 100%;
    margin-bottom: 0;
  }

  .auth-body {
    align-items: start;
    padding: 20px 12px 28px;
  }

  .auth-card,
  .auth-side {
    padding: 18px 16px;
  }

  .employee-workspace {
    grid-template-columns: 1fr;
  }

  .employee-workspace-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kv-grid {
    grid-template-columns: 1fr;
  }

  .employee-doc-split {
    grid-template-columns: 1fr;
  }

  .rota-employee-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-profile-cards,
  .overview-highlights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .mobile-action-bar .btn,
  .topics-item,
  .btn {
    min-height: 44px;
  }

  .topics-sheet {
    max-height: 78vh;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .status-bar {
    position: sticky;
    top: 8px;
    z-index: 40;
  }

  .form-grid input,
  .form-grid select,
  .filter-row input,
  .filter-row select {
    min-height: 44px;
  }

  .employee-workspace-nav {
    grid-template-columns: 1fr;
  }

  .rota-employee-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .auth-card h1 {
    font-size: 1.55rem;
  }

  .signup-nav {
    padding: 14px 12px 0;
  }

  .signup-shell {
    padding: 20px 12px 90px;
  }
}

/* Mobile navigation accessibility overrides */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mobile-nav-bar {
  display: none;
}

@media (max-width: 900px) {
  .mobile-nav-bar {
    display: flex;
    gap: 8px;
    position: sticky;
    top: calc(env(safe-area-inset-top) + 6px);
    z-index: 58;
    padding: 8px;
    margin: 0 0 12px;
    border-radius: 14px;
    border: 1px solid rgba(196, 154, 99, 0.35);
    background: rgba(24, 18, 14, 0.9);
    backdrop-filter: blur(8px);
  }

  .mobile-nav-bar .btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 14px;
    white-space: nowrap;
  }

  .mobile-nav-bar select {
    flex: 1 1 auto;
    min-height: 44px;
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(196, 154, 99, 0.35);
    background: #17120f;
    color: #f3e9db;
  }
}

@media (max-width: 720px) {
  .mobile-action-bar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 96;
  }

  .mobile-action-bar .btn {
    min-height: 46px;
    font-size: 0.98rem;
  }

  .content {
    padding-bottom: calc(190px + env(safe-area-inset-bottom));
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 720px) {
    .mobile-action-bar {
      bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .back-to-top {
      bottom: calc(148px + env(safe-area-inset-bottom));
    }

    .content {
      padding-bottom: calc(250px + env(safe-area-inset-bottom));
    }
  }
}

/* Tablet overflow fixes and accessible navigation mode */
@media (max-width: 1200px) {
  .app {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    display: none !important;
  }

  .mobile-nav-bar {
    display: flex;
    gap: 8px;
    position: sticky;
    top: calc(env(safe-area-inset-top) + 8px);
    z-index: 60;
  }

  .mobile-action-bar {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 96;
  }

  .mobile-action-bar .btn {
    min-height: 46px;
  }

  .mobile-action-bar .btn.ghost {
    background: #f4ebdf;
    color: #2c1f15;
    border-color: rgba(176, 130, 78, 0.62);
    font-weight: 700;
  }

  .mobile-action-bar .btn.ghost:hover,
  .mobile-action-bar .btn.ghost:focus {
    background: #eddcc8;
    color: #21160f;
  }

  .content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 18px 12px calc(190px + env(safe-area-inset-bottom));
    overflow-x: clip;
  }

  .section,
  .card,
  .grid,
  .grid.two,
  .grid.three,
  .table-wrap {
    min-width: 0;
    max-width: 100%;
  }

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

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 620px;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 1200px) {
    .mobile-action-bar {
      bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .back-to-top {
      bottom: calc(148px + env(safe-area-inset-bottom));
    }

    .content {
      padding-bottom: calc(250px + env(safe-area-inset-bottom));
    }
  }
}

/* Tablet color tuning (landscape/portrait tablets) */
@media (min-width: 721px) and (max-width: 1200px) {
  .mobile-nav-bar {
    background: rgba(34, 24, 15, 0.94);
    border-color: rgba(206, 162, 106, 0.5);
  }

  .mobile-nav-bar .btn.ghost {
    background: #f2e2cc;
    color: #2a1b11;
    border-color: rgba(173, 126, 74, 0.68);
    font-weight: 700;
  }

  .mobile-nav-bar select {
    background: #f8eddc;
    color: #25170f;
    border-color: rgba(173, 126, 74, 0.68);
    font-weight: 600;
  }

  .mobile-action-bar {
    background: rgba(32, 23, 15, 0.95);
    border-color: rgba(206, 162, 106, 0.45);
  }

  .mobile-action-bar .btn.ghost {
    background: #f4e5cf;
    color: #24170f;
    border-color: rgba(173, 126, 74, 0.68);
    font-weight: 700;
  }

  .status-bar {
    background: #f5e8d5 !important;
    color: #2a1c13 !important;
    border-color: rgba(173, 126, 74, 0.55) !important;
  }
}

/* Final tablet/mobile control fixes (wins cascade) */
.sidebar .tag {
  background: #f5e9d8;
  color: #2f2118;
  border-color: #d0a974;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .mobile-nav-bar select {
    appearance: auto;
    -webkit-appearance: menulist;
    background: #f6e6d1 !important;
    color: #1f130c !important;
    border-color: rgba(167, 118, 66, 0.7) !important;
    font-weight: 700;
  }

  .mobile-nav-bar select option,
  .mobile-nav-bar select optgroup {
    background: #f6e6d1;
    color: #1f130c;
  }

  .mobile-action-bar {
    background: rgba(248, 238, 224, 0.96) !important;
    border-color: rgba(171, 123, 72, 0.6) !important;
  }

  .mobile-action-bar .btn.ghost {
    background: #efe0c9 !important;
    color: #2a1b12 !important;
    border-color: rgba(167, 118, 66, 0.68) !important;
    font-weight: 700 !important;
  }

  .mobile-action-bar .btn.ghost:hover,
  .mobile-action-bar .btn.ghost:focus {
    background: #e4cfb0 !important;
    color: #22150e !important;
  }

  .mobile-action-bar .btn.ghost:focus-visible {
    outline: 2px solid #bf8d56;
    outline-offset: 2px;
  }

  .back-to-top {
    right: 12px !important;
    bottom: calc(110px + env(safe-area-inset-bottom)) !important;
    width: 54px !important;
    height: 54px !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: #0b1116 !important;
    color: #ffffff !important;
    z-index: 130 !important;
  }
}

@media (max-width: 720px) {
  .back-to-top {
    bottom: calc(136px + env(safe-area-inset-bottom)) !important;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 1200px) {
    .back-to-top {
      bottom: calc(168px + env(safe-area-inset-bottom)) !important;
    }

    .content {
      padding-bottom: calc(260px + env(safe-area-inset-bottom)) !important;
    }
  }
}

/* Silk design polish for tablet/mobile */
@media (max-width: 1200px) {
  .mobile-nav-bar {
    padding: 6px !important;
    border-radius: 18px !important;
    border-color: rgba(198, 151, 96, 0.52) !important;
    background: linear-gradient(180deg, rgba(36, 24, 16, 0.97), rgba(19, 13, 10, 0.97)) !important;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  }

  .mobile-nav-bar .btn.ghost {
    min-height: 50px !important;
    padding: 10px 20px !important;
    border-radius: 999px !important;
    background: linear-gradient(180deg, #f4e6d1, #ebdac1) !important;
    color: #2b1c11 !important;
    border-color: rgba(175, 125, 72, 0.78) !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  .mobile-nav-bar select {
    min-height: 50px !important;
    padding: 10px 44px 10px 14px !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #f8ecdc, #f3e3cf) !important;
    color: #2b1c11 !important;
    border-color: rgba(175, 125, 72, 0.76) !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }

  .mobile-nav-bar select option,
  .mobile-nav-bar select optgroup {
    background: #f6e8d5 !important;
    color: #2b1c11 !important;
    font-weight: 600;
  }

  .card {
    background: linear-gradient(180deg, #fbf4ea, #f5e8d8) !important;
    border-color: rgba(194, 149, 95, 0.48) !important;
    color: #2a1b10 !important;
  }

  .muted {
    color: #6f5038 !important;
  }

  .collapsible-head {
    background: linear-gradient(180deg, #fbf2e7, #f3e4d2) !important;
    border-color: rgba(188, 139, 85, 0.52) !important;
  }

  .section-title h2,
  .section-head h2 {
    color: #2e1f13 !important;
    text-shadow: none !important;
  }

  .section-chevron {
    border-color: #8d6541 !important;
    opacity: 0.85 !important;
  }

  .section-toggle.btn.ghost {
    background: #ecdbc4 !important;
    color: #3a2818 !important;
    border-color: rgba(180, 132, 80, 0.72) !important;
    font-weight: 700 !important;
  }

  .section-toggle.btn.ghost:hover,
  .section-toggle.btn.ghost:focus {
    background: #e4ceb0 !important;
    color: #291a10 !important;
  }
}

/* Silk design polish for mobile phones */
@media (max-width: 720px) {
  .mobile-nav-bar {
    gap: 6px !important;
    padding: 5px !important;
    margin-bottom: 10px !important;
    border-radius: 16px !important;
  }

  .mobile-nav-bar .btn.ghost {
    min-height: 44px !important;
    padding: 8px 14px !important;
    font-size: 0.9rem !important;
    border-radius: 999px !important;
  }

  .mobile-nav-bar select {
    min-height: 44px !important;
    padding: 8px 38px 8px 12px !important;
    font-size: 0.95rem !important;
    border-radius: 11px !important;
  }

  .card {
    border-radius: 12px !important;
    padding: 12px !important;
  }

  .section-head {
    margin-bottom: 10px !important;
  }

  .section-title h2,
  .section-head h2 {
    font-size: clamp(1.9rem, 6vw, 2.1rem) !important;
    color: #2b1c11 !important;
  }

  .section-actions {
    gap: 6px !important;
  }

  .section-toggle.btn.ghost,
  .section-actions .btn.secondary {
    min-height: 40px !important;
    padding: 8px 14px !important;
    font-size: 0.95rem !important;
  }

  .mobile-action-bar {
    padding: 8px !important;
    border-radius: 20px !important;
  }

  .mobile-action-bar .btn.ghost {
    min-height: 42px !important;
    font-size: 0.94rem !important;
  }
}

/* Service grid overflow hardening */
.service-grid {
  overflow: hidden;
}

.service-grid legend {
  display: block;
  max-width: 100%;
  white-space: normal;
  line-height: 1.25;
  padding: 0 8px;
  background: rgba(18, 13, 10, 0.96);
  border-radius: 8px;
}

.service-grid label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px;
  min-width: 0;
  white-space: normal;
}

.service-grid input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
}

@media (max-width: 1200px) {
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 14px 12px 12px !important;
  }

  .service-grid legend {
    margin-bottom: 2px;
  }
}

@media (max-width: 720px) {
  .service-grid {
    grid-template-columns: 1fr !important;
  }

  .tenant-directory-head,
  .tenant-directory-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .tenant-directory-head span:first-child,
  .tenant-directory-row span:first-child {
    font-size: 0.78rem;
    opacity: 0.9;
  }
}

/* Contrast tuning for light card mode */
@media (max-width: 1200px) {
  .card p,
  .card .muted,
  .card .form-grid label,
  .card label,
  .card legend,
  .card .toggle {
    color: #5f4330 !important;
  }

  .card .form-grid label strong,
  .card h3,
  .card h4 {
    color: #2c1d12 !important;
  }

  .card .btn.ghost {
    color: #2a1b11 !important;
    border-color: rgba(170, 121, 68, 0.68) !important;
    background: #ecdbc5 !important;
  }

  .card .btn.ghost:hover,
  .card .btn.ghost:focus {
    color: #21150e !important;
    background: #e2ccad !important;
  }

  .card .btn.ghost:disabled {
    color: #8f755f !important;
    border-color: rgba(176, 146, 116, 0.6) !important;
    background: #efe4d5 !important;
  }
}


.overview-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.overview-person-picker select {
  width: 100%;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.95rem;
  background: #fffdfb;
}

.overview-leavers-toggle {
  white-space: nowrap;
  font-size: 0.9rem;
}

.overview-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.overview-sidebar {
  border: 1px solid var(--card-border);
  background: #fffaf6;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: sticky;
  top: 88px;
  align-self: start;
  height: fit-content;
}

.overview-topic {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(163, 131, 106, 0.22);
  background: transparent;
  color: #4d2f1b;
  padding: 12px 16px;
  font-size: 1rem;
  cursor: pointer;
}

.overview-topic:last-child {
  border-bottom: 0;
}

.overview-topic.active {
  background: linear-gradient(135deg, var(--sea-500), var(--mint-500));
  color: #f4ede4;
  font-weight: 700;
}

.overview-content {
  display: grid;
  gap: 14px;
}

.overview-panel {
  display: none;
}

.overview-panel.active {
  display: grid;
  gap: 14px;
}

.overview-training-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--mint-600);
  font-weight: 700;
}

.overview-training-empty {
  padding: 18px 12px 14px;
  color: #786152;
  text-align: center;
}

@media (max-width: 1000px) {
  .overview-workspace {
    grid-template-columns: 1fr;
  }

  .overview-sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-topic {
    border-right: 1px solid rgba(163, 131, 106, 0.22);
    border-bottom: 1px solid rgba(163, 131, 106, 0.22);
    text-align: center;
    padding: 10px 8px;
    font-size: 0.9rem;
  }
}

@media (max-width: 680px) {
  .overview-topline {
    grid-template-columns: 1fr;
  }

  .overview-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-training-head {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


.hs-overview-topcards {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.hs-tile {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: #fffaf6;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 238px;
}

.hs-tile h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--mint-600);
  font-size: 1.02rem;
}

.hs-tile-body {
  padding: 12px;
  min-height: 70px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.hs-tile-body.hs-center {
  place-items: center;
}

.hs-tile-body.hs-links a {
  color: var(--mint-600);
  text-decoration: none;
  font-weight: 600;
}

.hs-alert-pill {
  color: var(--mint-600);
  font-weight: 700;
}

.hs-link {
  display: block;
  border-top: 1px solid var(--card-border);
  padding: 10px 12px;
  color: var(--mint-600);
  text-decoration: none;
  font-weight: 700;
  margin-top: auto;
}

.hs-panel {
  margin-top: 6px;
}

.hs-table-head {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--mint-600);
  font-weight: 700;
  font-size: 0.95rem;
}

.hs-risk-grid {
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 0.8fr 0.9fr;
}

.hs-incident-grid {
  grid-template-columns: 0.8fr 1fr 1fr 1fr 1fr 1fr 1fr;
}

.hs-table-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  color: #736455;
  padding: 10px;
}

.hs-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1400px) {
  .hs-overview-topcards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hs-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .hs-risk-grid,
  .hs-incident-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hs-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hs-overview-topcards,
  .hs-kpi-strip {
    grid-template-columns: 1fr;
  }

  .hs-risk-grid,
  .hs-incident-grid {
    grid-template-columns: 1fr;
  }
}


/* UI stability hardening */
html {
  scrollbar-gutter: stable;
}

body.ajax-busy {
  cursor: progress;
}

#status-bar,
.status-bar {
  min-height: 44px;
}

.section-head {
  min-height: 56px;
}

.card,
.table-wrap,
.hs-panel,
.overview-content {
  min-width: 0;
}

.table-wrap {
  min-height: 120px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 44px;
}

.form-grid textarea {
  min-height: 96px;
}

.actions {
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  min-width: 132px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.9;
}

.btn.is-loading::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: btnSpin 0.7s linear infinite;
}

@keyframes btnSpin {
  to {
    transform: rotate(360deg);
  }
}

.card:hover,
.btn:hover,
.tenant-directory-row:hover,
.topics-item:hover {
  transform: none;
}

@media (max-width: 720px) {
  .section-head {
    min-height: 0;
  }

  .btn {
    min-width: 0;
    width: 100%;
  }
}


/* Mobile layout hotfix (stability + readability) */
.topics-drawer {
  display: none;
}

.topics-drawer.show {
  display: flex;
}

@media (max-width: 1200px) {
  .card {
    background: rgba(33, 25, 20, 0.92) !important;
    border-color: rgba(196, 154, 99, 0.2) !important;
    color: #f3e9db !important;
  }

  .section-head h2,
  .section-title h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem) !important;
    color: #f3e9db !important;
  }

  .topics-sheet {
    width: min(680px, calc(100vw - 24px));
    margin: 0 auto 10px;
    max-height: min(72vh, 680px);
    overflow: auto;
    border-radius: 18px;
    padding: 14px;
  }

  .topics-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(33, 25, 20, 0.98);
    padding-bottom: 8px;
  }

  .topics-head .btn,
  #topics-close {
    width: auto !important;
    min-width: 96px;
  }

  .topics-list {
    gap: 8px;
    max-height: calc(72vh - 90px);
    overflow: auto;
    padding-right: 2px;
  }

  .topics-item {
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 248, 243, 0.95);
    color: #2d2017;
    min-height: 44px;
  }
}

@media (max-width: 720px) {
  .mobile-action-bar {
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    padding: 6px !important;
    gap: 6px !important;
  }

  .mobile-action-bar .btn.ghost {
    min-height: 40px !important;
    font-size: 0.9rem !important;
  }

  .content {
    padding-bottom: calc(150px + env(safe-area-inset-bottom)) !important;
  }
}


/* Overview consistency lock */
#overview .overview-sidebar,
#overview .hs-tile,
#overview .hs-panel,
#overview .overview-panel .card {
  background: #fffaf6 !important;
  border-color: rgba(194, 149, 95, 0.38) !important;
  color: #5d4029 !important;
}

#overview .overview-topic {
  color: #5d4029 !important;
}

#overview .overview-topic.active {
  background: linear-gradient(135deg, #4a2b17, #b5864f) !important;
  color: #f8efe4 !important;
}

#overview .hs-tile h4,
#overview .hs-panel h3,
#overview .hs-table-head,
#overview .hs-alert-pill,
#overview .hs-link,
#overview .hs-tile-body.hs-links a {
  color: #a67643 !important;
}

#overview .hs-table-empty,
#overview .overview-training-empty,
#overview .overview-panel .muted {
  color: #7b5c40 !important;
}

#overview .hs-panel .btn,
#overview .hs-panel .btn.ghost {
  background: linear-gradient(135deg, #d1a16b, #bb8954) !important;
  border: 1px solid rgba(171, 123, 72, 0.72) !important;
  color: #24170f !important;
  box-shadow: none !important;
}

#overview .hs-panel .btn:hover,
#overview .hs-panel .btn.ghost:hover,
#overview .hs-panel .btn:focus,
#overview .hs-panel .btn.ghost:focus {
  background: linear-gradient(135deg, #c9965f, #b17e4a) !important;
  color: #1f140d !important;
}

@media (max-width: 1200px) {
  #overview .hs-overview-topcards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  #overview .hs-overview-topcards {
    grid-template-columns: 1fr !important;
  }
}


.pattern-toggle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.pattern-pill {
  border: 1px solid rgba(171, 123, 72, 0.62);
  background: #fffaf6;
  color: #5d4029;
  border-radius: 999px;
  min-height: 42px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.pattern-pill.active {
  background: linear-gradient(135deg, #4a2b17, #b5864f);
  color: #f8efe4;
  border-color: rgba(171, 123, 72, 0.78);
}

@media (max-width: 720px) {
  .pattern-toggle {
    grid-template-columns: 1fr;
  }
}

#rota-custom-mask-wrap {
  margin-top: 2px;
}

/* Global UI consistency lock for admin sections */
.content {
  font-family: var(--font-body);
}

.content .section-head h2,
.content .section-title h2,
.content .card h3,
.content .card h4 {
  font-family: var(--font-heading) !important;
  color: #2f1f14 !important;
  letter-spacing: 0.01em;
}

.content .section,
.content .card,
.content .table-wrap {
  border-radius: var(--radius-sm) !important;
}

.content .section {
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.95), rgba(249, 240, 229, 0.95)) !important;
  border: 1px solid rgba(194, 149, 95, 0.28) !important;
}

.content .card,
.content .table-wrap {
  background: #fffaf6 !important;
  border: 1px solid rgba(194, 149, 95, 0.34) !important;
  color: #5a3d28 !important;
}

.content .muted,
.content label,
.content .toggle,
.content .section-head p {
  color: #725640 !important;
}

.content input,
.content select,
.content textarea {
  border: 1px solid rgba(176, 132, 84, 0.45) !important;
  background: #fffdfb !important;
  color: #3a2618 !important;
}

.content .table-wrap table thead th {
  background: #f4e7d7 !important;
  color: #5d4029 !important;
  border-bottom: 1px solid rgba(176, 132, 84, 0.38) !important;
}

.content .table-wrap table tbody td {
  background: #fffaf6 !important;
  color: #5a3d28 !important;
  border-bottom: 1px solid rgba(176, 132, 84, 0.2) !important;
}

/* Clean cream refinement */
body,
.signup-page {
  background: linear-gradient(180deg, #fffdf8 0%, #fff8ef 52%, #f7ebdc 100%) !important;
  color: #2f241c !important;
}

body::before,
body::after {
  opacity: 0.8;
}

.sidebar {
  background: linear-gradient(180deg, #fffdf9 0%, #f7ebdc 100%) !important;
  border-right: 1px solid rgba(176, 132, 84, 0.24) !important;
}

.topbar {
  background: linear-gradient(135deg, #fffdf9, #f8eddf) !important;
  border-color: rgba(176, 132, 84, 0.28) !important;
}

.topbar::after {
  background: linear-gradient(90deg, rgba(176, 132, 84, 0.35), rgba(207, 166, 118, 0.56), rgba(176, 132, 84, 0.35)) !important;
}

.auth-card,
.card,
.modal-card,
.signup-card,
.pricing-card,
.upgrade-card,
.status-bar,
.topics-sheet,
.table-wrap,
.content .card,
.content .table-wrap {
  background: #fffdf9 !important;
  border-color: rgba(176, 132, 84, 0.3) !important;
  color: #3a2b1f !important;
  box-shadow: 0 10px 24px rgba(66, 45, 28, 0.08) !important;
}

.content .section {
  background: #fff8ef !important;
  border-color: rgba(176, 132, 84, 0.26) !important;
}

.nav-link {
  color: #6b5642 !important;
}

.nav-link:hover,
.nav-link:focus {
  background: #f5e7d5 !important;
  color: #3c2b1f !important;
}

.nav-link.active {
  background: linear-gradient(135deg, #c79b70, #b88658) !important;
  color: #2f2014 !important;
}

.auth-card > h1,
.auth-card > h2,
.auth-card > h3,
.card > h2,
.card > h3,
.card > h4,
.signup-card > h2,
.signup-success-card > h2,
.modal-card > h3 {
  margin-top: 0;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #edd9c0 !important;
  border: 1px solid rgba(171, 126, 83, 0.42) !important;
  color: #4a3625 !important;
}

.muted,
label,
.form-grid label,
.content label,
.toggle,
.content .section-head p {
  color: #6f5844 !important;
}

input,
select,
textarea,
.form-grid input,
.form-grid select,
.form-grid textarea,
.filter-row input,
.filter-row select {
  background: #fffefb !important;
  border: 1px solid rgba(168, 127, 84, 0.45) !important;
  color: #2f241c !important;
}

input::placeholder,
textarea::placeholder,
.form-grid input::placeholder,
.form-grid textarea::placeholder,
.filter-row input::placeholder {
  color: #967a63 !important;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.filter-row input:focus,
.filter-row select:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b9895a !important;
  box-shadow: 0 0 0 3px rgba(185, 137, 90, 0.16) !important;
}

.btn {
  background: linear-gradient(135deg, #c69a6f, #b48559) !important;
  color: #2b1d12 !important;
  border: 1px solid rgba(153, 107, 62, 0.42) !important;
  box-shadow: 0 8px 16px rgba(105, 72, 42, 0.14) !important;
}

.btn.secondary {
  background: linear-gradient(135deg, #dcb78d, #cca073) !important;
  color: #2f2115 !important;
}

.btn.ghost {
  background: #f5e8d8 !important;
  color: #5b412d !important;
  border: 1px solid rgba(171, 126, 83, 0.38) !important;
  box-shadow: none !important;
}

.code-block {
  background: #f9f1e8 !important;
  color: #3f2d1f !important;
  border: 1px solid rgba(176, 132, 84, 0.34) !important;
}

.tenant-directory-row {
  background: linear-gradient(120deg, #fff9f1, #f2e1cc) !important;
  border-color: rgba(176, 132, 84, 0.34) !important;
  color: #5a402d !important;
}

.tenant-directory-row span:first-child,
.table-wrap a.doc-link {
  color: #5a3e2a !important;
  text-shadow: none !important;
}

.tenant-directory-empty {
  background: #fff7ee !important;
  color: #6b513c !important;
  border-color: rgba(176, 132, 84, 0.32) !important;
}

#overview .overview-sidebar,
#overview .hs-tile,
#overview .hs-panel,
#overview .overview-panel .card {
  background: #fffdf9 !important;
  border-color: rgba(176, 132, 84, 0.34) !important;
  color: #5a402d !important;
}

#overview .overview-topic {
  color: #5a402d !important;
}

#overview .overview-topic.active {
  background: linear-gradient(135deg, #c1966b, #ae7f52) !important;
  color: #fff7ee !important;
}

#overview .hs-tile h4,
#overview .hs-panel h3,
#overview .hs-table-head,
#overview .hs-alert-pill,
#overview .hs-link,
#overview .hs-tile-body.hs-links a,
#overview .hs-table-empty,
#overview .overview-training-empty,
#overview .overview-panel .muted {
  color: #6f543f !important;
}
