/* Admin console — denser, cooler, built to be read at a glance from behind the counter. */

.admin-body { background: #f4f6f5; }

.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } }

.admin-side { background: var(--jade-900); color: rgba(255, 255, 255, .72); padding: 1.4rem 1rem; }
.admin-side .brand { color: #fff; margin-bottom: 1.8rem; padding-inline: .4rem; }
.admin-side nav { display: grid; gap: .15rem; }
.admin-side nav a {
  display: flex; align-items: center; gap: .6rem; padding: .58rem .75rem; border-radius: 9px;
  color: rgba(255, 255, 255, .72); text-decoration: none; font-size: .92rem; font-weight: 600;
}
.admin-side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-side nav a[aria-current="page"] { background: var(--jade-700); color: #fff; }
.admin-side nav a span { width: 18px; text-align: center; }
.admin-side .side-foot { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .84rem; }
.admin-side .side-foot form { margin-top: .6rem; }
.admin-side .side-foot button {
  background: none; border: 1px solid rgba(255, 255, 255, .2); color: rgba(255, 255, 255, .8);
  padding: .35rem .8rem; border-radius: 999px; font: inherit; font-size: .82rem; cursor: pointer;
}
.admin-side .side-foot button:hover { border-color: var(--gold-500); color: var(--gold-500); }
@media (max-width: 900px) {
  .admin-side nav { grid-auto-flow: column; overflow-x: auto; gap: .3rem; }
  .admin-side .side-foot { display: none; }
}

.admin-main { padding: 1.75rem clamp(1rem, 3vw, 2.25rem) 3rem; min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-head h1 { font-size: 1.6rem; margin: 0; }
.admin-head p { margin: .2rem 0 0; color: var(--ink-soft); font-size: .92rem; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 980px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stat-row { grid-template-columns: 1fr; } }

.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem;
}
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft); font-weight: 800; }
.stat .v { font-size: 1.75rem; font-weight: 800; line-height: 1.2; margin-top: .3rem; }
.stat .s { font-size: .82rem; color: var(--ink-soft); }
.stat.accent { background: var(--jade-900); border-color: var(--jade-900); color: #fff; }
.stat.accent .k { color: var(--gold-500); }
.stat.accent .s { color: rgba(255, 255, 255, .6); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.panel-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.02rem; }
.panel-head p { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.panel-body { padding: 1.25rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .72rem 1rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); font-weight: 800; background: #fbfaf7; }
table.data tbody tr:hover { background: var(--jade-050); }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .wrap-cell { white-space: normal; min-width: 200px; }

.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 1rem; }
.machine {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem;
  border-left: 4px solid var(--line);
}
.machine.is-live { border-left-color: #22a55b; }
.machine.is-idle { border-left-color: var(--jade-100); }
.machine.is-offline { border-left-color: #cfcdc6; opacity: .82; }
.machine.is-maintenance { border-left-color: var(--gold-500); }
.machine-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.machine-top b { font-size: 1.05rem; display: block; }
.machine-top span { font-size: .82rem; color: var(--ink-soft); }
.machine-meter { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: .9rem 0; }
.machine-meter div { background: #fbfaf7; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .6rem; }
.machine-meter .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 800; }
.machine-meter .v { font-weight: 800; font-size: .98rem; font-variant-numeric: tabular-nums; }
.machine-amount { font-size: 1.6rem; font-weight: 800; color: var(--jade-800); font-variant-numeric: tabular-nums; }
.machine-actions { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }

.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 150px; }

.invoice-line { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.invoice-line:last-of-type { border-bottom: 0; }
.invoice-total { display: flex; justify-content: space-between; gap: 1rem; padding-top: .9rem; margin-top: .5rem; border-top: 2px solid var(--ink); font-weight: 800; font-size: 1.2rem; }

.timeline { list-style: none; margin: 0; padding: 0; font-size: .86rem; max-height: 420px; overflow-y: auto; }
.timeline li { display: flex; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 52px; }
.timeline .ev { font-weight: 700; }

/* Charts — single series each, so no legend: the panel title names the measure.
   Mark colour is a validated jade step (lightness band, chroma floor, >=3:1 on the
   panel surface); the deep brand jade is reserved for chrome. */
.chart { --chart-jade: #1a8a63; }
.chart-plot {
  display: flex; align-items: flex-end; gap: 2px; height: 148px;
  border-bottom: 1px solid var(--line); padding-bottom: 0;
}
.chart-bar {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: flex-end;
  height: 100%; background: none; border: 0; padding: 0; cursor: default;
}
.chart-bar i {
  display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0;
  background: var(--chart-jade); transition: background .12s ease;
}
.chart-bar:hover i, .chart-bar:focus-visible i { background: var(--jade-800); }
.chart-bar:focus-visible { outline: 2px solid var(--jade-800); outline-offset: 2px; border-radius: 4px; }
.chart-bar[data-zero] i { background: var(--line); }

/* Per-mark tooltip. Kept CSS-only so the panel needs no chart library. */
.chart-bar span {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--jade-900); color: #fff; padding: .4rem .6rem; border-radius: 7px;
  font-size: .74rem; line-height: 1.4; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s ease; z-index: 5; box-shadow: var(--shadow);
}
.chart-bar span b { display: block; font-size: .82rem; }
.chart-bar:hover span, .chart-bar:focus-visible span { opacity: 1; }

.chart-peak {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-size: .72rem; font-weight: 800; color: var(--ink-soft); white-space: nowrap;
}
.chart-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-soft); margin-top: .45rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--jade-900); padding: 1.5rem; }
.login-card { background: var(--paper); border-radius: 18px; padding: 2.25rem; width: min(400px, 100%); box-shadow: var(--shadow-lg); }
.login-card .brand { justify-content: center; margin-bottom: 1.5rem; }
