@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Unbounded:wght@500;700&display=swap');

:root {
  --bg: #0e0c09;
  --panel: #17130f;
  --panel-2: #1e1913;
  --line: #35291d;
  --line-bright: #60472c;
  --cream: #f2e5ce;
  --muted: #9f917d;
  --amber: #e99b39;
  --amber-soft: #ffbd63;
  --green: #63cf89;
  --red: #d9655b;
  --radius: 5px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--cream);
  background:
    linear-gradient(rgba(233, 155, 57, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(233, 155, 57, .025) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
}

button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 265px;
  padding: 30px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(14, 12, 9, .96);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.brand span { font-size: 35px; filter: grayscale(.2); }
.brand strong { font-family: Unbounded, sans-serif; font-size: 14px; line-height: 1.4; letter-spacing: .06em; }
.sidebar nav { display: grid; gap: 3px; flex: 1; }
.sidebar nav a { color: var(--muted); padding: 9px 12px; border-left: 2px solid transparent; transition: .15s ease; }
.sidebar nav a:hover { color: var(--amber-soft); border-left-color: var(--amber); background: rgba(233,155,57,.06); }

.content { width: min(1160px, calc(100% - 265px)); margin-left: 265px; padding: 38px 52px 80px; }
.topbar { display: flex; align-items: end; justify-content: space-between; margin-bottom: 30px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Unbounded, sans-serif; }
h1 { font-size: clamp(24px, 4vw, 40px); margin-bottom: 0; letter-spacing: -.03em; }
h2 { font-size: 20px; margin: 0; }
h3 { font-size: 14px; }
.eyebrow { color: var(--amber); font-weight: 700; letter-spacing: .15em; font-size: 11px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.system-state { border: 1px solid #315139; color: var(--green); padding: 9px 12px; font-size: 11px; letter-spacing: .07em; }
.system-state span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--green); box-shadow: 0 0 12px var(--green); }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.metric { border: 1px solid var(--line); background: var(--panel); padding: 20px; min-height: 105px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { color: var(--amber-soft); font-family: Unbounded, sans-serif; font-size: 27px; }
.metric strong.small { font-size: 17px; }

.panel { scroll-margin-top: 20px; border: 1px solid var(--line); background: rgba(23, 19, 15, .97); margin-bottom: 18px; padding: 28px; box-shadow: 0 18px 60px rgba(0,0,0,.16); }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; gap: 13px; align-items: center; }
.panel-heading p { color: var(--muted); margin: 0; max-width: 400px; text-align: right; font-size: 12px; line-height: 1.5; }
.index { color: var(--amber); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack { display: grid; gap: 18px; }
.full { grid-column: 1 / -1; }
label { color: #c8bba7; display: grid; gap: 8px; font-size: 12px; }
input, textarea, select {
  width: 100%;
  color: var(--cream);
  background: #0f0d0a;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { line-height: 1.6; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(233,155,57,.09); }
input[type="file"] { border-style: dashed; color: var(--muted); }
.actions { display: flex; gap: 9px; justify-content: flex-end; align-items: center; }
button { cursor: pointer; border-radius: var(--radius); padding: 11px 17px; border: 1px solid transparent; font-weight: 700; transition: .15s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary { background: var(--amber); color: #171008; }
.primary:hover { background: var(--amber-soft); }
.secondary { background: transparent; border-color: var(--line-bright); color: var(--cream); }
.secondary:hover, .ghost:hover { border-color: var(--amber); color: var(--amber-soft); }
.ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.danger { color: #e68a82; border-color: #673731; background: transparent; }
.danger:hover { color: #fff; background: #77362f; }
.broadcast { background: var(--green); color: #0b1c11; padding-inline: 24px; }
.wide { width: 100%; }

.notice { border: 1px solid #355a3e; background: #14251a; color: #8bdd9f; padding: 13px 16px; margin-bottom: 18px; }
.notice.error { border-color: #713b35; background: #2b1714; color: #eb968d; }
.danger-zone { display: flex; justify-content: space-between; gap: 20px; align-items: center; border-top: 1px dashed #5b302b; margin-top: 26px; padding-top: 23px; }
.danger-zone p { color: var(--muted); max-width: 520px; margin: 5px 0 0; font-size: 11px; line-height: 1.5; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.stats-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-row { border: 1px solid var(--line); background: var(--panel-2); padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: end; }
.check { display: flex; align-items: center; gap: 7px; white-space: nowrap; padding-bottom: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--amber); }
.inline-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-bottom: 20px; }
.entry-list { display: grid; gap: 12px; }
.entry-card { padding: 18px; background: var(--panel-2); border: 1px solid var(--line); }
.add-entry { margin-top: 14px; border: 1px dashed var(--line-bright); }
.add-entry summary { cursor: pointer; padding: 16px; color: var(--amber-soft); }
.add-entry form { padding: 0 16px 16px; }
.current-media { display: flex; gap: 16px; align-items: center; border: 1px solid var(--line); padding: 12px; }
.current-media img { width: 120px; height: 90px; object-fit: cover; background: #080706; }
.current-media .check { padding: 0; }
.history { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 20px; }
.history-table { display: grid; gap: 5px; }
.history-table > div { display: grid; grid-template-columns: 1.3fr .7fr 1fr; gap: 12px; padding: 10px 12px; background: var(--panel-2); color: var(--muted); font-size: 11px; }
.history-table strong { color: var(--cream); }
footer { text-align: center; color: #665b4e; font-size: 10px; letter-spacing: .16em; padding-top: 25px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 25px; }
.login-card { width: min(430px, 100%); border: 1px solid var(--line-bright); background: rgba(23,19,15,.98); padding: 38px; box-shadow: 0 40px 100px rgba(0,0,0,.45); position: relative; }
.login-card:before, .login-card:after { content: ""; position: absolute; width: 20px; height: 20px; border-color: var(--amber); }
.login-card:before { left: -1px; top: -1px; border-left: 2px solid; border-top: 2px solid; }
.login-card:after { right: -1px; bottom: -1px; border-right: 2px solid; border-bottom: 2px solid; }
.seal { font-size: 46px; margin-bottom: 22px; }
.login-card h1 { font-size: 28px; margin-bottom: 12px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 14px; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: 8px; }
  .sidebar nav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .sidebar form { display: none; }
  .content { width: 100%; margin: 0; padding: 28px 20px 60px; }
}

@media (max-width: 650px) {
  .topbar { align-items: start; }
  .system-state { display: none; }
  .metric-grid, .form-grid, .stats-list { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .panel { padding: 20px 16px; }
  .panel-heading { display: block; }
  .panel-heading > div { margin-bottom: 10px; }
  .panel-heading p { text-align: left; }
  .danger-zone { display: block; }
  .button-row { justify-content: flex-start; margin-top: 14px; }
  .stat-row { grid-template-columns: 1fr; }
  .check { padding: 0; }
  .inline-form { grid-template-columns: 1fr; }
  .history-table > div { grid-template-columns: 1fr; }
}
