/*
 * MECHINNO / ICAUT — Interface v4
 * Direction: Precision Lab — quiet, technical, data-first.
 * Loaded after the legacy stylesheets so the current application logic can stay intact.
 */

:root,
[data-theme="light"] {
  --bg: #efeee9;
  --bg-2: #f7f6f2;
  --bg-accent: #e6e4dc;
  --surface: #fffefa;
  --surface-2: #f4f3ee;
  --surface-solid: #fffefa;
  --surface-elevated: #ffffff;
  --surface-muted: #ebeae4;
  --panel: var(--surface);
  --line: rgba(28, 35, 30, 0.10);
  --line-strong: rgba(28, 35, 30, 0.18);
  --border: var(--line);
  --text: #171b18;
  --muted: #68716b;
  --primary: #1d2b24;
  --primary-2: #304239;
  --accent: #d7a817;
  --accent-light: #f0ca54;
  --accent-ink: #5f4700;
  --accent-glow: rgba(215, 168, 23, 0.16);
  --sidebar-bg: #111713;
  --sidebar-surface: #1a221d;
  --sidebar-text: #f7f5ec;
  --sidebar-muted: #9ca59e;
  --sidebar-line: rgba(255, 255, 255, 0.09);
  --purple: #6d627b;
  --teal: #287267;
  --orange: #a65b2b;
  --green: #287148;
  --amber: #9b7000;
  --pink: #93566b;
  --danger: #c43b35;
  --success: #267047;
  --warning: #9b7000;
  --shadow: 0 18px 44px rgba(24, 31, 27, 0.09);
  --shadow-sm: 0 6px 18px rgba(24, 31, 27, 0.055);
  --shadow-lux: 0 28px 72px rgba(17, 23, 19, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --sidebar-width: 264px;
  --topbar-height: 76px;
  --bottom-nav-height: 72px;
  --glass: none;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c100d;
  --bg-2: #111612;
  --bg-accent: #171d18;
  --surface: #151a16;
  --surface-2: #1b211c;
  --surface-solid: #151a16;
  --surface-elevated: #202720;
  --surface-muted: #202620;
  --panel: var(--surface);
  --line: rgba(239, 235, 218, 0.09);
  --line-strong: rgba(239, 235, 218, 0.17);
  --border: var(--line);
  --text: #f1efe7;
  --muted: #9fa69f;
  --primary: #e4bd45;
  --primary-2: #f0cf69;
  --accent: #dcb034;
  --accent-light: #f2d36f;
  --accent-ink: #251b00;
  --accent-glow: rgba(220, 176, 52, 0.18);
  --sidebar-bg: #080b09;
  --sidebar-surface: #141915;
  --sidebar-text: #f4f1e7;
  --sidebar-muted: #949b95;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --danger: #f0756d;
  --success: #6bc18a;
  --warning: #e7be58;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.34);
  --shadow-sm: 0 7px 22px rgba(0, 0, 0, 0.24);
  --shadow-lux: 0 34px 76px rgba(0, 0, 0, 0.48);
  color-scheme: dark;
}

html {
  background: var(--bg);
  overflow-x: clip;
}

body {
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(29, 43, 36, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 43, 36, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  line-height: 1.65;
  overflow-x: clip;
}

[data-theme="dark"] body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
}

::selection {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 2px;
}

.bg-blobs,
.login-bg,
.blob,
.login-orb {
  display: none !important;
}

/* Application frame */
.shell {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: transparent;
}

.sidebar,
[data-theme="dark"] .sidebar {
  border: 0;
  border-inline-end: 1px solid var(--sidebar-line);
  background: var(--sidebar-bg);
  box-shadow: none;
}

.sidebar-inner {
  gap: 0;
  padding: 18px 14px 14px;
}

.sidebar-brand-strip {
  margin: 0 0 14px;
  padding: 0 4px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand {
  gap: 11px;
  padding: 0;
}

.brand-mark--panel {
  width: 44px;
  height: 44px;
  padding: 6px;
  border: 1px solid var(--sidebar-line);
  border-radius: 9px;
  background: var(--sidebar-surface);
  box-shadow: none;
}

.brand-copy {
  display: grid;
  gap: 3px;
  text-align: right;
}

.brand strong {
  max-width: 172px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 10px;
}

.nav {
  gap: 0;
  padding: 0 0 12px;
}

.nav-section {
  margin: 0 0 10px;
}

.nav-section-title,
.nav-group-label {
  margin: 11px 10px 6px;
  color: var(--sidebar-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.035em;
  opacity: 0.8;
  text-transform: none;
}

.nav-section-items {
  gap: 2px;
}

.nav-item {
  min-height: 42px;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: 12.5px;
  font-weight: 650;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.nav-item--sub {
  min-height: 37px;
  padding-inline-start: 18px;
  font-size: 11.5px;
}

.nav-item:hover {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.active {
  color: var(--sidebar-text);
  border-color: rgba(215, 168, 23, 0.15);
  background: rgba(215, 168, 23, 0.10);
  box-shadow: inset -3px 0 0 var(--accent);
}

.nav-icon,
.nav-icon--blue,
.nav-icon--purple,
.nav-icon--teal,
.nav-icon--orange,
.nav-icon--green,
.nav-icon--amber,
.nav-icon--pink {
  width: 27px;
  height: 27px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.active .nav-icon {
  color: var(--accent-light);
  border-color: rgba(215, 168, 23, 0.18);
  background: rgba(215, 168, 23, 0.10);
}

.nav-icon svg {
  width: 15px;
  height: 15px;
}

.main-wrap {
  width: 100%;
  min-width: 0;
}

.topbar {
  min-height: var(--topbar-height);
  gap: 18px;
  padding: 0 28px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
  box-shadow: none;
  backdrop-filter: none;
}

[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
  box-shadow: none;
}

.topbar-title {
  flex: 0 1 auto;
  min-width: 210px;
}

.topbar-eyebrow {
  margin-bottom: 1px;
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

[data-theme="dark"] .topbar-eyebrow {
  color: var(--accent-light);
}

.topbar-title h1 {
  color: var(--text);
  background: none;
  font-size: clamp(17px, 1.8vw, 21px);
  font-weight: 800;
  letter-spacing: -0.025em;
  -webkit-text-fill-color: currentColor;
}

.global-search {
  max-width: 440px;
  margin-inline: auto;
}

.global-search input {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  box-shadow: none;
}

.global-search input:focus {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.kbd-hint {
  border-radius: 5px;
  background: var(--surface-solid);
}

.topbar-actions {
  gap: 8px;
  padding-inline-start: 0;
  border-inline-start: 0;
}

.account-menu-trigger {
  min-height: 44px;
  padding: 3px 9px 3px 3px;
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
  box-shadow: none;
}

.account-menu-trigger:hover,
.account-menu.is-open .account-menu-trigger {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.account-menu-avatar,
[data-theme="dark"] .account-menu-avatar {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--accent-light);
  background: var(--primary);
  box-shadow: none;
}

[data-theme="dark"] .account-menu-avatar {
  color: var(--accent-ink);
  background: var(--accent-light);
}

.account-menu-dropdown {
  border-color: var(--line-strong);
  border-radius: 12px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lux);
  backdrop-filter: none;
}

.account-menu-meta-row,
.account-menu-item {
  border-radius: 8px;
}

.content {
  width: 100%;
  max-width: 1560px;
  padding: 24px 28px 48px;
}

.page-subtitle {
  max-width: 760px;
  margin: -5px 0 17px;
  color: var(--muted);
  font-size: 12px;
}

.section.active {
  animation: sectionEnterV4 0.22s ease both;
}

@keyframes sectionEnterV4 {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* Page introduction and dashboard */
.section-intro,
.section-intro--purple,
.section-intro--teal,
.section-intro--orange,
.section-intro--green,
.section-intro--amber,
.section-intro--pink,
.section-intro--blue {
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  padding: 0 0 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.section-intro-icon {
  display: none;
}

.section-intro-copy p {
  max-width: 920px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.dashboard-hero,
[data-theme="dark"] .dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.dashboard-hero::after {
  display: none;
}

.dashboard-hero-eyebrow {
  margin: 0 0 3px;
  color: var(--accent-ink);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: none;
}

[data-theme="dark"] .dashboard-hero-eyebrow {
  color: var(--accent-light);
}

.dashboard-hero h2 {
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 850;
}

.dashboard-hero p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.dashboard-hero-meta {
  display: flex;
  gap: 8px;
}

.dashboard-hero-stat,
[data-theme="dark"] .dashboard-hero-stat {
  min-width: 112px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-2);
}

.dashboard-hero-stat span {
  color: var(--muted);
  font-size: 9px;
}

.dashboard-hero-stat strong {
  color: var(--text);
  font-size: 12.5px;
}

.stat-cards,
.stat-cards--ops {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  min-height: 92px;
  gap: 11px;
  padding: 15px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: none;
}

.stat-card::before {
  display: none;
}

.stat-card.card-clickable:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface-solid));
  box-shadow: var(--shadow-sm);
  transform: none;
}

.stat-card.is-alert {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line));
  box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--warning) 55%, transparent);
}

.stat-icon,
.stat-card--members .stat-icon,
.stat-card--teams .stat-icon,
.stat-card--desks .stat-icon,
.stat-card--charge .stat-icon,
.stat-card--income .stat-icon,
.stat-card--expense .stat-icon,
.stat-card--debt .stat-icon,
.stat-card--paid .stat-icon,
.stat-card--payments .stat-icon,
.stat-card--lockers .stat-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  background: var(--surface-2);
}

[data-theme="dark"] .stat-icon {
  color: var(--accent-light);
}

.stat-card.is-alert .stat-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 9%, var(--surface-2));
}

.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
}

.stat-card strong {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 850;
}

.quick-nav {
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.quick-nav-item {
  min-height: 48px;
  gap: 9px;
  padding: 8px 11px;
  border-color: var(--line);
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.quick-nav-item:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-solid));
}

.quick-nav-icon,
.quick-nav-icon--purple,
.quick-nav-icon--teal,
.quick-nav-icon--orange,
.quick-nav-icon--green,
.quick-nav-icon--amber,
.quick-nav-icon--pink,
.quick-nav-icon--blue {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--primary);
  background: var(--surface-2);
}

/* Panels and content hierarchy */
.panel {
  margin-bottom: 16px;
  padding: 20px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
}

.panel:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.panel--accent,
.sms-hero-panel,
.report-kpi-card {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface-solid));
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h2,
.table-toolbar h2 {
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.015em;
}

.panel-head h2::before,
.report-preview-title::before {
  width: 3px;
  height: 14px;
  margin-inline-end: 8px;
  border-radius: 0;
  background: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: 11.5px;
}

.month-stat,
.action-item,
.start-step,
.filter-bar,
.queue-card,
.contract-file-slot,
.file-folder-card {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.action-item {
  border-inline-start: 3px solid var(--line-strong);
}

.action-item:hover {
  border-inline-start-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-2));
}

/* Buttons and controls */
.button,
.mini-button,
.foot-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
  box-shadow: none;
}

.button {
  min-width: 92px;
  padding: 9px 17px;
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 86%, #000);
  background: color-mix(in srgb, var(--primary) 88%, #000);
  box-shadow: 0 8px 18px rgba(29, 43, 36, 0.15);
  filter: none;
}

[data-theme="dark"] .button {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

[data-theme="dark"] .button:hover:not(:disabled) {
  border-color: var(--accent-light);
  background: var(--accent-light);
}

.button.ghost,
[data-theme="dark"] .button.ghost {
  color: var(--text);
  border-color: var(--line-strong);
  background: transparent;
  box-shadow: none;
}

.button.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-2));
}

.button.danger,
[data-theme="dark"] .button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.mini-button {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-solid);
  font-size: 11px;
}

.mini-button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-solid));
}

.mini-button.primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

[data-theme="dark"] .mini-button.primary {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent);
}

.mini-button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: transparent;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

.search,
.year-select,
.inline-status,
.per-page-select,
.crud-grid input,
.crud-grid select,
.crud-grid textarea,
.filter-bar input,
.filter-bar select,
.auth-form input,
.install-actions input:not([type="checkbox"]):not([type="radio"]),
.install-actions select,
.install-actions textarea {
  min-height: 42px;
  padding: 9px 11px;
  border-color: var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

textarea,
.crud-grid textarea {
  min-height: 100px;
  resize: vertical;
}

.search:focus,
.year-select:focus,
.inline-status:focus,
.per-page-select:focus,
.crud-grid input:focus,
.crud-grid select:focus,
.crud-grid textarea:focus,
.filter-bar input:focus,
.filter-bar select:focus,
.auth-form input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

.crud-grid {
  gap: 14px;
}

.crud-grid label,
.room-field-row label,
.install-actions label {
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.crud-grid label > span,
.room-field-row label > span,
.install-actions label > span {
  color: var(--muted);
}

/* Data tables and mobile records */
.data-panel {
  padding: 18px;
}

.table-toolbar {
  align-items: flex-end;
  margin-bottom: 13px;
}

.table-actions {
  gap: 7px;
}

.table-wrap {
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
  box-shadow: none;
}

.table-wrap table {
  font-size: 12px;
}

.table-wrap th,
.table-wrap td {
  padding: 11px 10px;
  border-bottom-color: var(--line);
  text-align: right;
  vertical-align: middle;
}

.table-wrap th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}

.table-wrap tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--surface-solid));
}

.table-wrap .num,
.ledger-table .num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 126px;
}

.table-wrap td.row-actions {
  white-space: normal;
}

.row-more {
  position: relative;
  display: inline-block;
}

.row-more > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.row-more > summary::-webkit-details-marker {
  display: none;
}

.row-more[open] > summary {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.row-more-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 25;
  display: grid;
  gap: 5px;
  min-width: 154px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.row-more-menu .mini-button {
  width: 100%;
  justify-content: flex-start;
  text-align: right;
}

.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-solid);
  cursor: pointer;
}

.file-picker:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.file-picker-button {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  background: var(--primary);
}

.file-picker-name {
  min-width: 0;
  padding: 0 12px;
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker.has-file .file-picker-name {
  color: var(--text);
  font-weight: 700;
}

.profile-upload-row .file-picker {
  flex: 1;
}

/* Keep expanded row actions inside horizontally scrollable tables. */
.table-wrap .row-more-menu {
  position: static;
  margin-top: 6px;
  box-shadow: none;
}

.table-pagination {
  padding-top: 11px;
  color: var(--muted);
  font-size: 11px;
}

.mobile-cards {
  gap: 10px;
}

.mobile-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: none;
}

.mobile-card-field {
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.mobile-card-field span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}

.mobile-card-field strong {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.65;
}

.badge,
.sms-status-pill,
.file-folder-kind,
.role-chip {
  border-radius: 5px;
  font-weight: 750;
}

.filter-tabs,
.sms-tabs {
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.filter-tab,
.sms-tab {
  min-height: 36px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 11.5px;
}

.filter-tab.active,
.sms-tab.is-active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  gap: 9px;
  min-height: 132px;
  padding: 26px 18px;
  border-color: var(--line-strong);
  border-radius: 9px;
  background: var(--surface-2);
}

.empty-state-icon {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-solid);
}

.empty-state-icon svg {
  width: 20px;
  height: 20px;
}

/* Modal and feedback */
.modal-backdrop {
  padding: 24px;
  background: rgba(8, 12, 9, 0.66);
  backdrop-filter: blur(3px);
}

.modal-card {
  max-width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  border-color: var(--line-strong);
  border-radius: 14px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lux);
}

.modal-head {
  padding: 17px 20px;
  border-bottom-color: var(--line);
}

.modal-body,
.modal-card > .crud-form,
.modal-card > .crud-grid,
.modal-card > .desk-assign-form,
.modal-card > p {
  padding-inline: 20px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
}

.modal-actions,
.form-actions,
.panel-actions {
  gap: 8px;
}

.toast {
  border-color: var(--line-strong);
  border-radius: 9px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.notice {
  border-radius: 8px;
}

/* Reports, financial surfaces and workspaces */
.report-type-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.report-type-card {
  min-height: 82px;
  padding: 13px;
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-solid);
}

.report-type-card:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  transform: none;
}

.report-type-card.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-solid));
  box-shadow: inset 3px 0 0 var(--accent);
}

.report-kpi-card {
  border-radius: 9px;
}

.report-kpi-card:hover {
  transform: none;
}

.ledger-row-balance th,
.ledger-row-balance td {
  background: color-mix(in srgb, var(--success) 8%, var(--surface-2));
}

.collage-table th,
.collage-table td {
  border-color: var(--line);
}

.collage-table th {
  color: var(--muted);
  background: var(--surface-2);
}

.team-year-workspace,
.payment-wizard,
.file-manager,
.sms-tab-panel {
  color: var(--text);
}

.file-folder-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.file-folder-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  transform: none;
}

/* Meeting rooms — contains the wide calendar instead of widening the whole page. */
.room-calendar-shell,
.room-calendar-toolbar,
.room-booking-layout,
.room-overview-grid,
#meeting-rooms,
#room-reservations {
  min-width: 0;
  max-width: 100%;
}

.room-calendar-shell {
  overflow: hidden;
}

.room-calendar-grid {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border-color: var(--line);
  border-radius: 9px;
  box-shadow: none;
  overscroll-behavior-inline: contain;
}

.room-calendar-row {
  min-width: 850px;
  border-color: var(--line);
}

.room-calendar-row--head {
  border-bottom-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--surface-2);
}

.room-calendar-room,
.room-calendar-room-head {
  background: var(--surface-2);
}

.room-calendar-block {
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-solid));
  box-shadow: none;
}

.room-calendar-block:hover {
  box-shadow: none;
  transform: none;
}

.room-calendar-day-head.is-today .room-calendar-day-num {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: none;
}

.room-overview-card,
.room-card,
.room-month-picker,
.room-closed-item,
.pub-lookup {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: none;
}

.room-room-option {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
}

.room-room-option.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.room-slot {
  border-radius: 7px;
}

.room-slot.is-selected {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-solid));
}

.room-app,
.pub-shell {
  max-width: 1180px;
}

.pub-top,
.room-app-header {
  border-bottom-color: var(--line);
}

/* Authentication and standalone utilities */
.login-body,
.standalone-page,
.room-public-body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(29, 43, 36, 0.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 43, 36, 0.027) 1px, transparent 1px);
  background-size: 32px 32px;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  width: min(1060px, calc(100% - 40px));
  min-height: 650px;
  margin: 0 auto;
  padding: 34px 0;
  place-items: stretch;
  align-content: center;
  direction: ltr;
}

.login-story,
.login-card {
  direction: rtl;
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 580px;
  padding: 34px 38px;
  overflow: hidden;
  color: #f7f5ec;
  border-radius: 16px 0 0 16px;
  background-color: #111713;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

.login-story::after {
  content: "";
  position: absolute;
  inset-inline-start: -70px;
  bottom: -90px;
  width: 260px;
  height: 260px;
  border: 54px solid rgba(215, 168, 23, 0.14);
  border-radius: 50%;
}

.login-story-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-story-brand .brand-mark {
  width: 66px;
  height: 66px;
  padding: 8px;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.login-story-brand span,
.login-story-copy p {
  display: block;
  margin: 0 0 4px;
  color: var(--accent-light);
  font-size: 10px;
  font-weight: 800;
}

.login-story-brand strong {
  display: block;
  font-size: 16px;
}

.login-story-copy {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.login-story-copy h2 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 45px);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.28;
}

.login-story-copy span {
  display: block;
  max-width: 38ch;
  color: #aeb7b0;
  font-size: 13px;
  line-height: 1.9;
}

.login-story-index {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.38);
  font: 700 11px/1 ui-monospace, monospace;
  letter-spacing: 0.16em;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: auto;
  min-height: 580px;
  padding: 52px 48px;
  border: 1px solid var(--line-strong);
  border-inline-start: 0;
  border-radius: 0 16px 16px 0;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lux);
}

.login-card .login-brand {
  display: none;
}

.login-top-bar {
  position: absolute;
  top: 22px;
  inset-inline-end: 22px;
}

.login-theme-toggle,
.theme-toggle {
  min-height: 36px;
  padding: 3px 10px 3px 3px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: none;
}

.theme-toggle-track {
  width: 27px;
  height: 27px;
  border-radius: 6px;
  background: var(--surface-solid);
  box-shadow: none;
}

.login-card h1 {
  margin: 0 0 7px;
  font-size: 28px;
  font-weight: 850;
}

.login-subtitle {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-form {
  gap: 16px;
}

.login-form label {
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.login-form input {
  min-height: 48px;
  border-radius: 8px;
  background: var(--surface-2);
}

.login-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
}

.setup-screen {
  padding: 34px 20px;
}

.setup-card {
  padding: 30px;
  border-color: var(--line-strong);
  border-radius: 14px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
}

.setup-card.wide {
  width: min(840px, 100%);
}

.setup-brand {
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.setup-brand .brand-mark {
  width: 64px;
  padding: 7px;
  border-radius: 9px;
}

.setup-brand-copy strong {
  font-size: 15px;
}

.install-actions {
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

/* Dark mode normalization */
[data-theme="dark"] .brand-mark,
[data-theme="dark"] .panel,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .account-menu-dropdown {
  border-color: var(--line);
}

[data-theme="dark"] .money-positive { color: var(--success) !important; }
[data-theme="dark"] .money-negative { color: var(--danger) !important; }

/* Responsive */
@media (max-width: 1180px) {
  :root { --sidebar-width: 248px; }
  .content { padding-inline: 22px; }
  .stat-cards,
  .stat-cards--ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid.two,
  .room-layout,
  .room-booking-shell,
  .room-booking-layout { grid-template-columns: 1fr; }

  .login-screen {
    grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  }

  .login-story {
    padding: 28px;
  }

  .login-card {
    padding-inline: 34px;
  }
}

@media (max-width: 768px) {
  :root {
    --bottom-nav-height: 70px;
  }

  body {
    background-size: 24px 24px;
  }

  .shell {
    display: block;
  }

  .sidebar {
    width: min(320px, 86vw);
    padding-bottom: var(--bottom-nav-height);
    box-shadow: -18px 0 48px rgba(0, 0, 0, 0.26);
  }

  .sidebar-inner {
    padding: 16px 12px;
  }

  .topbar {
    min-height: 66px;
    gap: 10px;
    padding: 9px 14px;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
    border-color: var(--line-strong);
    border-radius: 8px;
    background: var(--surface-solid);
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-title h1 {
    font-size: 17px;
  }

  .topbar-eyebrow {
    font-size: 9px;
  }

  .account-menu-trigger {
    min-height: 40px;
    padding: 2px;
    border: 0;
    background: transparent;
  }

  .account-menu-avatar {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .content {
    padding: 16px 14px calc(var(--bottom-nav-height) + 22px);
  }

  .page-subtitle {
    display: none;
  }

  .section-intro {
    margin-bottom: 14px;
    padding-bottom: 12px;
  }

  .section-intro-copy p {
    font-size: 11.5px;
    line-height: 1.75;
  }

  .dashboard-hero,
  [data-theme="dark"] .dashboard-hero {
    display: block;
    padding: 15px;
    border-inline-start-width: 3px;
  }

  .dashboard-hero h2 {
    font-size: 18px;
  }

  .dashboard-hero p {
    font-size: 11px;
  }

  .dashboard-hero-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-top: 13px;
  }

  .dashboard-hero-stat {
    min-width: 0;
  }

  #overview .stat-cards,
  #overview .stat-cards--ops {
    display: flex;
    gap: 10px;
    margin-inline: -14px;
    padding: 0 14px 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  #overview .stat-cards::-webkit-scrollbar,
  #overview .stat-cards--ops::-webkit-scrollbar {
    display: none;
  }

  #overview .stat-card {
    flex: 0 0 218px;
    min-height: 86px;
    scroll-snap-align: start;
  }

  .panel {
    padding: 15px;
    border-radius: 10px;
  }

  .panel-head h2,
  .table-toolbar h2 {
    font-size: 14px;
  }

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

  .quick-nav-item {
    min-height: 44px;
  }

  .bottom-nav {
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top-color: var(--line-strong);
    background: var(--surface-elevated);
    box-shadow: 0 -10px 28px rgba(19, 26, 21, 0.10);
    backdrop-filter: none;
  }

  .admin-portal-body .bottom-nav-item[data-section="members"],
  .admin-portal-body .bottom-nav-item[data-section="transactions"],
  .team-portal-body .bottom-nav-item[data-section="profile"],
  .team-portal-body .bottom-nav-item[data-section="payments"] {
    display: none;
  }

  .bottom-nav-item {
    min-height: 52px;
    gap: 3px;
    color: var(--muted);
    font-size: 9px;
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-item.active {
    color: var(--accent-ink);
  }

  [data-theme="dark"] .bottom-nav-item.active {
    color: var(--accent-light);
  }

  .data-panel {
    padding: 14px;
  }

  .table-toolbar {
    align-items: stretch;
  }

  .table-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .table-actions .search {
    grid-column: 1 / -1;
    order: 5;
  }

  .table-actions .button {
    min-width: 0;
    width: 100%;
  }

  .mobile-cards {
    display: grid;
  }

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

  .mobile-card-field {
    display: block;
  }

  .mobile-card-field strong {
    display: block;
    margin-top: 2px;
    overflow-wrap: anywhere;
  }

  .mobile-card .row-actions {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
  }

  .row-more {
    position: static;
  }

  .row-more-menu {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    margin-top: 7px;
    box-shadow: none;
  }

  .table-pagination {
    align-items: flex-start;
    gap: 9px;
  }

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

  .report-type-card {
    min-height: 96px;
  }

  .room-calendar-grid {
    max-width: 100%;
    overflow-x: auto;
  }

  .room-calendar-row {
    min-width: 820px;
  }

  .room-calendar-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .room-calendar-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    align-items: end;
  }

  .room-calendar-controls .room-calendar-filter {
    grid-column: 1 / -1;
  }

  .room-calendar-controls > *,
  .room-calendar-filter {
    width: 100%;
    min-width: 0;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 18px);
    border-radius: 14px 14px 0 0;
  }

  .login-screen {
    display: block;
    width: min(470px, calc(100% - 24px));
    min-height: 100vh;
    padding: 18px 0;
  }

  .login-story {
    display: none;
  }

  .login-card {
    width: 100%;
    min-height: calc(100vh - 36px);
    padding: 74px 25px 32px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
  }

  .login-card .login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }

  .login-card .login-brand .brand-mark {
    width: 62px;
    height: 62px;
    padding: 7px;
    border-radius: 9px;
  }

  .login-brand-copy strong {
    font-size: 14px;
  }

  .login-card h1 {
    font-size: 24px;
  }

  .setup-screen {
    padding: 14px;
  }

  .setup-card {
    padding: 20px 16px;
  }
}

@media (max-width: 440px) {
  .report-type-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero-meta {
    grid-template-columns: 1fr 1fr;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .panel,
  .table-wrap {
    box-shadow: none !important;
  }
}
