:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #182c29;
  background: #f2f6f4;
  font-synthesis: none;
  --ink: #182c29;
  --muted: #516660;
  --border: #dce6e1;
  --green: #195949;
  --dark: #112b28;
  --mint: #c7f0dc;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px #0b322910;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .64; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #23826b; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 2.875rem); line-height: 1.09; letter-spacing: -.065em; font-weight: 720; }
h2 { font-size: 1.25rem; letter-spacing: -.026em; line-height: 1.25; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.wrap { overflow-wrap: anywhere; }
.skip-link { position: fixed; top: .75rem; left: .75rem; transform: translateY(-180%); z-index: 10; padding: .6rem 1rem; color: var(--dark); background: var(--mint); border-radius: 6px; }
.skip-link:focus { transform: none; }
.icon { display: inline-block; width: 1.15rem; height: 1.15rem; flex: none; vertical-align: middle; }
.initial-state { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: 1rem; text-align: center; }
.initial-state p { color: var(--muted); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand-mark { width: 2.35rem; height: 2.35rem; display: grid; place-items: center; flex: none; background: var(--mint); color: var(--dark); border-radius: 10px; position: relative; }
.brand-mark::before { content: ""; display: block; width: 1.06rem; height: .62rem; border: 1.5px solid currentColor; border-radius: 2px; background: linear-gradient(currentColor, currentColor) .17rem center / .44rem .26rem no-repeat; }
.brand-mark::after { content: ""; position: absolute; width: 2px; height: .36rem; left: calc(50% + .61rem); top: calc(50% - .18rem); border-radius: 0 1px 1px 0; background: currentColor; }
.brand-name { font-size: 1rem; font-weight: 720; letter-spacing: -.025em; white-space: nowrap; }
.login { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-brand { background: radial-gradient(ellipse at 10% 100%, #225c49 0%, transparent 60%), var(--dark); color: #edf8f3; display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; padding: clamp(1.75rem, 5.7vw, 5.75rem); }
.login-brand > div:last-child { display: grid; gap: 1.25rem; }
.login-brand h1 { font-size: clamp(2.8rem, 6.25vw, 6.4rem); max-width: 9ch; }
.login-brand p { font-size: clamp(1rem, 1.8vw, 1.2rem); color: #b9d9cd; max-width: 30ch; line-height: 1.55; }
.login-main { min-height: 32rem; display: grid; align-content: center; padding: clamp(1.75rem, 6vw, 6rem); }
.login-box { max-width: 27rem; display: grid; gap: 1.2rem; justify-items: start; }
.login-box h2 { font-size: clamp(1.7rem, 3.6vw, 2.45rem); letter-spacing: -.05em; }
.login-box p { color: var(--muted); line-height: 1.6; }
.login-box .button { margin-top: .35rem; }
.ms-icon { display: grid; grid-template-columns: repeat(2, 7px); gap: 2px; padding: 1px; }
.ms-icon b { width: 7px; height: 7px; background: #f35325; }
.ms-icon b:nth-child(2) { background: #81bc06; }
.ms-icon b:nth-child(3) { background: #05a6f0; }
.ms-icon b:nth-child(4) { background: #ffba08; }
.app-shell { min-height: 100svh; display: grid; grid-template-columns: 225px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100svh; background: var(--dark); color: white; display: flex; flex-direction: column; gap: 2rem; padding: 1.55rem 1rem 1rem; }
.sidebar .brand { padding-inline: .3rem; }
.sidebar .brand:focus-visible, .side-nav a:focus-visible, .sidebar button:focus-visible { outline-color: var(--mint); }
.side-nav { display: grid; gap: .35rem; }
.side-nav a { display: flex; align-items: center; gap: .75rem; color: #bad1c8; text-decoration: none; padding: .75rem .8rem; font-size: .92rem; font-weight: 580; border-radius: 8px; }
.side-nav a:hover { background: #1c3c37; color: white; }
.side-nav a[aria-current="page"] { color: #e0f8ee; background: #285047; font-weight: 680; }
.side-account { display: flex; align-items: center; gap: .6rem; margin-top: auto; border-top: 1px solid #33534c; padding: .9rem .15rem .1rem; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; color: var(--mint); background: #285047; display: grid; place-items: center; font-size: .75rem; font-weight: 720; flex: none; }
.account-text { min-width: 0; flex: 1; display: grid; gap: .1rem; }
.account-text strong, .account-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text strong { font-size: .82rem; }
.account-text span { color: #b0cac0; font-size: .76rem; }
.sidebar .icon-button { color: #c5dbd3; width: 2.05rem; height: 2.05rem; }
.sidebar .icon-button:hover { background: #285047; color: white; }
.workspace { min-width: 0; }
.topbar { display: flex; min-height: 3.9rem; align-items: center; justify-content: space-between; gap: 1rem; padding-inline: clamp(1.15rem, 4vw, 3.5rem); background: white; border-bottom: 1px solid var(--border); }
.workspace-label { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: .9rem; }
.workspace-label .icon { color: #34705f; }
.topbar time { color: var(--muted); font-size: .875rem; }
.main { max-width: 1480px; margin: auto; padding: clamp(1.4rem, 3.4vw, 3.4rem) clamp(1.15rem, 4vw, 3.5rem) 3rem; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.page-head p { line-height: 1.5; margin-top: .55rem; color: var(--muted); }
.button, .icon-button { border: 1px solid transparent; text-decoration: none; flex: none; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: .52rem; font-weight: 650; border-radius: 8px; line-height: 1.2; }
.button { min-height: 2.55rem; padding: .64rem .88rem; font-size: .9rem; }
.icon-button { width: 2.45rem; height: 2.45rem; padding: 0; }
.button.primary { background: var(--green); border-color: var(--green); color: white; box-shadow: var(--shadow); }
.button.primary:hover { background: #124939; }
.button.secondary { background: var(--white); border-color: #cfddd6; }
.button.secondary:hover, .icon-button:hover { background: #edf4f0; }
.button.quiet:hover { background: #edf4f0; }
.button.small { padding: .45rem .65rem; min-height: 2rem; font-size: .845rem; }
.button.danger { color: #972e34; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-bottom: 1.55rem; }
.metric { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .75rem; text-align: left; background: white; border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); padding: 1.05rem; color: var(--ink); }
button.metric:hover { border-color: #8bb3a4; }
button.metric[aria-pressed="true"] { border-color: #448b76; box-shadow: 0 0 0 1px #448b76; }
.metric-icon { border-radius: 9px; background: #e9f0ef; color: #46645f; width: 2.05rem; height: 2.05rem; display: grid; place-items: center; }
.metric[data-status="ON_TRACK"] .metric-icon { background: #e2f4e9; color: #287351; }
.metric[data-status="DUE_SOON"] .metric-icon { background: #fff0cc; color: #865917; }
.metric[data-status="PAST_DUE"] .metric-icon { background: #fce8e7; color: #a7323d; }
.metric-label { font-size: .875rem; font-weight: 650; display: block; color: #43605a; }
.metric-number { display: block; font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.06em; margin: .18rem 0; font-weight: 720; }
.metric-detail { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.card { background: white; border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .9rem; padding: 1.13rem 1.2rem; }
.card-head h2 + p, .section-intro h2 + p { margin-top: .3rem; }
.records-card .card-head { padding-bottom: .95rem; }
.search { display: flex; align-items: center; gap: .55rem; border: 1px solid #d4e1db; border-radius: 8px; padding: 0 .65rem; color: #5a7169; min-width: 0; width: min(100%, 18rem); background: white; }
.search:focus-within { border-color: #2b7a66; outline: 2px solid #2b7a66; outline-offset: 1px; }
.search input { appearance: none; width: 100%; min-width: 0; height: 2.45rem; padding: 0; border: 0; background: transparent; color: var(--ink); outline: 0; font-size: .905rem; }
.search .icon { width: 1rem; height: 1rem; }
.filters { display: flex; gap: .38rem; padding: 0 1.2rem .85rem; flex-wrap: wrap; }
.filter { background: white; color: var(--muted); font-size: .875rem; font-weight: 590; border: 1px solid transparent; border-radius: 7px; padding: .45rem .6rem; }
.filter:hover { color: var(--ink); background: #f2f6f4; }
.filter[aria-pressed="true"] { color: #175344; background: #e9f5ef; border-color: #d6ece1; }
.table-scroll { overflow: auto; }
.table-scroll:focus:not(:focus-visible) { outline: none; }
.data-table { border-collapse: collapse; width: 100%; text-align: left; min-width: 720px; font-size: .9rem; }
.data-table th { background: #f5f8f6; color: #435851; font-size: .81rem; font-weight: 680; white-space: nowrap; }
.data-table th, .data-table td { padding: .73rem .9rem; border-top: 1px solid #e7eeea; vertical-align: middle; }
.data-table th:first-child, .data-table td:first-child { padding-left: 1.2rem; }
.data-table th:last-child, .data-table td:last-child { padding-right: 1.2rem; }
.data-table tbody tr:hover { background: #f8fbf9; }
.data-table .date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table .date-cell.stale { color: #9e3341; font-weight: 650; }
.table-name { border: 0; border-radius: 3px; text-decoration: underline; text-decoration-color: #bad4c8; text-underline-offset: .19rem; background: transparent; color: var(--ink); padding: .2rem 0; font-weight: 710; text-align: left; }
.table-name:hover { color: var(--green); text-decoration-color: var(--green); }
.table-actions { display: flex; gap: .25rem; justify-content: end; }
.table-actions .icon-button { width: 2rem; height: 2rem; }
.table-actions .icon { width: 1rem; height: 1rem; }
.battery-cards { display: none; }
.badge { display: inline-flex; align-items: center; flex: none; gap: .35rem; border-radius: 999px; padding: .265rem .55rem; white-space: nowrap; background: #edf2ef; color: #465e55; font-size: .8rem; font-weight: 680; line-height: 1.25; }
.badge::before { content: ""; width: .37rem; height: .37rem; background: currentColor; border-radius: 50%; }
.badge.on_track, .badge.sent, .badge.active { background: #e4f4e9; color: #245f42; }
.badge.due_soon, .badge.pending, .badge.sending { background: #fff2cd; color: #74520d; }
.badge.past_due, .badge.failed { background: #fce8e8; color: #92323e; }
.email-cue { display: inline-flex; align-items: center; gap: .34rem; color: #75520c; font-weight: 630; white-space: nowrap; }
.email-cue .icon { width: 1rem; height: 1rem; }
.table-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; padding: .8rem 1.2rem; border-top: 1px solid var(--border); }
.pagination { display: flex; gap: .45rem; }
.empty { display: grid; justify-items: center; gap: .55rem; min-height: 13rem; align-content: center; padding: 1.5rem; border-top: 1px solid var(--border); text-align: center; }
.empty .metric-icon { margin-bottom: .2rem; }
.callout { display: flex; align-items: start; gap: .6rem; padding: .75rem .9rem; border: 1px solid #d6e7e1; border-radius: 8px; background: #f0f8f4; color: #315c4c; font-size: .9rem; line-height: 1.45; }
.callout.warn { background: #fff5dd; border-color: #f2e1b1; color: #704d0c; }
.callout.error { background: #fff0ef; border-color: #f1cfce; color: #8e323b; }
.callout .icon { margin-top: .12rem; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.admin-layout > .full { grid-column: 1 / -1; }
.admin-side { display: grid; gap: 1.1rem; min-width: 0; }
.admin-layout .card-head { align-items: start; }
.admin-content { padding: 0 1.2rem 1.15rem; }
.admin-content .callout { margin-bottom: .95rem; }
.admin-actions { display: flex; gap: .65rem; align-items: center; justify-content: end; padding: 1rem 1.2rem; border-top: 1px solid var(--border); }
.field-list { list-style: none; margin: 0; padding: 0; }
.field-list li { display: flex; flex-wrap: wrap; gap: .55rem .85rem; justify-content: space-between; align-items: center; padding: .78rem 1.2rem; border-top: 1px solid #e7eeea; }
.field-list .field-name { font-weight: 650; overflow-wrap: anywhere; }
.field-list .button { margin-left: auto; }
.admin-layout .data-table { min-width: 620px; }
.admin-layout .empty { min-height: 7.5rem; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .95rem; }
.field { display: grid; gap: .35rem; align-content: start; min-width: 0; }
.field.wide, .form-fields > .wide { grid-column: 1 / -1; }
.field > label, .field > span:first-child { font-weight: 650; font-size: .875rem; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid #cddcd5; border-radius: 8px; padding: .58rem .62rem; color: var(--ink); background: white; font-size: 1rem; min-height: 2.55rem; }
.field select { appearance: none; padding-right: 2rem; background: linear-gradient(45deg, transparent 50%, #435c53 50%) right 1rem center / .3rem .3rem no-repeat, linear-gradient(135deg, #435c53 50%, transparent 50%) right .7rem center / .3rem .3rem no-repeat, white; }
.field textarea { min-height: 5rem; resize: vertical; }
.field input[type="file"] { font-size: .875rem; }
.field input::file-selector-button { border: 1px solid #cfddd6; border-radius: 5px; background: #f4f8f6; color: var(--ink); margin-right: .5rem; padding: .26rem .46rem; font-weight: 650; cursor: pointer; }
.check-line { display: flex; gap: .56rem; min-height: 2.55rem; align-items: center; color: var(--ink); font-size: .9rem; font-weight: 620; }
.check-line input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--green); flex: none; }
.form-section + .form-section { border-top: 1px solid var(--border); margin-top: 1.2rem; padding-top: 1.15rem; }
.section-intro { display: grid; gap: .25rem; margin-bottom: .8rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; padding: .85rem 1rem; background: #f4f8f6; border-radius: 8px; margin: 0 0 1.15rem; }
.detail-grid dt { color: var(--muted); font-size: .825rem; }
.detail-grid dd { margin: .3rem 0 0; font-size: .9rem; font-weight: 650; }
.form-error { margin-top: .85rem; }
#drawer { padding: 0; color: var(--ink); border: 0; width: min(100%, 32rem); max-width: 100%; height: 100dvh; max-height: 100dvh; position: fixed; inset: 0 0 0 auto; margin: 0; box-shadow: -1rem 0 3rem #112b2833; }
#drawer::backdrop { background: #0f232166; }
#drawer[open] { display: flex; flex-direction: column; }
.drawer-head { padding: 1.15rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 1.45rem; }
.drawer-head .sub { margin-top: .22rem; }
.drawer-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.3rem; }
.drawer-actions { display: flex; justify-content: end; gap: .55rem; padding: .95rem 1.3rem; border-top: 1px solid var(--border); }
.drawer-actions .charge-link { margin-right: auto; }
.toast { position: fixed; z-index: 5; bottom: 1.15rem; right: 1.15rem; width: max-content; max-width: calc(100% - 2.3rem); padding: .85rem 1rem; border-radius: 9px; background: var(--dark); color: white; box-shadow: 0 7px 25px #172d2a33; font-size: .9rem; }
.toast.error { background: #892e37; }
@media (max-width: 1050px) {
  .metric { padding: .85rem; gap: .55rem; }
  .metric-icon { width: 1.95rem; height: 1.95rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .app-shell { display: flex; flex-direction: column; }
  .sidebar { height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .55rem .85rem; padding: .8rem 1.1rem; }
  .sidebar .brand { padding-inline: 0; }
  .side-nav { display: flex; gap: .2rem; }
  .side-nav a { padding: .55rem .65rem; }
  .side-account { border: 0; margin: 0 0 0 auto; padding: 0; }
  .account-text { max-width: 9rem; }
  .topbar { min-height: 3rem; }
  .admin-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { gap: 2.2rem; }
  .login-brand h1 { max-width: 14ch; }
  .login-main { min-height: 20rem; }
  .sidebar .brand-name { font-size: .9rem; }
  .sidebar .brand-mark { width: 2rem; height: 2rem; }
  .sidebar .side-nav { order: 3; width: 100%; }
  .sidebar .side-nav a { flex: 1; justify-content: center; }
  .sidebar .account-text { display: none; }
  .page-head { align-items: start; flex-direction: column; margin-bottom: 1.2rem; }
  .metrics { gap: .62rem; margin-bottom: 1.1rem; }
  .metric { grid-template-columns: 1fr; padding: .65rem; }
  .metric-icon .icon { width: 1rem; height: 1rem; }
  .metric-icon { width: 1.75rem; height: 1.75rem; }
  .card-head { align-items: stretch; flex-wrap: wrap; }
  .card-head .search { width: 100%; }
  .records-card .table-scroll { display: none; }
  .battery-cards { display: grid; gap: .65rem; list-style: none; margin: 0; padding: .75rem; border-top: 1px solid var(--border); background: #f7faf8; }
  .battery-card { display: grid; gap: .65rem; padding: .85rem; border: 1px solid var(--border); background: white; border-radius: 10px; }
  .battery-card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
  .battery-card-head .table-name { overflow-wrap: anywhere; min-width: 0; }
  .battery-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0; }
  .battery-card dt { color: var(--muted); font-size: .8rem; }
  .battery-card dd { margin: .15rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
  .battery-card-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
  .battery-card-actions .button { min-height: 2.75rem; }
  .form-fields, .detail-grid { grid-template-columns: 1fr; }
  .drawer-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
