:root {
  color-scheme: dark;
  --bg: #101010;
  --panel: #171717;
  --panel-raised: #1c1c1c;
  --line: #292929;
  --muted: #858585;
  --text: #ededed;
  --soft: #c5c5c5;
  --accent: #e7e7e7;
  --green: #9ab99f;
  --amber: #c6ad7d;
  --red: #c88d8d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Manrope, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }
.sidebar {
  width: 252px;
  height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  padding: 26px 15px 14px;
  background: #121212;
  border-right: 1px solid var(--line);
  z-index: 4;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 38px; height: 54px; display: block; flex: 0 0 auto; object-fit: contain;
}
.brand strong { display: block; font-size: 14px; letter-spacing: .13em; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.side-label { margin: 38px 9px 12px; color: #686868; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.navigation { display: grid; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 11px;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: #999;
  text-align: left; cursor: pointer; transition: background .18s, color .18s, border-color .18s;
}
.nav-link:hover { color: var(--text); background: #1b1b1b; }
.nav-link.active { color: #f2f2f2; background: #202020; border-color: #2e2e2e; }
.nav-icon { width: 17px; color: #898989; font-size: 17px; text-align: center; }
.nav-link.active .nav-icon { color: #ddd; }
.nav-count { margin-left: auto; min-width: 21px; padding: 1px 6px; border-radius: 20px; background: #2b2b2b; color: #aaa; font-size: 10px; text-align: center; }
.pending-count:not(:empty) { color: #d3bd92; }
.sidebar-bottom { margin-top: auto; }
.sidebar-note { display: flex; gap: 10px; align-items: center; margin: 0 7px 14px; padding: 12px 10px; border: 1px solid #282828; border-radius: 9px; color: var(--muted); font-size: 11px; }
.sidebar-note strong { color: #c9c9c9; font-size: 11px; font-weight: 600; }
.status-dot { display: inline-block; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #8ca993; box-shadow: 0 0 9px #8ca99355; }
.profile-mini, .top-profile { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; }
.profile-mini { padding: 10px 7px 4px; border-top: 1px solid #242424; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #454545; border-radius: 50%; background: #2a2a2a; color: #ddd; font-size: 11px; font-weight: 700; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.avatar.small { width: 29px; height: 29px; font-size: 9px; }
.profile-mini-copy { min-width: 0; flex: 1; }
.profile-mini-copy strong, .profile-mini-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-mini-copy strong { font-size: 11px; font-weight: 600; }
.profile-mini-copy small { color: var(--muted); font-size: 9px; }
.more { color: #8d8d8d; font-size: 19px; }
.main { min-height: 100vh; margin-left: 252px; display: flex; flex-direction: column; }
.topbar { height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; border-bottom: 1px solid #242424; background: #111; }
.breadcrumbs { color: #777; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.breadcrumbs span { margin: 0 8px; color: #555; }
.breadcrumbs b { color: #ddd; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 17px; }
.icon-button { position: relative; width: 32px; height: 32px; border: 1px solid #2d2d2d; border-radius: 9px; background: transparent; color: #aaa; cursor: pointer; }
.icon-button i { position: absolute; top: 6px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: #cbb88f; }
.top-profile { width: auto; color: #c6c6c6; font-size: 11px; }
.chevron { color: #777; }
.mobile-menu { display: none; border: 0; background: none; font-size: 20px; }
.content { width: min(1120px, 100%); flex: 1; margin: 0 auto; padding: 37px 38px 48px; }
.eyebrow { color: #818181; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(24px, 3vw, 32px); line-height: 1.2; letter-spacing: -.04em; }
h2 { margin-bottom: 5px; font-size: 17px; letter-spacing: -.02em; }
h3 { margin-bottom: 5px; font-size: 13px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-heading p { margin-bottom: 0; color: #8c8c8c; font-size: 12px; }
.heading-copy .eyebrow { margin-bottom: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 1px solid #373737; border-radius: 8px; background: #222; color: #e8e8e8; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .16s, transform .16s, border-color .16s; }
.button:hover { background: #2b2b2b; border-color: #4a4a4a; transform: translateY(-1px); }
.button.primary { border-color: #eee; background: linear-gradient(#f7f7f7, #d9d9d9); color: #171717; box-shadow: 0 7px 19px #fff1; }
.button.primary:hover { background: #fff; }
.button.ghost { background: transparent; color: #aaa; }
.button.danger { color: #d39a9a; border-color: #493333; background: #251b1b; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 10px; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card, .panel, .unit-card { border: 1px solid #292929; border-radius: 11px; background: #171717; }
.stat-card { min-height: 115px; padding: 16px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: #999; font-size: 10px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #303030; border-radius: 8px; color: #bbb; }
.stat-value { margin-top: 12px; font-size: 26px; font-weight: 600; letter-spacing: -.05em; }
.stat-note { margin-left: 7px; color: #777; font-size: 10px; letter-spacing: 0; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .85fr; gap: 14px; }
.panel { padding: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.text-button { padding: 0; border: 0; background: none; color: #c5c5c5; font-size: 10px; cursor: pointer; }
.text-button:hover { color: white; }
.activity-list, .report-list, .document-list { display: grid; }
.activity-row { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid #272727; }
.activity-mark { width: 28px; height: 28px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 8px; background: #242424; color: #bbb; }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong { display: block; color: #ddd; font-size: 11px; font-weight: 600; }
.activity-copy small { display: block; margin-top: 3px; color: #828282; font-size: 10px; }
.activity-time { color: #737373; font-size: 9px; white-space: nowrap; }
.unit-list { display: grid; gap: 9px; }
.unit-line { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px; border: 1px solid #292929; border-radius: 8px; background: #191919; }
.unit-line strong { display: block; font-size: 11px; font-weight: 600; }
.unit-line small { display: block; color: #777; font-size: 9px; }
.unit-code { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #343434; border-radius: 8px; color: #ddd; font-weight: 700; }
.unit-line-left { display: flex; align-items: center; gap: 10px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid #333; border-radius: 99px; background: #202020; color: #bbb; font-size: 9px; white-space: nowrap; }
.tag.green { color: var(--green); border-color: #324237; background: #1b241d; }
.tag.amber { color: var(--amber); border-color: #413a2e; background: #242119; }
.tag.red { color: var(--red); border-color: #443333; background: #261e1e; }
.section-spacer { margin-top: 15px; }
.table-wrap { overflow: auto; border: 1px solid #292929; border-radius: 10px; background: #171717; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 14px; border-bottom: 1px solid #2a2a2a; color: #777; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #262626; color: #c7c7c7; font-size: 11px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.person-cell { display: flex; align-items: center; gap: 9px; }
.person-cell strong, .person-cell small { display: block; }
.person-cell strong { color: #e2e2e2; font-size: 11px; font-weight: 600; }
.person-cell small { color: #777; font-size: 9px; }
.empty-state { padding: 35px 20px; color: #868686; text-align: center; font-size: 11px; }
.empty-icon { width: 39px; height: 39px; display: grid; place-items: center; margin: 0 auto 10px; border: 1px solid #333; border-radius: 12px; color: #aaa; font-size: 18px; }
.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.unit-card { padding: 18px; transition: border-color .2s, transform .2s; }
.unit-card:hover { border-color: #484848; transform: translateY(-2px); }
.unit-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 15px; }
.unit-card .unit-code { width: 36px; height: 36px; font-size: 15px; }
.unit-card p { min-height: 35px; margin-bottom: 14px; color: #929292; font-size: 11px; }
.unit-card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid #2a2a2a; color: #777; font-size: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.filter-chip { padding: 7px 11px; border: 1px solid #2e2e2e; border-radius: 99px; background: transparent; color: #999; font-size: 10px; cursor: pointer; }
.filter-chip.active, .filter-chip:hover { border-color: #505050; background: #242424; color: #eee; }
.report-card, .document-row, .application-card { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-top: 1px solid #292929; }
.file-icon { width: 35px; height: 35px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid #333; border-radius: 9px; background: #202020; color: #bbb; }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; overflow: hidden; color: #dedede; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { display: block; margin-top: 3px; color: #808080; font-size: 9px; }
.row-actions { display: flex; align-items: center; gap: 7px; }
.document-preview { display: block; max-width: 240px; max-height: 150px; margin-top: 9px; border: 1px solid #343434; border-radius: 8px; object-fit: cover; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 15px; }
.profile-card { padding: 22px; text-align: center; }
.profile-avatar { width: 72px; height: 72px; margin: 5px auto 13px; font-size: 20px; }
.profile-card h2 { margin-bottom: 3px; }
.profile-card p { margin-bottom: 14px; color: #888; font-size: 11px; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #969696; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field select, .field textarea, .search-input {
  width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid #333; border-radius: 8px;
  outline: 0; background: #202020; color: #e5e5e5; font-size: 11px;
}
.field textarea { min-height: 105px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: #666; }
.field select { color-scheme: dark; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.notice { margin-bottom: 15px; padding: 11px 13px; border: 1px solid #383429; border-radius: 8px; background: #211f1a; color: #b7ad98; font-size: 10px; }
.notice strong { color: #ddd0b0; }
.search-input { max-width: 230px; }
.modal-backdrop { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px; background: #000a; backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(490px, 100%); max-height: 90vh; overflow: auto; padding: 25px; border: 1px solid #373737; border-radius: 14px; background: #171717; box-shadow: 0 25px 90px #0009; }
.modal-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; color: #888; font-size: 22px; cursor: pointer; }
.modal h2 { padding-right: 25px; font-size: 20px; }
.modal-intro { margin-bottom: 18px; color: #888; font-size: 11px; }
.modal .field { margin-bottom: 13px; }
.modal .form-actions { margin-top: 19px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 12; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 12px 15px; border: 1px solid #3c3c3c; border-radius: 9px; background: #222; color: #e8e8e8; box-shadow: 0 10px 30px #0006; font-size: 11px; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1050px) {
  .sidebar { width: 220px; }
  .main { margin-left: 220px; }
  .content { padding-right: 24px; padding-left: 24px; }
  .topbar { padding-right: 24px; padding-left: 24px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform .22s; box-shadow: 12px 0 35px #0008; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { height: 58px; padding: 0 15px; }
  .mobile-menu { display: inline-grid; place-items: center; }
  .breadcrumbs { margin-right: auto; margin-left: 12px; font-size: 9px; }
  .top-actions { gap: 9px; }
  .top-profile { gap: 6px; }
  .top-profile > span:nth-child(2) { display: none; }
  .content { padding: 27px 15px 34px; }
  .dashboard-grid, .profile-layout { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .stats-grid { gap: 8px; }
  .stat-card { min-height: 100px; padding: 12px; }
  .stat-value { font-size: 22px; }
  .unit-grid { grid-template-columns: 1fr; }
  .profile-fields { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .panel { padding: 14px; }
  .topbar .icon-button { display: none; }
  .row-actions { flex-direction: column; align-items: stretch; }
}
.app-shell { display: none; }
.app-shell.authenticated { display: block; }
.app-shell.pending .main { margin-left: 0; }
.app-shell.pending .content { width: 100%; }
[hidden] { display: none !important; }
.senior-link { margin-top: 9px; border-top: 1px solid #292929; border-radius: 0 0 8px 8px; padding-top: 15px; }
.auth-screen {
  position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; overflow: hidden; padding: 35px 20px 70px;
  background: radial-gradient(ellipse at 18% 68%, #252525 0, #181818 17%, transparent 42%),
    radial-gradient(ellipse at 83% 18%, #1b1b1b 0, transparent 38%), #101010;
}
.auth-screen::before, .auth-screen::after {
  position: absolute; z-index: 0; width: 1100px; height: 470px; border: 1px solid #34343466;
  border-radius: 50%; content: ""; pointer-events: none; transform: rotate(20deg);
}
.auth-screen::before { left: -460px; bottom: 60px; box-shadow: 0 12px 0 -1px #34343455, 0 24px 0 -1px #34343444, 0 36px 0 -1px #34343433, 0 48px 0 -1px #34343422; }
.auth-screen::after { left: -550px; bottom: -30px; width: 900px; height: 370px; border-color: #34343445; }
.auth-brand { position: relative; z-index: 1; margin-bottom: 25px; }
.auth-brand .brand-mark { width: 48px; height: 48px; font-size: 22px; }
.auth-card {
  position: relative; z-index: 1; width: min(440px, 100%); padding: 27px;
  border: 1px solid #2c2c2c; border-radius: 12px; background: #171717ed;
  box-shadow: 0 22px 70px #0007; backdrop-filter: blur(12px);
}
.auth-heading { margin-bottom: 20px; }
.auth-heading .eyebrow { margin-bottom: 8px; }
.auth-heading h1 { font-size: 24px; }
.auth-heading p, .auth-footnote { margin-bottom: 0; color: #898989; font-size: 11px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 19px; padding: 3px; border: 1px solid #252525; border-radius: 8px; background: #101010; }
.auth-tab { min-height: 34px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #888; font-size: 11px; cursor: pointer; }
.auth-tab.active { border-color: #373737; background: #272727; color: #eee; font-weight: 700; }
.auth-form { display: grid; gap: 13px; }
.auth-form .field { gap: 6px; }
.auth-form .field input, .auth-form .field select { min-height: 42px; }
.auth-form .button { width: 100%; margin-top: 3px; min-height: 43px; }
.auth-footnote { margin-top: 16px; text-align: center; line-height: 1.6; }
.auth-error { margin-top: 13px; padding: 10px 12px; border: 1px solid #493333; border-radius: 8px; background: #251b1b; color: #e1aaaa; font-size: 10px; }
.auth-disclaimer { position: absolute; z-index: 1; right: 12px; bottom: 17px; left: 12px; color: #777; font-size: 9px; text-align: center; }
.pending-screen { width: min(500px, 100%); margin: 10vh auto; padding: 28px; border: 1px solid #303030; border-radius: 12px; background: #171717; text-align: center; }
.pending-screen .empty-icon { margin-top: 10px; }
.senior-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.senior-member-form { display: flex; align-items: center; gap: 8px; }
.senior-member-form select { min-height: 32px; padding: 4px 7px; border: 1px solid #363636; border-radius: 7px; background: #202020; color: #ddd; font-size: 10px; }
.auth-error[hidden] { display: none; }
@media (max-width: 520px) {
  .auth-screen { justify-content: flex-start; padding: 9vh 14px 60px; }
  .auth-card { padding: 21px 18px; }
  .auth-disclaimer { line-height: 1.5; }
}
