/* Admin panel. Same look as the dashboard (sidebar, panels, mint accent). */
:root {
  --bg: #080c0b;
  /* Frosted glass, neutral edges; green only for accents, statuses and button hover. */
  --panel: rgba(255, 255, 255, .04);
  --panel-2: rgba(255, 255, 255, .065);
  --solid: #121816; /* for things that must not be see-through: dialogs, menus */
  --glass-blur: blur(16px) saturate(140%);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --mint: #2de0b0;
  --ink: #eef3f1;
  --muted: #a1aba8;
  --dim: #6c7774;
  --danger: #ff7a7a;
  --warn: #ffc864;
  --info: #7cc7ff;
  font-family: 'Segoe UI', Inter, system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-width: 320px; min-height: 100vh;
  background:
    radial-gradient(ellipse 55% 45% at 12% 8%, rgba(90, 130, 150, .14), transparent 70%),
    radial-gradient(ellipse 60% 45% at 88% 0%, rgba(45, 224, 176, .07), transparent 70%),
    radial-gradient(ellipse 60% 50% at 60% 100%, rgba(120, 110, 170, .09), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.logo-mark { display: block; aspect-ratio: 256 / 51; background: var(--mint); -webkit-mask: url('/grobern-logo.webp') left center / contain no-repeat; mask: url('/grobern-logo.webp') left center / contain no-repeat; }

/* ---------- Buttons and inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .2s, border-color .2s, box-shadow .2s; }
.btn svg { width: 17px; height: 17px; }
/* Glass buttons: no green until the pointer is on them. */
.btn-primary, .btn-ghost { border-color: var(--line-2); color: var(--ink); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary { background: rgba(255, 255, 255, .09); }
.btn-ghost { background: rgba(255, 255, 255, .03); }
.btn-primary:hover, .btn-ghost:hover { border-color: rgba(45, 224, 176, .45); background: rgba(45, 224, 176, .13); color: #dcfbf1; box-shadow: 0 0 18px rgba(45, 224, 176, .16), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary:disabled { cursor: wait; opacity: .7; }
.btn-danger { background: #e25555; color: #fff; }
.btn-danger:hover { background: #f06a6a; }
.btn-sm { height: 32px; padding: 0 11px; border-radius: 8px; font-size: 13px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--mint); font-weight: 600; text-align: left; }
.link-btn:hover { text-decoration: underline; }

.input, .select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; outline: none; background: var(--panel); color: var(--ink); font-size: 14px; transition: border-color .2s, box-shadow .2s; }
.input:focus, .select:focus { border-color: rgba(255, 255, 255, .3); box-shadow: 0 0 0 3px rgba(255, 255, 255, .07); }
.input::placeholder { color: var(--dim); }
.select option { background: var(--solid); }
input[type="datetime-local"], input[type="date"] { color-scheme: dark; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; max-width: 1500px; min-height: 100vh; padding: 20px; margin: 0 auto; }
.sidebar { position: sticky; top: 20px; display: flex; flex-direction: column; height: calc(100vh - 40px); padding: 22px 14px 14px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.brand { display: grid; gap: 6px; padding: 4px 10px 20px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.brand .logo-mark { width: 124px; }
.brand small { color: var(--dim); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; }
.side-nav { display: grid; gap: 4px; }
.side-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--muted); font-size: 14px; transition: background .2s, color .2s; }
.side-item svg { width: 19px; height: 19px; flex: none; }
.side-item:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.side-item.is-active { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-weight: 600; }
.side-sep { height: 1px; margin: 12px 4px; background: var(--line); }
.side-foot { display: grid; gap: 12px; padding: 14px 8px 2px; margin-top: auto; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; background: rgba(255, 255, 255, .07); color: var(--ink); font-weight: 700; }
.me span:last-child { display: grid; min-width: 0; line-height: 1.3; }
.me strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--dim); font-size: 12px; }

.main { min-width: 0; padding: 6px 4px 40px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.4px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.updated { color: var(--dim); font-size: 12px; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 6px; font-size: 28px; font-weight: 650; }
.stat span { display: block; margin-top: 2px; color: var(--dim); font-size: 12px; }
.stat.is-accent strong { color: var(--mint); }

.panel { padding: 18px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 .panel { margin-bottom: 20px; }

.people { display: grid; gap: 4px; padding: 0; margin: 0; list-style: none; }
.people li { display: flex; align-items: center; gap: 12px; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .avatar { width: 32px; height: 32px; border-width: 1px; font-size: 13px; }
.people .who { display: grid; min-width: 0; line-height: 1.35; }
.people .who strong { font-size: 14px; }
.people .who small { color: var(--dim); font-size: 12px; }
.people .side { margin-left: auto; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; }
.people .none { color: var(--dim); font-size: 14px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar .input { max-width: 300px; }
.toolbar .select { width: auto; min-width: 160px; }
.filters { display: grid; grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(130px, 1fr)) auto; gap: 10px; align-items: end; margin: 14px 0; }
.filters label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { position: relative; padding: 10px 14px 12px; border: 0; background: none; color: var(--muted); font-size: 14px; white-space: nowrap; }
.tab::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; border-radius: 2px; background: var(--ink); content: ''; transform: scaleX(0); transition: transform .2s; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.panel .table-wrap { border: 0; border-radius: 0; background: none; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .4px; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.table .sub { display: block; color: var(--dim); font-size: 12px; }
.table .nowrap { white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.empty { padding: 36px 16px; color: var(--muted); text-align: center; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ''; }
.badge.ok { background: rgba(45, 224, 176, .14); color: var(--mint); }
.badge.live { background: rgba(45, 224, 176, .18); color: var(--mint); }
.badge.live::before { box-shadow: 0 0 0 0 rgba(45, 224, 176, .6); animation: pulse 2s infinite; }
.badge.warn { background: rgba(255, 200, 100, .13); color: var(--warn); }
.badge.bad { background: rgba(255, 122, 122, .13); color: var(--danger); }
.badge.info { background: rgba(124, 199, 255, .13); color: var(--info); }
.badge.muted { background: rgba(255, 255, 255, .06); color: var(--muted); }
.role { display: inline-block; padding: 1px 7px; margin-left: 6px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted); font-size: 11px; vertical-align: 1px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 224, 176, .55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(45, 224, 176, 0); } }

/* ---------- Dialogs ---------- */
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), rgba(18, 24, 22, .92); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .08); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
dialog::backdrop { background: rgba(2, 8, 7, .7); backdrop-filter: blur(3px); }
.dialog-form { display: grid; gap: 14px; padding: 24px; }
.dialog-form h2 { margin: 0; font-size: 20px; }
.dialog-form .intro { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.f { display: grid; gap: 6px; align-content: start; }
.f > span:first-child { color: #d6dcda; font-size: 13px; font-weight: 600; }
.f .help { color: var(--dim); font-size: 12px; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; }
.pw-wrap { position: relative; flex: 1; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 50%; right: 4px; display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); transform: translateY(-50%); }
.pw-toggle:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
.pw-toggle svg { width: 18px; height: 18px; }
.expiry-preview { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(255, 255, 255, .05); color: #dfe5e3; font-size: 14px; }
.expiry-preview strong { color: #fff; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--mint); }
.form-error { padding: 10px 12px; border: 1px solid rgba(255, 122, 122, .4); border-radius: 10px; background: rgba(255, 90, 90, .1); color: #ffc9c9; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(420px, calc(100% - 40px)); padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: rgba(24, 31, 29, .9); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); font-size: 14px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .25s, transform .25s; }
.toast.is-shown { opacity: 1; transform: none; }
.toast.is-error { border-color: rgba(255, 122, 122, .5); background: #3a1717; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { display: block; padding: 12px; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; height: auto; padding: 12px; margin-bottom: 16px; }
  .brand { padding: 4px 8px; margin: 0; border: 0; }
  .brand small { display: none; }
  .side-nav { display: flex; flex: 1 0 100%; order: 3; overflow-x: auto; }
  .side-item { padding: 8px 12px; white-space: nowrap; }
  .side-sep, .sidebar > .side-item { display: none; }
  .side-foot { display: flex; align-items: center; padding: 0; margin: 0 0 0 auto; border: 0; }
  .me span:last-child { display: none; }
  .grid-2 { grid-template-columns: 1fr; gap: 0; }
}
/* Phones and tablets: each table row becomes a card with labelled lines. */
@media (max-width: 1024px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { position: relative; display: block; min-height: 30px; padding: 6px 0 6px 112px; border: 0; }
  .table td::before { position: absolute; top: 8px; left: 0; width: 102px; color: var(--dim); content: attr(data-label); font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
  .table td[data-label=""] { padding-left: 0; }
  .table td[data-label=""]::before { display: none; }
  .row-actions { justify-content: flex-start; padding-top: 6px; }
}
@media (max-width: 560px) {
  .stat-row { gap: 10px; }
  .stat strong { font-size: 22px; }
  .filters, .form-grid { grid-template-columns: 1fr; }
  .toolbar .input, .toolbar .select { max-width: none; width: 100%; }
  .page-head .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
