/* Garder Admin Center – plain CSS, light and dark (prefers-color-scheme). */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --text: #1c1f24;
  --muted: #5d6573;
  --line: #dde1e7;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --ok-bg: #e7f5ec;
  --warn: #9a6700;
  --warn-bg: #fff6dc;
  --bad: #c62828;
  --bad-bg: #fdecec;
  --info-bg: #e8f0fe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1d212a;
    --text: #e7e9ee;
    --muted: #9aa3b2;
    --line: #2a303b;
    --accent: #4c8dff;
    --accent-text: #0b0d10;
    --ok: #4ac26b;
    --ok-bg: #12261a;
    --warn: #e3b341;
    --warn-bg: #2a2310;
    --bad: #ff6b6b;
    --bad-bg: #2d1414;
    --info-bg: #142238;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h2.tight { margin: 0; }
p { margin: .4rem 0 .8rem; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
small, .muted { color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-weight: 700; padding: .25rem .5rem 1rem; display: block; color: var(--text); }
.brand small { display: block; font-weight: 400; }
.nav a, .nav button {
  display: block; width: 100%; text-align: left; padding: .42rem .6rem; border-radius: 7px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--info-bg); color: var(--accent); font-weight: 600; }
.nav .group { margin: 1rem .6rem .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav .sub a { padding-left: 1.4rem; font-size: .93rem; }
main { padding: 1.5rem 2rem 3rem; max-width: 1180px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.page-head p { margin: 0; color: var(--muted); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  main { padding: 1rem 16px 2rem; }
}

/* panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .5rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.spacer { flex: 1; }
.stack > * + * { margin-top: .75rem; }

/* status */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--accent); border-color: transparent; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

.alert { border-radius: 8px; padding: .65rem .9rem; margin: 0 0 .8rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.warning { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--text); }
.alert strong { color: inherit; }
.prepared { border: 1px dashed var(--warn); background: var(--warn-bg); color: var(--text); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }

/* forms */
form.stack { max-width: 560px; }
label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field { margin-bottom: .9rem; }
.field .help { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.field .errors { color: var(--bad); font-size: .88rem; margin: .25rem 0 0; padding: 0; list-style: none; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 7px;
  background: var(--panel); color: var(--text); font: inherit;
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: .88rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin: 0; }
.inline-form input[type=text], .inline-form input[type=search], .inline-form select { width: auto; min-width: 12rem; }
.code-input { max-width: 9rem; letter-spacing: .2em; font-family: ui-monospace, Consolas, monospace; }

.btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 400; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem 16px; }
.auth .card { width: 100%; max-width: 430px; }
.auth h1 { margin-bottom: .75rem; }

/* invite + qr */
.qr { background: #fff; border-radius: 8px; padding: .5rem; display: inline-block; line-height: 0; }
.qr svg { width: 220px; height: auto; max-width: 100%; }
.copybox { display: flex; gap: .5rem; align-items: stretch; }
.copybox input { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.secret-box { font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: .75rem; }
.codes { columns: 2; font-family: ui-monospace, Consolas, monospace; font-size: 1.05rem; padding-left: 1.2rem; }

.log { background: #0d1117; color: #d6dde6; border-radius: 8px; padding: .8rem 1rem; font: .85rem/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 28rem; overflow-y: auto; }
.pager { display: flex; gap: .75rem; margin-top: 1rem; align-items: center; }
details summary { cursor: pointer; color: var(--accent); }
