:root {
  --bg: #14100d;
  --surface: #1d1815;
  --surface-2: #251f1a;
  --line: #342b23;
  --text: #f2e9e2;
  --muted: #a3948a;
  --accent: #e67e22;
  --accent-dim: #b3611a;
  --green: #57f287;
  --red: #ed4245;
  --blue: #5865f2;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------- nav --- */

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
  padding: 15px 0;
  white-space: nowrap;
}
.brand span { color: var(--accent); }

.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }

.topbar nav a {
  color: var(--muted);
  padding: 15px 12px;
  border-bottom: 2px solid transparent;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ----------------------------------------------------------------- layout --- */

main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; }

h1 { font-size: 23px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.stat { text-align: left; }
.stat .value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; }

/* ------------------------------------------------------------------ table --- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }

.empty { color: var(--muted); padding: 14px 0; }

/* ------------------------------------------------------------------ forms --- */

label { display: block; margin-bottom: 12px; }
label .hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }

input[type=checkbox] { width: auto; margin-right: 7px; }
.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline > * { flex: 1; min-width: 130px; }
.inline > .narrow { flex: 0 0 110px; }

button, .btn {
  display: inline-block;
  padding: 9px 15px;
  background: var(--accent);
  color: #17110c;
  border: none;
  border-radius: 7px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: #f08b33; text-decoration: none; }
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
button.secondary:hover { background: #2f2822; }
button.danger { background: var(--red); color: #fff; }
button.danger:hover { background: #f25a5d; }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { background: #2f2822; }

/* Title on the left, actions on the right. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* ------------------------------------------------------------------ misc --- */

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.ok { color: var(--green); border-color: #2c5f3f; }
.pill.bad { color: var(--red); border-color: #6b2b2c; }
.pill.info { color: #9db2ff; border-color: #33407a; }
.pill.warn { color: var(--accent); border-color: var(--accent-dim); }

.flash { padding: 11px 15px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 500; }
.flash.ok { background: #17301f; color: var(--green); border: 1px solid #2c5f3f; }
.flash.error { background: #33191a; color: #ff9b9d; border: 1px solid #6b2b2c; }

.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.row-actions form { display: inline; }

.login-shell { max-width: 380px; margin: 90px auto; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.key { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; word-break: break-all; color: var(--muted); }
