:root {
  color-scheme: light;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #f6f7fb;
  --btn-alert: #f66868;
  --btn-alert-txt: #ffffff;
  --btn-alert-hvr: #ff0000;
  --active-input: #4F46E5;
  --active-text: #ffffff;
  --active-count: #103881;
  --change-theme: #111827;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --surface-muted: #f1f3f7;
  --text: #182230;
  --text-soft: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --success: #027a48;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --sidebar-text: #f9fafb;
  --sidebar-muted: #9ca3af;
  --sidebar-border: rgba(255,255,255,.08);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 10px 24px rgba(16, 24, 40, .08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-width: 256px;
  --header-height: 68px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --btn-alert: #111827;
  --btn-alert-txt: #ff0000;
  --active-input: #222B54;
  --active-text: #ffffff;
  --active-count: #4F46E5;
  --change-theme: #FFD04C;
  --surface: #111827;
  --surface-subtle: #151d2e;
  --surface-muted: #1f2937;
  --text: #f3f4f6;
  --text-soft: #d1d5db;
  --muted: #9ca3af;
  --muted-2: #6b7280;
  --border: #2b3546;
  --border-strong: #3b4658;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-soft: #222b54;
  --success: #6ce9a6;
  --success-soft: #12372a;
  --warning: #fdb022;
  --warning-soft: #3c2c12;
  --danger: #f97066;
  --danger-soft: #3f1f24;
  --info: #84caff;
  --info-soft: #17324f;
  --sidebar: #070b14;
  --sidebar-soft: #111827;
  --sidebar-muted: #8b95a7;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.16);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.18);
  --shadow-md: 0 14px 32px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
[hidden] { display: none !important; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 25%, transparent); outline-offset: 2px; }

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 999;
  transform: translateY(-160%);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-weight: 700;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { transform: none; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }

/* App shell */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--header-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.brand-copy small { display: block; margin-top: 1px; color: var(--sidebar-muted); font-size: 11px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 18px 12px; }
.nav-section + .nav-section { margin-top: 20px; }
.nav-label {
  margin: 0 10px 7px;
  color: #718096;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
}
.nav-list { display: grid; gap: 3px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 9px;
  color: #b9c1ce;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: #232c3c; color: #fff; }
.nav-link.active .icon { color: #a5b4fc; }
.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--sidebar-border); }
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}
.sidebar-account .avatar { width: 34px; height: 34px; }
.sidebar-account-copy { min-width: 0; flex: 1; }
.sidebar-account-copy strong, .sidebar-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-copy strong { font-size: 11.5px; }
.sidebar-account-copy small { color: var(--sidebar-muted); font-size: 10px; margin-top: 1px; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-menu { display: none; }
.page-context { display: grid; gap: 1px; }
.page-context small { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.page-context strong { color: var(--text); font-size: 13px; font-weight: 700; }
.header-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.header-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.header-status.is-online { color: var(--success); border-color: color-mix(in srgb,var(--success) 25%,var(--border)); }
.header-status.is-online::before { background: var(--success); }
.header-status.is-offline { color: var(--danger); }
.header-status.is-offline::before { background: var(--danger); }
.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-xs);
}
.btn-exit{ background: var(--btn-alert); color: var(--btn-alert-txt); }
.icon-button:hover { background: var(--surface-subtle); border-color: var(--border-strong); }
.btn-change-theme:hover { background: var(--change-theme); color: var(--surface); }
.btn-exit:hover{ background: var(--btn-alert-hvr); color: #ffffff; }
.user-chip { display: flex; align-items: center; gap: 9px; margin-left: 2px; }
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}
.user-label { min-width: 0; line-height: 1.25; }
.user-label strong { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.user-label small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.overlay { display: none; }

.content { width: min(1460px, 100%); margin: 0 auto; padding: 30px 30px 52px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.page-head-copy { min-width: 0; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.page-head h1, .page-head h2 { margin: 0; font-size: clamp(24px, 2.2vw, 31px); line-height: 1.2; letter-spacing: -.035em; }
.page-head p { margin: 7px 0 0; max-width: 720px; color: var(--muted); font-size: 13px; }
.actions, .filters { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.page-actions { margin-top: -58px; justify-content: flex-end; margin-bottom: 20px; }

/* Buttons and inputs */
.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.2); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text-soft); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-subtle); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 10.5px; }

.field { display: grid; gap: 6px; }
.field label, .field-label { color: var(--text-soft); font-size: 10.5px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 9.5px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  outline: none;
  font-size: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 92px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb,var(--primary) 14%,transparent); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-muted); color: var(--muted); }
.search-field { position: relative; min-width: 250px; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-field .input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 11.5px; color: var(--text-soft); }
.checkbox-row input { margin-top: 2px; accent-color: var(--primary); }

/* Panels, metrics, tables */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.layout-main-aside { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .72fr); gap: 18px; align-items: start; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 18px; }
.card-header {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 17px;
  border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; font-size: 13px; letter-spacing: -.01em; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }
.card-title-row { min-width: 0; }
.metric {
  min-height: 124px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-muted); color: var(--text-soft); }
.metric small { color: var(--muted); font-size: 10.5px; font-weight: 600; }
.metric strong { display: block; margin-top: 6px; font-size: 27px; line-height: 1; letter-spacing: -.035em; }
.metric-foot { margin-top: 13px; color: var(--muted); font-size: 10px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-subtle); color: var(--muted); font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
td { color: var(--text-soft); font-size: 11.5px; }
tbody tr:hover { background: color-mix(in srgb,var(--surface-muted) 58%,transparent); }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: var(--text); font-weight: 700; }
.table-empty { padding: 30px 14px !important; text-align: center; color: var(--muted); }
.row-title { display: grid; gap: 2px; }
.row-title small { color: var(--muted); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 750;
  line-height: 1.3;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.status.success { color: var(--success); background: var(--success-soft); }
.status.warning { color: var(--warning); background: var(--warning-soft); }
.status.danger { color: var(--danger); background: var(--danger-soft); }
.status.info { color: var(--info); background: var(--info-soft); }
.status.neutral { color: var(--muted); background: var(--surface-muted); }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.list { display: grid; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row-copy { min-width: 0; }
.list-row-copy strong { display: block; font-size: 11.5px; }
.list-row-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

/* Messages */
.admin-message, .app-alert {
  display: none;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}
.admin-message.show, .app-alert.show { display: flex; }
.admin-message.success, .app-alert.success { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb,var(--success) 22%,var(--border)); }
.admin-message.error, .app-alert.error { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb,var(--danger) 22%,var(--border)); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 3px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); width: max-content; max-width: 100%; }
.tabs button, .tabs a { min-height: 32px; padding: 6px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.tabs .active { background: var(--active-input); color: var(--active-text); box-shadow: var(--shadow-xs); }
.admin-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(330px,.65fr); gap: 18px; align-items: start; }
.admin-summary { margin-bottom: 16px; }
.permission-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; max-height: 300px; overflow: auto; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-subtle); }
.permission-item { display: flex; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 10.5px; }
.permission-item input { margin-top: 2px; accent-color: var(--primary); }
.permission-item small { display: block; margin-top: 2px; color: var(--muted); }
.admin-row-title { display: grid; gap: 2px; }
.admin-actions { text-align: right; white-space: nowrap; }
.admin-empty { padding: 28px 14px !important; text-align: center; color: var(--muted); }
.admin-row-title small { color: var(--muted); }

/* Project detail */
.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px; }
.detail-title { display: flex; align-items: flex-start; gap: 13px; }
.detail-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.detail-title h1 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.detail-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-top: 1px solid var(--border); }
.detail-item { padding: 13px 17px; border-right: 1px solid var(--border); }
.detail-item:last-child { border-right: 0; }
.detail-item small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; font-weight: 750; }
.detail-item strong, .detail-item p { display: block; margin: 4px 0 0; color: var(--text-soft); font-size: 11.5px; }
.project-description { padding-top: 13px; margin-top: 13px; border-top: 1px solid var(--border); }
.project-description p { margin: 4px 0 0; color: var(--text-soft); font-size: 11.5px; }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(300px,.7fr); gap: 16px; margin-top: 16px; }
.activity-list { display: grid; }
.activity-row { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.activity-row:last-child { border-bottom: 0; }
.activity-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-muted); color: var(--muted); }
.activity-row strong { display: block; font-size: 11px; }
.activity-row p { margin: 2px 0 0; color: var(--muted); font-size: 9.5px; }

/* Business modules */
.catalog-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.catalog-card { padding: 17px; }
.catalog-card .metric-icon { margin-bottom: 14px; }
.catalog-card h3 { margin: 0; font-size: 13px; }
.catalog-card p { margin: 6px 0 0; color: var(--muted); font-size: 10.5px; }
.catalog-card ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.catalog-card li { display: flex; gap: 7px; color: var(--text-soft); font-size: 10px; }
.catalog-card li::before { content: ""; width: 5px; height: 5px; margin-top: 5px; border-radius: 50%; background: var(--success); flex: 0 0 auto; }
.feature-note { display: flex; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); color: var(--muted); font-size: 10.5px; }
.proposal-summary { display: grid; gap: 9px; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 10.5px; }
.summary-line:last-child { border-bottom: 0; }
.summary-line span { color: var(--muted); }
.summary-line strong { text-align: right; }

/* Login */
.login-page { min-height: 100svh; display: grid; grid-template-columns: minmax(360px,.92fr) minmax(460px,1.08fr); background: var(--surface); }
.login-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px,5vw,68px); background: #111827; color: white; overflow: hidden; }
.login-brand-panel::after { content: ""; position: absolute; width: 440px; height: 440px; right: -260px; bottom: -250px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.015); }
.login-wordmark { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }
.login-wordmark .brand-mark { width: 40px; height: 40px; }
.login-wordmark strong { display: block; font-size: 14px; }
.login-wordmark small { display: block; margin-top: 2px; color: #9ca3af; font-size: 10px; }
.login-copy { position: relative; z-index: 1; max-width: 520px; }
.login-copy .eyebrow { color: #a5b4fc; }
.login-copy h1 { margin: 0; max-width: 520px; font-size: clamp(38px,4.8vw,66px); line-height: 1.02; letter-spacing: -.055em; }
.login-copy p { margin: 20px 0 0; max-width: 500px; color: #b6bfcb; font-size: 13px; line-height: 1.7; }
.login-meta { position: relative; z-index: 1; color: #7f8997; font-size: 9.5px; }
.login-form-panel { display: grid; place-items: center; padding: 34px; background: var(--bg); }
.login-card { width: min(430px,100%); padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-md); }
.login-card-header { margin-bottom: 20px; }
.login-card-header small { color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.login-card-header h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.035em; }
.login-card-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.login-form { display: grid; gap: 13px; }
.password-field { position: relative; }
.password-field .input { padding-right: 45px; }
.password-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 33px; height: 31px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.password-toggle:hover { background: var(--surface-muted); color: var(--text); }
.remember-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.remember-row label { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 10.5px; }
.remember-row input { accent-color: var(--primary); }
.login-link { color: var(--primary); font-size: 10.5px; text-decoration: none; white-space: nowrap; }
.login-link:hover { text-decoration: underline; }
.login-back { display: block; margin-top: 14px; text-align: center; color: var(--muted); font-size: 10.5px; text-decoration: none; }
.login-back:hover { color: var(--text); text-decoration: underline; }
.login-hint { margin: -4px 0 2px; color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.backend-status { display: flex; align-items: center; gap: 8px; min-height: 35px; padding: 8px 10px; border-radius: 9px; background: var(--surface-subtle); border: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.backend-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.backend-status.backend-ok { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb,var(--success) 20%,var(--border)); }
.backend-status.backend-ok::before { background: var(--success); }
.backend-status.backend-error { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb,var(--danger) 20%,var(--border)); }
.backend-status.backend-error::before { background: var(--danger); }
.login-security { display: flex; gap: 7px; margin-top: 16px; color: var(--muted); font-size: 9.5px; }

/* Toasts */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; width: min(340px,calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); color: var(--text-soft); font-size: 10.5px; animation: toastIn .16s ease-out; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Utility */
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.muted { color: var(--muted) !important; }
.text-right { text-align: right; }
.w-auto { width: auto; }
.amount { font-weight: 750; color: var(--text); }
.divider { height: 1px; background: var(--border); }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .catalog-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .admin-layout, .layout-main-aside { grid-template-columns: 1fr; }
  .permission-list { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-item:nth-child(2) { border-right: 0; }
  .detail-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 860px) {
  :root { --header-height: 62px; }
  .sidebar { width: min(280px,86vw); transform: translateX(-104%); transition: transform .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { transform: none; }
  .app-shell { margin-left: 0; }
  .overlay.show { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8,15,28,.5); }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 22px 17px 38px; }
  .page-head { flex-direction: column; }
  .dashboard-grid, .g2, .g3 { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 20px; }
}

@media (max-width: 560px) {
  .topbar { padding-inline: 11px; }
  .header-status, .user-label { display: none; }
  .content { padding-inline: 12px; }
  .g4, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-item { border-right: 0 !important; border-bottom: 1px solid var(--border); }
  .detail-item:last-child { border-bottom: 0; }
  .page-head .actions, .page-head .actions .btn { width: 100%; }
  .page-actions { margin-top: 0; justify-content: flex-start; }
  .filters, .filters > * { width: 100%; }
  .search-field { min-width: 100%; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .login-card { padding: 22px 18px; }
}

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

@media print {
  .sidebar, .topbar, .overlay, .page-head .actions, .form-actions, .btn, .toast-root { display: none !important; }
  .app-shell { margin: 0; }
  .content { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Administration 2.0 */
.sidebar-scroll { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar-scroll:hover { scrollbar-color: #485468 transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.sidebar-scroll:hover::-webkit-scrollbar-thumb { background: #485468; }

.admin-page { display: grid; gap: 16px; }
.admin-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.admin-stat {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.admin-stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.admin-stat > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; }
.admin-stat span:not(.admin-stat-icon) { grid-column: 1; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.admin-stat strong { grid-column: 1; margin-top: 2px; color: var(--text); font-size: 23px; line-height: 1; letter-spacing: -.035em; }
.admin-stat small { grid-column: 2; align-self: end; padding-bottom: 1px; color: var(--muted); font-size: 10px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-tabs { width: auto; }
.admin-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding-inline: 12px; }
.tab-count { min-width: 19px; height: 19px; display: inline-grid; place-items: center; padding: 0 5px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 9px; }
.admin-tabs .active .tab-count { background: var(--active-count); color: var(--active-text); }
.admin-table-card { overflow: hidden; }
.admin-card-header { min-height: 72px; align-items: center; padding: 14px 16px; }
.admin-list-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.admin-list-actions .search-field { min-width: 250px; }
.admin-filter { width: auto; min-width: 150px; }
.admin-results-meta { display: flex; align-items: center; min-height: 34px; padding: 7px 14px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); color: var(--muted); font-size: 9.5px; font-weight: 650; }
.admin-table-card table { min-width: 720px; }
.admin-table-card th:last-child, .admin-table-card td:last-child { width: 110px; }
.admin-table-card tbody tr { transition: background .14s ease; }
.entity-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.entity-avatar { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--surface-muted); color: var(--text-soft); font-size: 9px; font-weight: 800; }
.entity-avatar-role { background: var(--primary-soft); color: var(--primary); }
.contact-cell { display: grid; gap: 2px; }
.contact-cell small { color: var(--muted); }
.role-chip, .permission-count { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 8px; border-radius: 7px; background: var(--surface-muted); color: var(--text-soft); font-size: 9.5px; font-weight: 700; }
.admin-edit-button { min-width: 78px; }
.table-empty-state { display: grid; justify-items: center; gap: 3px; padding: 6px 0; }
.table-empty-state strong { color: var(--text-soft); font-size: 11px; }
.table-empty-state span { color: var(--muted); font-size: 10px; font-weight: 400; }
.loading-line { display: inline-flex; align-items: center; gap: 7px; }
.loading-line::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: adminSpin .7s linear infinite; }
@keyframes adminSpin { to { transform: rotate(360deg); } }

.drawer-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(15,23,42,.34); opacity: 0; backdrop-filter: blur(2px); transition: opacity .18s ease; }
.drawer-backdrop.show { opacity: 1; }
.admin-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(540px,calc(100vw - 44px));
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 50px rgba(16,24,40,.16);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .2s ease, visibility .2s ease;
}
.admin-drawer.open { transform: none; visibility: visible; }
.admin-drawer-header { min-height: 96px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 17px; border-bottom: 1px solid var(--border); }
.admin-drawer-header h2 { margin: 0; color: var(--text); font-size: 19px; letter-spacing: -.025em; }
.admin-drawer-header p:not(.eyebrow) { margin: 5px 0 0; max-width: 420px; color: var(--muted); font-size: 10.5px; }
.admin-drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.admin-drawer .form-grid { gap: 15px 13px; }
.drawer-form-actions { position: sticky; bottom: -20px; display: flex; justify-content: flex-end; gap: 8px; margin: 6px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--border); background: color-mix(in srgb,var(--surface) 96%,transparent); backdrop-filter: blur(10px); }
.optional-label { margin-left: 4px; color: var(--muted); font-weight: 500; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 9.5px; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.password-inline { position: relative; }
.password-inline .input { padding-right: 46px; }
.password-inline-toggle { position: absolute; right: 4px; top: 50%; width: 32px; height: 32px; transform: translateY(-50%); box-shadow: none; }
.selection-count { color: var(--muted); font-size: 9.5px; }
.permission-list-grouped { display: grid; grid-template-columns: 1fr; gap: 10px; max-height: none; overflow: visible; padding: 0; border: 0; background: transparent; }
.permission-group { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.permission-group > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.permission-group > header strong { color: var(--text-soft); font-size: 10.5px; }
.permission-group > header span { color: var(--muted); font-size: 9px; }
.permission-group-items { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; }
.permission-group .permission-item { min-height: 56px; padding: 9px 10px; border: 0; border-radius: 0; background: transparent; }
.permission-group .permission-item:nth-child(odd) { border-right: 1px solid var(--border); }
.permission-group .permission-item:nth-child(n+3) { border-top: 1px solid var(--border); }
.permission-group .permission-item:hover { background: var(--surface-subtle); }
.permission-group .permission-item strong { display: block; color: var(--text-soft); font-size: 10px; }
.permission-group .permission-item small { font-size: 9px; line-height: 1.35; }
.empty-permissions { padding: 18px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); text-align: center; font-size: 10px; }
body.drawer-open { overflow: hidden; }

@media (max-width: 1080px) {
  .admin-card-header { align-items: flex-start; flex-direction: column; }
  .admin-list-actions { width: 100%; justify-content: flex-start; }
  .admin-list-actions .search-field { flex: 1 1 260px; }
}

@media (max-width: 760px) {
  .admin-overview { grid-template-columns: 1fr; gap: 8px; }
  .admin-stat { min-height: 72px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-toolbar > .btn { align-self: flex-start; }
  .admin-tabs { width: 100%; }
  .admin-tabs button { flex: 1; justify-content: center; }
  .admin-list-actions { display: grid; grid-template-columns: 1fr; }
  .admin-list-actions .search-field, .admin-filter, .admin-list-actions .btn { width: 100%; min-width: 0; }
  .admin-drawer { width: 100vw; }
  .permission-group-items { grid-template-columns: 1fr; }
  .permission-group .permission-item:nth-child(odd) { border-right: 0; }
  .permission-group .permission-item:nth-child(n+2) { border-top: 1px solid var(--border); }
}

/* Workspace 3.0 — shared professional layout across all operational modules */
.workspace-page { display: grid; gap: 16px; }
.workspace-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.workspace-stat { min-height: 92px; display: flex; align-items: center; gap: 13px; padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); }
.workspace-stat-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.workspace-stat-copy { min-width: 0; }
.workspace-stat-copy span { display: block; color: var(--muted); font-size: 9.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.workspace-stat-copy strong { display: block; margin-top: 3px; color: var(--text); font-size: 23px; line-height: 1.05; letter-spacing: -.035em; }
.workspace-stat-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 9.5px; }
.workspace-table-card { overflow: hidden; }
.workspace-card-header { min-height: 70px; padding: 14px 16px; }
.workspace-list-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.workspace-list-actions .search-field { min-width: 250px; }
.workspace-filter { width: auto; min-width: 145px; }
.workspace-results-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; padding: 7px 14px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); color: var(--muted); font-size: 9.5px; font-weight: 650; }
.workspace-results-meta strong { color: var(--text-soft); font-weight: 750; }
.workspace-table-card table { min-width: 780px; }
.workspace-table-card th:last-child, .workspace-table-card td:last-child { width: 116px; }
.workspace-primary-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.workspace-primary-actions .btn { min-height: 36px; }
.workspace-empty { display: grid; justify-items: center; gap: 5px; padding: 38px 20px; text-align: center; color: var(--muted); }
.workspace-empty .workspace-empty-icon { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 2px; border-radius: 10px; background: var(--surface-muted); color: var(--muted); }
.workspace-empty strong { color: var(--text-soft); font-size: 11.5px; }
.workspace-empty span { max-width: 360px; font-size: 10px; line-height: 1.5; }
.workspace-drawer { width: min(590px,calc(100vw - 44px)); }
.workspace-drawer .admin-drawer-header { min-height: 92px; }
.workspace-drawer .admin-drawer-body { padding-bottom: 22px; }
.workspace-drawer .drawer-form-actions { margin-top: 16px; }
.workspace-drawer-section { display: grid; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.workspace-drawer-section:first-child { padding-top: 0; }
.workspace-drawer-section:last-child { border-bottom: 0; }
.workspace-drawer-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workspace-drawer-section-title strong { color: var(--text-soft); font-size: 10.5px; }
.workspace-drawer-section-title small { color: var(--muted); font-size: 9px; }
.workspace-inline-note { display: flex; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-subtle); color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.workspace-inline-note .icon { flex: 0 0 auto; margin-top: 1px; }
.scope-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 4px 8px; border-radius: 7px; background: var(--surface-muted); color: var(--muted); font-size: 9.5px; font-weight: 700; }
.scope-chip .icon { width: 13px; height: 13px; }
.table-action-group { display: flex; justify-content: flex-end; gap: 6px; }
.table-link { color: var(--primary); font-size: 10px; font-weight: 750; }
.table-link:hover { text-decoration: underline; }

/* Proposal workspace */
.proposal-workspace { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.65fr); gap: 16px; align-items: start; }
.proposal-editor-card, .proposal-preview-card { overflow: hidden; }
.proposal-preview-card { position: sticky; top: calc(var(--topbar-height, 72px) + 16px); }
.proposal-preview-hero { padding: 20px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg,var(--primary-soft),var(--surface)); }
.proposal-preview-hero .eyebrow { margin-bottom: 7px; }
.proposal-preview-hero h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.proposal-preview-hero p { margin: 6px 0 0; color: var(--muted); font-size: 10.5px; }
.proposal-module-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.proposal-module { display: flex; gap: 9px; align-items: flex-start; min-height: 62px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.proposal-module:has(input:checked) { border-color: color-mix(in srgb,var(--primary) 42%,var(--border)); background: color-mix(in srgb,var(--primary-soft) 45%,var(--surface)); }
.proposal-module input { margin-top: 2px; accent-color: var(--primary); }
.proposal-module strong { display: block; color: var(--text-soft); font-size: 10.5px; }
.proposal-module small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.proposal-status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-subtle); color: var(--muted); font-size: 9.5px; }

/* Capability catalog */
.capability-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.capability-card { display: flex; flex-direction: column; min-height: 225px; padding: 17px; }
.capability-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.capability-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.capability-card h2 { margin: 15px 0 0; font-size: 13.5px; letter-spacing: -.015em; }
.capability-card p { margin: 6px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.capability-list { margin: 13px 0 16px; padding: 0; list-style: none; display: grid; gap: 7px; }
.capability-list li { display: flex; align-items: flex-start; gap: 7px; color: var(--text-soft); font-size: 9.7px; }
.capability-list li::before { content: ""; width: 5px; height: 5px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--success); }
.capability-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.capability-footer small { color: var(--muted); font-size: 9px; }

/* Executive dashboard refinements */
.executive-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.65fr); gap: 16px; }
.quick-action-list { display: grid; }
.quick-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.quick-action:last-child { border-bottom: 0; }
.quick-action-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quick-action-icon { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--surface-muted); color: var(--text-soft); }
.quick-action strong { display: block; color: var(--text-soft); font-size: 10.5px; }
.quick-action small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }

/* Project detail 3.0 */
.project-command-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project-detail-main { display: grid; gap: 16px; }
.project-info-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(280px,.7fr); gap: 16px; }
.project-description-card { min-height: 100%; }
.member-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .workspace-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .capability-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .proposal-workspace, .executive-grid, .project-info-grid { grid-template-columns: 1fr; }
  .proposal-preview-card { position: static; }
}
@media (max-width: 900px) {
  .workspace-card-header { align-items: flex-start; flex-direction: column; }
  .workspace-list-actions { width: 100%; justify-content: flex-start; }
  .workspace-list-actions .search-field { flex: 1 1 260px; }
}
@media (max-width: 760px) {
  .workspace-overview, .capability-grid { grid-template-columns: 1fr; }
  .workspace-list-actions { display: grid; grid-template-columns: 1fr; }
  .workspace-list-actions .search-field, .workspace-filter, .workspace-list-actions .btn { width: 100%; min-width: 0; }
  .workspace-drawer { width: 100vw; }
  .proposal-module-grid { grid-template-columns: 1fr; }
  .workspace-results-meta, .project-command-bar, .member-toolbar { align-items: stretch; flex-direction: column; }
  .workspace-primary-actions { width: 100%; }
  .workspace-primary-actions .btn { flex: 1; }
}
