:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071018;
  color: #f7fafc;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 13% 10%, rgba(34, 211, 238, 0.12), transparent 32rem),
    radial-gradient(circle at 92% 88%, rgba(45, 212, 191, 0.10), transparent 30rem),
    #071018;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(22rem, .85fr);
  align-items: center;
  gap: clamp(3rem, 8vw, 9rem);
  width: min(74rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: 4rem 0;
}

.brand { max-width: 40rem; }

.mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 3rem;
  border: 1px solid rgba(94, 234, 212, .42);
  border-radius: .85rem;
  background: linear-gradient(145deg, rgba(45, 212, 191, .18), rgba(8, 145, 178, .08));
  color: #99f6e4;
  font-size: 1.2rem;
  font-weight: 850;
  box-shadow: 0 1rem 3rem rgba(8, 145, 178, .12);
}

.eyebrow, .card-kicker {
  margin: 0 0 1rem;
  color: #5eead4;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .22em;
}

h1 {
  max-width: 42rem;
  margin: 0;
  font-size: clamp(3rem, 6.5vw, 6.4rem);
  line-height: .96;
  letter-spacing: -.065em;
}

.brand-copy {
  max-width: 34rem;
  margin: 2rem 0 2.2rem;
  color: #9fb0bf;
  font-size: 1.08rem;
  line-height: 1.75;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  color: #738797;
  font-size: .78rem;
  letter-spacing: .04em;
}

.trust-row span::before { content: "✓"; margin-right: .5rem; color: #2dd4bf; }

.login-card {
  padding: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 1.5rem;
  background: rgba(12, 24, 34, .82);
  box-shadow: 0 2.5rem 7rem rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}

#login-form, #new-password-form { display: grid; gap: 1rem; }
#login-form .card-copy, #new-password-form .card-copy { margin: .35rem 0 .65rem; }
.password-hint { margin: -.25rem 0 .25rem; color: #6f8291; font-size: .76rem; line-height: 1.5; }

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -.045em;
}

h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  letter-spacing: -.025em;
}

.card-copy {
  margin: 1.35rem 0 1.8rem;
  color: #9fb0bf;
  line-height: 1.7;
}

button {
  width: 100%;
  min-height: 3.4rem;
  border: 0;
  border-radius: .8rem;
  padding: .9rem 1.1rem;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover { transform: translateY(-1px); }
button:focus-visible { outline: 3px solid #f8fafc; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; }

.primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #5eead4;
  color: #06211f;
}

.primary:hover { background: #99f6e4; }

.secondary {
  margin-top: 1.5rem;
  border: 1px solid rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .55);
  color: #e2e8f0;
}

.signup-note, footer {
  color: #6f8291;
  font-size: .78rem;
  line-height: 1.55;
}

.signup-note { margin: 1.1rem 0 0; text-align: center; }

.connection {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: .8rem;
  background: rgba(2, 6, 23, .32);
  color: #b8c6d1;
  font-size: .88rem;
}

.membership {
  margin-top: .85rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(94, 234, 212, .2);
  border-radius: .8rem;
  background: rgba(45, 212, 191, .06);
  color: #ccfbf1;
  font-size: .84rem;
  line-height: 1.5;
}

.admin-form {
  display: grid;
  gap: .9rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, .11);
}

.admin-form .card-kicker { margin-bottom: -.35rem; }

label {
  display: grid;
  gap: .4rem;
  color: #9fb0bf;
  font-size: .78rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 2.9rem;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: .7rem;
  padding: .7rem .85rem;
  background: rgba(2, 6, 23, .4);
  color: #f8fafc;
  font: inherit;
}

input:focus { outline: 2px solid #5eead4; outline-offset: 2px; }

.status-dot {
  width: .58rem;
  height: .58rem;
  border-radius: 999px;
  background: #fbbf24;
  box-shadow: 0 0 0 .22rem rgba(251, 191, 36, .12);
}

.status-dot.connected { background: #34d399; box-shadow: 0 0 0 .22rem rgba(52, 211, 153, .12); }
.status-dot.failed { background: #fb7185; box-shadow: 0 0 0 .22rem rgba(251, 113, 133, .12); }

.status {
  display: block;
  min-height: 1.5rem;
  margin-top: 1rem;
  color: #fda4af;
  font-size: .84rem;
  line-height: 1.5;
}

.status.success { color: #6ee7b7; }

footer {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(148, 163, 184, .11);
  text-align: center;
}

[hidden] { display: none !important; }

.dashboard-shell {
  width: min(74rem, calc(100% - 3rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(3rem, 8vw, 7rem);
}

.brand-lockup { display: flex; align-items: center; gap: .9rem; }
.brand-lockup .eyebrow { margin: 0 0 .2rem; }
.mark.compact { width: 2.6rem; height: 2.6rem; margin: 0; border-radius: .7rem; }
.compact-button { width: auto; min-width: 7rem; margin: 0; }

.welcome-panel { max-width: 54rem; }
.welcome-panel h1 { max-width: none; font-size: clamp(2.8rem, 7vw, 5.8rem); }
.welcome-panel .brand-copy { margin-bottom: 1.4rem; }
.welcome-panel .connection, .welcome-panel .membership { max-width: 38rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.dashboard-grid .admin-form { margin: 0; border: 1px solid rgba(148, 163, 184, .16); }
.dashboard-grid .login-card { align-content: start; }
.dashboard-status { max-width: 40rem; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; gap: 3rem; width: min(36rem, calc(100% - 2rem)); padding: 2rem 0; }
  .brand { padding-top: 1rem; }
  .mark { margin-bottom: 2rem; }
  h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .dashboard-shell { width: min(36rem, calc(100% - 2rem)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Universal authenticated application shell */
.app-body {
  --sidebar-width: 17rem;
  --topbar-height: 4.75rem;
  min-height: 100vh;
  background: #081119;
}

.app-body::before { opacity: .09; }

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 1.2rem .9rem;
  border-right: 1px solid rgba(148, 163, 184, .13);
  background: rgba(8, 17, 25, .98);
  transition: width 180ms ease, transform 180ms ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-height: 3.25rem;
  padding: 0 .45rem;
  color: #f8fafc;
  text-decoration: none;
}

.sidebar-brand .mark { flex: 0 0 auto; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { letter-spacing: .13em; }
.sidebar-brand small { margin-top: .18rem; color: #718596; font-size: .7rem; }

.sidebar-nav {
  display: grid;
  gap: .3rem;
  margin-top: 2.4rem;
}

.nav-item, .collapse-button {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-height: 3rem;
  padding: .65rem .75rem;
  border-radius: .75rem;
  color: #8fa2b1;
  text-decoration: none;
  white-space: nowrap;
}

.nav-item:hover { background: rgba(148, 163, 184, .08); color: #e2e8f0; }
.nav-item.active { background: rgba(45, 212, 191, .1); color: #99f6e4; }
.nav-icon { display: grid; flex: 0 0 1.5rem; place-items: center; font-size: 1.15rem; }

.collapse-button {
  width: 100%;
  margin-top: auto;
  border: 1px solid rgba(148, 163, 184, .12);
  background: transparent;
  font-size: .82rem;
  font-weight: 650;
}

.collapse-icon { font-size: 1.5rem; transition: transform 180ms ease; }
.sidebar-collapsed { --sidebar-width: 5rem; }
.sidebar-collapsed .sidebar-label { display: none; }
.sidebar-collapsed .collapse-icon { transform: rotate(180deg); }

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: .75rem clamp(1rem, 3vw, 2.4rem);
  border-bottom: 1px solid rgba(148, 163, 184, .13);
  background: rgba(8, 17, 25, .9);
  backdrop-filter: blur(18px);
  transition: left 180ms ease;
}

.topbar-context span, .topbar-context strong { display: block; }
.topbar-context span { color: #708494; font-size: .7rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.topbar-context strong { margin-top: .2rem; font-size: .96rem; }
.topbar-actions { display: flex; align-items: center; gap: .65rem; }

.icon-button, .ghost-button, .pagination button {
  width: auto;
  min-height: 2.55rem;
  border: 1px solid rgba(148, 163, 184, .15);
  background: rgba(15, 23, 42, .45);
  color: #d5dee5;
}

.icon-button { position: relative; min-width: 2.55rem; padding: .55rem; }
.notification-dot { position: absolute; top: .52rem; right: .52rem; width: .38rem; height: .38rem; border-radius: 50%; background: #5eead4; }
.mobile-navigation { display: none; }
.user-control { position: relative; }

.user-button {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: auto;
  min-height: 3rem;
  padding: .35rem .65rem;
  border: 1px solid transparent;
  background: transparent;
  color: #f8fafc;
  text-align: left;
}

.user-button:hover { border-color: rgba(148, 163, 184, .15); background: rgba(15, 23, 42, .45); }
.avatar { display: grid; width: 2.15rem; height: 2.15rem; place-items: center; border-radius: .65rem; background: #164e4a; color: #99f6e4; font-size: .75rem; font-weight: 850; }
.user-copy strong, .user-copy small { display: block; }
.user-copy strong { font-size: .82rem; }
.user-copy small { margin-top: .12rem; color: #738797; font-size: .68rem; }

.user-menu {
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  width: 17rem;
  padding: .8rem;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: .9rem;
  background: #0d1923;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .35);
}

.user-menu > div { padding: .45rem .5rem .8rem; }
.user-menu strong, .user-menu small { display: block; overflow: hidden; text-overflow: ellipsis; }
.user-menu small { margin-top: .25rem; color: #8294a2; }
.user-menu button { min-height: 2.6rem; background: rgba(251, 113, 133, .08); color: #fda4af; }

.app-main, .app-footer {
  margin-left: var(--sidebar-width);
  transition: margin-left 180ms ease;
}

.app-main { min-height: calc(100vh - 4rem); padding: calc(var(--topbar-height) + 2.5rem) clamp(1rem, 3vw, 2.4rem) 3rem; }

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  max-width: 92rem;
  margin: 0 auto 2rem;
}

.page-heading .eyebrow { margin-bottom: .7rem; }
.page-heading h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); }
.page-heading p:last-child { margin: .85rem 0 0; color: #8497a6; }
.page-action { flex: 0 0 auto; width: auto; gap: .7rem; }

.metric-grid, .content-grid { display: grid; max-width: 92rem; margin-right: auto; margin-left: auto; }
.metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.content-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

.card {
  min-width: 0;
  padding: 1.3rem;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 1rem;
  background: rgba(12, 24, 34, .82);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .12);
}

.span-two { grid-column: span 2; }
.metric-card { display: flex; align-items: center; gap: 1rem; }
.metric-icon { display: grid; flex: 0 0 3rem; height: 3rem; place-items: center; border-radius: .85rem; font-size: 1.2rem; }
.metric-icon.teal { background: rgba(45, 212, 191, .1); color: #5eead4; }
.metric-icon.blue { background: rgba(56, 189, 248, .1); color: #7dd3fc; }
.metric-icon.amber { background: rgba(251, 191, 36, .1); color: #fcd34d; }
.metric-card small, .metric-card strong, .metric-card span { display: block; }
.metric-card small { color: #7f92a1; font-weight: 700; }
.metric-card strong { margin: .22rem 0; font-size: 1.6rem; letter-spacing: -.04em; }
.metric-card span { color: #657a8a; font-size: .72rem; }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-header .card-kicker { margin-bottom: .5rem; }
.card-header h2, .button-card h2, .blank-card h2 { font-size: 1.35rem; }
.ghost-button { min-height: 2.5rem; padding: .55rem .8rem; font-size: .78rem; }
.muted { color: #8497a6; line-height: 1.6; }

.table-card { padding: 0; overflow: hidden; }
.table-card > .card-header, .table-filters { padding: 1.3rem; }
.table-filters { display: flex; gap: .7rem; border-top: 1px solid rgba(148, 163, 184, .09); border-bottom: 1px solid rgba(148, 163, 184, .09); }
.search-field { position: relative; flex: 1; }
.search-field span { position: absolute; z-index: 1; top: .78rem; left: .85rem; }
.search-field input { padding-left: 2.2rem; }
.table-filters input, .table-filters select { min-height: 2.65rem; }
select { border: 1px solid rgba(148, 163, 184, .22); border-radius: .7rem; padding: .6rem .8rem; background: #0a1620; color: #e2e8f0; font: inherit; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .85rem 1.3rem; border-bottom: 1px solid rgba(148, 163, 184, .09); text-align: left; }
th { color: #778b9a; font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.empty-row td { padding: 3rem 1.3rem; color: #718596; text-align: center; }
.empty-row strong, .empty-row span { display: block; }
.empty-row strong { margin-bottom: .4rem; color: #b8c6d1; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.3rem; color: #718596; font-size: .74rem; }
.pagination { display: flex; align-items: center; gap: .45rem; }
.pagination button { min-height: 2rem; padding: .35rem .6rem; font-size: .7rem; }
.pagination span { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: .5rem; background: rgba(45, 212, 191, .1); color: #99f6e4; }

.mini-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin: 1.2rem 0; text-align: center; }
.mini-calendar > span { display: grid; min-height: 2rem; place-items: center; border-radius: .5rem; color: #9fb0bf; font-size: .75rem; }
.mini-calendar .calendar-label { min-height: 1.5rem; color: #5f7484; font-size: .64rem; font-weight: 800; }
.mini-calendar .today { background: #5eead4; color: #06211f; font-weight: 850; }
.calendar-note { display: flex; align-items: center; gap: .7rem; padding-top: 1rem; border-top: 1px solid rgba(148, 163, 184, .09); }
.calendar-note > span { width: .55rem; height: .55rem; border-radius: 50%; background: #5eead4; }
.calendar-note strong, .calendar-note small { display: block; }
.calendar-note small { margin-top: .15rem; color: #718596; }

.form-card { display: grid; gap: .9rem; }
.form-card .muted { margin: 0; font-size: .8rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.button-card { display: grid; align-content: start; gap: .8rem; }
.button-card-icon { display: grid; width: 3rem; height: 3rem; place-items: center; border-radius: .85rem; background: rgba(56, 189, 248, .1); color: #7dd3fc; }
.button-card .card-kicker, .blank-card .card-kicker { margin-bottom: .5rem; }
.button-card p, .blank-card p { margin-bottom: 0; }
.blank-card { min-height: 12rem; border-style: dashed; }

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0;
  padding: 1.2rem clamp(1rem, 3vw, 2.4rem);
  border-top: 1px solid rgba(148, 163, 184, .1);
  text-align: left;
}

.navigation-scrim { position: fixed; z-index: 35; inset: 0; background: rgba(0, 0, 0, .55); }

@media (max-width: 1040px) {
  .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: 1fr; }
  .calendar-card, .form-card, .button-card, .blank-card { grid-column: span 1; }
}

@media (max-width: 760px) {
  .app-body { --sidebar-width: 17rem; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .topbar { left: 0; }
  .mobile-navigation { display: inline-grid; }
  .topbar-context { display: none; }
  .user-copy { display: none; }
  .app-main, .app-footer { margin-left: 0; }
  .app-main { padding-top: calc(var(--topbar-height) + 1.5rem); }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-action { width: 100%; }
  .content-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: span 1; }
  .form-row { grid-template-columns: 1fr; }
  .table-filters, .card-footer, .app-footer { align-items: stretch; flex-direction: column; }
}
