:root {
  color-scheme: light;
  --ink: #08131f;
  --muted: #52606f;
  --line: #dce8e1;
  --panel: #ffffff;
  --canvas: #f7faf8;
  --teal: #0f766e;
  --teal-dark: #0b5c56;
  --mint: #d9f7e7;
  --coral: #ff8a68;
  --yellow: #ffd166;
  --navy: #07131f;
  --green: #16886c;
  --green-soft: #e7f7f1;
  --amber: #aa7418;
  --amber-soft: #fff5df;
  --red: #b7495a;
  --red-soft: #fff0f1;
  --shadow: 0 24px 70px rgba(7, 19, 31, .14);
  --radius-xl: 32px;
  --radius-lg: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr); background: white; }
.login-brand-panel { min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: 46px clamp(34px, 6vw, 88px); color: white; background: radial-gradient(circle at 16% 86%, rgba(255,138,104,.22), transparent 34%), radial-gradient(circle at 86% 12%, rgba(20,184,166,.34), transparent 38%), linear-gradient(145deg, #07131f 0%, #0d2431 54%, #0f766e 100%); }
.brand-lockup { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 23px; font-weight: 780; letter-spacing: -.7px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; color: var(--navy); border: 0; border-radius: 13px; background: var(--mint); box-shadow: inset 0 -4px rgba(7,19,31,.08); font-size: 18px; font-weight: 850; }
.login-brand-copy { max-width: 520px; margin: 60px auto; }
.login-brand-copy .eyebrow { color: var(--coral); }
.eyebrow { margin: 0 0 9px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: 1.35px; }
.login-brand-copy h1 { max-width: 500px; margin: 0 0 20px; font-size: clamp(36px, 4.4vw, 60px); line-height: 1.05; letter-spacing: -2.5px; }
.login-brand-copy p:not(.eyebrow) { max-width: 430px; color: rgba(255,255,255,.77); font-size: 16px; line-height: 1.7; }
.brand-footer { color: rgba(255,255,255,.62); font-size: 12px; }
.login-form-panel { display: grid; place-items: center; padding: 35px; }
.login-card { width: min(100%, 420px); padding: 28px 0; }
.login-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 30px; color: var(--navy); border-radius: 15px; background: var(--mint); font-size: 15px; font-weight: 850; letter-spacing: -.5px; }
.login-card h2 { margin: 0 0 8px; font-size: 31px; letter-spacing: -1.1px; }
.muted { color: var(--muted); }
.login-card .muted { margin: 0 0 30px; font-size: 14px; }
.login-card label { display: block; margin: 18px 0 8px; font-size: 12px; font-weight: 700; }
.login-card input { width: 100%; height: 48px; padding: 0 14px; outline: none; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
.login-card input:focus, .search-wrap:focus-within, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
.login-note { margin: 18px 0 0; color: #7b8a91; font-size: 11px; line-height: 1.6; text-align: center; }
.form-error { margin-top: 15px; padding: 11px 13px; color: #973b4b; border: 1px solid #f1c8ce; border-radius: 8px; background: var(--red-soft); font-size: 12px; line-height: 1.5; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 730; transition: transform .15s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: var(--navy); background: var(--mint); box-shadow: 0 12px 24px rgba(15,118,110,.14); }
.button.primary:hover { background: #effff5; }
.button.wide { width: 100%; height: 48px; margin-top: 22px; }
.button:disabled { opacity: .65; cursor: wait; }
.button.subtle { color: var(--teal-dark); border-color: var(--line); background: #fff; }

.portal { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 16px 17px; border-right: 1px solid rgba(255,255,255,.12); background: var(--navy); }
.sidebar-brand { padding: 0 10px 31px; color: white; font-size: 20px; }
.sidebar-brand .brand-mark { width: 33px; height: 33px; color: var(--navy); border: 0; border-radius: 10px; background: var(--mint); }
.workspace-label { padding: 0 11px; color: rgba(255,255,255,.45); font-size: 9px; font-weight: 800; letter-spacing: 1.4px; }
.side-nav { display: grid; gap: 5px; margin-top: 13px; }
.nav-item { width: 100%; min-height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 12px; color: rgba(255,255,255,.68); border: 0; border-radius: 13px; background: transparent; text-align: left; font-size: 12px; font-weight: 650; }
.nav-item:hover { color: white; background: rgba(255,255,255,.08); }
.nav-item.active { color: var(--navy); background: var(--mint); }
.nav-icon { width: 17px; color: rgba(255,255,255,.47); font-size: 18px; text-align: center; }
.nav-item.active .nav-icon { color: var(--teal-dark); }
.sidebar-bottom { display: grid; gap: 15px; margin-top: auto; }
.owner-access-card { display: flex; align-items: center; gap: 10px; padding: 12px; color: white; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.07); }
.access-dot, .live-indicator i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #36a985; box-shadow: 0 0 0 3px rgba(54,169,133,.12); }
.owner-access-card strong, .owner-access-card small { display: block; }
.owner-access-card strong { font-size: 11px; }
.owner-access-card small { margin-top: 3px; color: rgba(255,255,255,.55); font-size: 10px; }
.logout { color: rgba(255,255,255,.62); }

.main-column { min-width: 0; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.breadcrumbs { display: flex; align-items: center; gap: 10px; color: #7b8a91; font-size: 11px; }
.breadcrumbs strong { color: var(--navy); font-weight: 700; }
.crumb-separator { color: #c3c9d4; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: #52606f; font-size: 11px; }
.live-indicator { display: inline-flex; align-items: center; gap: 8px; margin-right: 13px; color: var(--teal-dark); font-size: 10px; }
.live-indicator i { width: 6px; height: 6px; flex-basis: 6px; }
.avatar { width: 29px; height: 29px; display: grid; place-items: center; color: var(--teal-dark); border-radius: 50%; background: var(--mint); font-size: 10px; font-weight: 800; }
.topbar-user { font-weight: 650; }
.workspace { max-width: 1560px; margin: 0 auto; padding: 34px; }
.page-section { display: grid; gap: 20px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 1px; }
.page-heading h1 { margin: 0 0 6px; color: var(--navy); font-size: 29px; letter-spacing: -1.1px; }
.page-heading .muted { margin: 0; font-size: 12px; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.readonly-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--teal-dark); border: 1px solid #bfe8d4; border-radius: 20px; background: var(--mint); font-size: 10px; font-weight: 730; white-space: nowrap; }
.readonly-pill span { font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; }
.metric-card { min-height: 103px; padding: 16px 17px 14px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 8px 24px rgba(7,19,31,.04); }
.metric-card-top { display: flex; align-items: center; justify-content: space-between; color: #758198; font-size: 10px; font-weight: 680; }
.metric-icon { width: 27px; height: 27px; display: grid; place-items: center; color: var(--teal-dark); border-radius: 9px; background: var(--mint); font-size: 13px; }
.metric-value { margin-top: 10px; color: var(--navy); font-size: 24px; font-weight: 760; letter-spacing: -.6px; }
.metric-hint { margin-top: 3px; color: #98a1b1; font-size: 10px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: 0 10px 30px rgba(7,19,31,.045); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 19px 21px 12px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 15px; letter-spacing: -.2px; }
.panel-heading .muted { margin: 0; font-size: 10px; }
.text-button { padding: 5px 0; color: var(--teal); border: 0; background: transparent; font-size: 10px; font-weight: 720; }
.text-button span { margin-left: 5px; font-size: 14px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px 15px; }
.search-wrap { width: min(100%, 350px); height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.search-wrap > span { color: #96a0b1; font-size: 19px; line-height: 1; }
.search-wrap input { width: 100%; min-width: 0; height: 100%; padding: 0; color: var(--ink); outline: none; border: 0; background: transparent; font-size: 10px; }
.search-wrap input::placeholder { color: #a3abba; }
.result-count { color: #909aac; font-size: 10px; white-space: nowrap; }
.table-host { min-height: 76px; overflow: hidden; }
.table-scroll { overflow: auto; border-top: 1px solid #edf0f5; }
table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
thead { background: #fafbfc; }
th { padding: 11px 13px; color: #7c879b; font-size: 9px; font-weight: 720; text-align: left; }
td { max-width: 340px; padding: 11px 13px; overflow: hidden; color: #43506a; border-top: 1px solid #f0f2f6; text-overflow: ellipsis; vertical-align: middle; }
tbody tr:hover { background: #fbfffc; }
.primary-cell { color: var(--navy); font-weight: 700; }
.secondary-cell { display: block; max-width: 260px; margin-top: 3px; overflow: hidden; color: #929bad; font-size: 9px; text-overflow: ellipsis; }
.table-action { padding: 6px 9px; color: var(--teal-dark); border: 1px solid #bfe8d4; border-radius: 999px; background: var(--mint); font-size: 9px; font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; padding: 4px 7px; color: #637087; border-radius: 15px; background: #f0f2f6; font-size: 9px; font-weight: 700; }
.status-pill.active, .status-pill.open, .status-pill.success { color: #17775f; background: var(--green-soft); }
.status-pill.pending, .status-pill.in_progress, .status-pill.trial { color: #996912; background: var(--amber-soft); }
.status-pill.blocked, .status-pill.closed, .status-pill.cancelled, .status-pill.failed { color: #a34452; background: var(--red-soft); }
.empty-state { padding: 30px 16px; color: #7b8a91; text-align: center; font-size: 11px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 11px 18px; color: #858fa2; font-size: 10px; }
.pager button { min-width: 59px; height: 28px; color: #515f77; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 10px; }
.pager button:disabled { opacity: .45; cursor: default; }
.compact-panel { margin-bottom: 18px; }
.feedback-list { display: grid; }
.feedback-item { display: grid; grid-template-columns: 95px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 13px 21px; border-top: 1px solid #f0f2f6; }
.feedback-item strong { display: block; margin-bottom: 4px; font-size: 10px; }
.feedback-item p { margin: 0; overflow: hidden; color: #8993a5; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.feedback-type { color: var(--teal-dark); font-size: 9px; font-weight: 750; }
.feedback-location { color: #919aac; font-size: 9px; }

.dialog-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(17,24,42,.48); backdrop-filter: blur(3px); }
.building-dialog { width: min(1220px,100%); max-height: min(92vh,1000px); overflow: auto; padding: 22px; border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius-lg); background: var(--canvas); box-shadow: 0 25px 90px rgba(7,19,31,.3); }
.building-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 1px 2px 16px; }
.building-dialog-header h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.6px; }
.building-dialog-header .muted { margin: 0; font-size: 11px; }
.icon-button { width: 34px; height: 34px; color: #718098; border: 1px solid #e1e5ec; border-radius: 8px; background: white; font-size: 22px; line-height: 1; }
.building-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; margin-bottom: 17px; }
.building-metrics .metric-card { min-height: 83px; padding: 12px; }
.building-metrics .metric-value { margin-top: 7px; font-size: 19px; }
.building-metrics .metric-card-top { font-size: 9px; }
.record-toolbar { display: flex; align-items: flex-end; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: white; }
.record-selector { min-width: 220px; }
.record-selector label { display: block; margin: 0 0 6px; color: #8a95a7; font-size: 9px; font-weight: 700; }
.record-selector select { width: 100%; height: 36px; padding: 0 10px; color: var(--ink); outline: none; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 10px; }
.record-search { margin-left: auto; }
.dialog-table { min-height: 150px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; background: white; }
.dialog-footnote { margin: 12px 3px 1px; color: #7b8a91; font-size: 9px; }
.toast { position: fixed; z-index: 40; right: 24px; bottom: 24px; max-width: min(440px,calc(100vw - 32px)); padding: 12px 16px; transform: translateY(15px); opacity: 0; pointer-events: none; color: white; border-radius: 8px; background: #26314a; box-shadow: 0 9px 25px rgba(18,26,45,.2); font-size: 11px; line-height: 1.5; transition: .2s; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: #903b4a; }
.loading { padding: 24px 15px; color: #8994a6; text-align: center; font-size: 11px; }

@media (max-width: 1050px) {
  .portal { grid-template-columns: 205px minmax(0,1fr); }
  .workspace { padding: 26px 22px; }
  .topbar { padding: 0 22px; }
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .building-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 250px; padding: 24px; }
  .login-brand-copy { margin: 37px 0 12px; }
  .login-brand-copy h1 { font-size: 35px; letter-spacing: -1.5px; }
  .login-brand-copy p:not(.eyebrow) { margin-bottom: 0; font-size: 13px; }
  .brand-footer { display: none; }
  .login-form-panel { padding: 10px 25px 35px; }
  .login-icon { margin-bottom: 19px; }
  .portal { display: block; }
  .sidebar { position: sticky; z-index: 5; top: 0; height: auto; padding: 10px 12px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { display: none; }
  .workspace-label, .sidebar-bottom { display: none; }
  .side-nav { display: flex; gap: 5px; margin: 0; overflow-x: auto; }
  .nav-item { width: auto; min-width: max-content; min-height: 39px; gap: 7px; padding: 0 10px; font-size: 10px; }
  .nav-icon { width: auto; font-size: 15px; }
  .topbar { height: 50px; padding: 0 14px; }
  .topbar-right { gap: 7px; }
  .live-indicator { margin-right: 3px; font-size: 0; }
  .topbar-user { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace { padding: 22px 13px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 24px; }
  .page-heading .muted { max-width: 420px; line-height: 1.5; }
  .heading-actions { flex-direction: column; align-items: flex-end; }
  .heading-actions .button { min-height: 32px; }
  .heading-actions .button span { display: none; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric-card { min-height: 90px; padding: 12px; }
  .metric-value { font-size: 21px; }
  .panel-heading { align-items: flex-start; padding: 15px 13px 10px; }
  .toolbar { padding: 8px 13px 12px; }
  .search-wrap { max-width: 100%; }
  .feedback-item { grid-template-columns: 75px minmax(0,1fr); gap: 8px; padding: 12px; }
  .feedback-location { grid-column: 2; }
  .dialog-backdrop { align-items: end; padding: 0; }
  .building-dialog { max-height: 94vh; padding: 15px 12px; border-radius: 15px 15px 0 0; }
  .building-dialog-header h2 { font-size: 19px; }
  .building-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .building-metrics .metric-card:last-child:nth-child(odd) { grid-column: span 2; }
  .record-toolbar { flex-wrap: wrap; padding: 10px; }
  .record-selector { flex: 1 1 100%; }
  .record-search { flex: 1 1 180px; margin-left: 0; }
  .record-toolbar .result-count { margin-left: auto; }
}
