/* =============================================================================
   Power Robotics - admin console
   Deliberately plainer than the public site: dense, legible, no motion.
   Reuses the palette from site.css so the two never look unrelated.
   ========================================================================== */

:root {
  --bg: #070910;
  --surface: #0d101c;
  --surface-2: #121728;
  --line: rgba(140, 170, 255, 0.16);
  --line-soft: rgba(140, 170, 255, 0.09);
  --ink: #e9edfb;
  --ink-2: #aab4d4;
  --ink-3: #74809f;
  --cyan: #4fe3ff;
  --violet: #8b7dff;
  --lime: #9dff6a;
  --red: #ff7a7a;
  --amber: #ffc46b;
  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 0.45em; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { color: var(--ink-2); }

/* ------------------------------------------------------------------ login */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(720px 480px at 50% 0%, rgba(139, 125, 255, 0.16), transparent 65%),
    var(--bg);
}

.login-card {
  width: min(100%, 400px);
  padding: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.login-card__logo { width: 62px; margin: 0 auto 1.2rem; }
.login-card h1 { font-size: 1.35rem; text-align: center; }
.login-card__sub {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1.8rem;
}

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

.admin { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.5rem 1.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}
.sidebar__brand img { width: 34px; }
.sidebar__brand strong { display: block; font-size: 0.95rem; }
.sidebar__brand span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 0.92rem;
}

.sidebar nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.sidebar nav a.is-active { background: rgba(79, 227, 255, 0.1); color: var(--cyan); }

.sidebar__foot { margin-top: auto; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); }
.sidebar__user { font-size: 0.82rem; color: var(--ink-3); margin-bottom: 0.7rem; padding: 0 0.5rem; }

.content { padding: 2rem clamp(1.2rem, 3vw, 2.4rem) 4rem; max-width: 1100px; }

.content__head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line-soft);
}

/* ----------------------------------------------------------------- pieces */

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.panel__head {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.9rem; margin-bottom: 1.6rem; }

.stat-tile {
  padding: 1.15rem;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--surface);
}
.stat-tile b { font-family: var(--mono); font-size: 1.7rem; font-weight: 600; display: block; color: var(--cyan); }
.stat-tile span { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.stat-tile.is-alert b { color: var(--amber); }

.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.badge--live { color: var(--lime); border-color: rgba(157, 255, 106, 0.35); background: rgba(157, 255, 106, 0.08); }
.badge--new { color: var(--amber); border-color: rgba(255, 196, 107, 0.35); background: rgba(255, 196, 107, 0.08); }

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

.rows { display: flex; flex-direction: column; gap: 0.7rem; }

.row {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}

.row:hover { border-color: var(--line); }
.row--unread { border-left: 3px solid var(--amber); }

.row__thumb {
  width: 78px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.row__thumb img { width: 100%; height: 100%; object-fit: cover; }

.row__title { font-weight: 500; margin-bottom: 0.15rem; }
.row__meta { font-size: 0.8rem; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.row__actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.row__body { font-size: 0.9rem; color: var(--ink-2); margin: 0.55rem 0 0; white-space: pre-wrap; }

.empty {
  padding: 2.6rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--ink-3);
  font-size: 0.92rem;
}

.records-table-wrap { overflow-x: auto; }
.records-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.records-table th,
.records-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.records-table th {
  color: var(--ink-3);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.records-table td:first-child { width: 1%; }
.records-table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--cyan);
}
.records-table code {
  display: block;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.75rem;
}
.records-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.records-notice { padding: 0.8rem 1rem; margin-bottom: 1rem; color: var(--lime); }
.records-notice--error { color: var(--red); }

/* ---------------------------------------------------------- visitor chart */

.chart-select-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--ink-3);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.chart-select { min-width: 172px; }

.visitor-chart-wrap {
  overflow-x: auto;
  padding-top: 0.4rem;
}

.visitor-chart {
  display: block;
  min-width: 620px;
  width: 100%;
  font-family: var(--mono);
}

.visitor-chart__background { fill: #172946; stroke: #36527a; stroke-width: 1; }
.visitor-chart__grid { stroke: #6687b5; stroke-width: 1; opacity: 0.75; }
.visitor-chart__bar { fill: #ffd35c; stroke: #fff0ad; stroke-width: 1; }
.visitor-chart__bar:hover { fill: #9dff6a; stroke: #ddffc7; }
.visitor-chart__axis, .visitor-chart__caption { fill: #d8e6ff; font-size: 11px; }
.visitor-chart__caption { font-size: 12px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.btn:hover { background: #182036; text-decoration: none; }

.btn--primary {
  background: linear-gradient(115deg, var(--cyan), var(--violet));
  border-color: transparent;
  color: #05070f;
  font-weight: 600;
}
.btn--primary:hover { filter: brightness(1.08); }

.btn--danger { color: var(--red); border-color: rgba(255, 122, 122, 0.3); background: rgba(255, 122, 122, 0.07); }
.btn--danger:hover { background: rgba(255, 122, 122, 0.15); }

.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 7px; }
.btn--icon { padding: 0.35rem 0.55rem; font-family: var(--mono); }

.inline-form { display: inline; }

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

.field { margin-bottom: 1.15rem; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field--row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.field > label {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.4rem;
}

.hint { font-size: 0.79rem; color: var(--ink-3); margin: 0.35rem 0 0; }

.input, .textarea, .select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
}

.textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
.textarea--tall { min-height: 230px; }

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(79, 227, 255, 0.13);
}

.select { appearance: none; cursor: pointer; }
.select option { background: #0d101c; }

input[type='file'] {
  width: 100%;
  padding: 0.6rem;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink-3);
  font-size: 0.85rem;
}
input[type='file']::file-selector-button {
  margin-right: 0.8rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line-soft);
}

.alert {
  padding: 0.85rem 1.05rem;
  border-radius: 10px;
  margin-bottom: 1.3rem;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 122, 122, 0.35);
  background: rgba(255, 122, 122, 0.08);
  color: #ffc6c6;
}

/* ------------------------------------------------------- media management */

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }

.media-item {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  overflow: hidden;
  background: var(--surface-2);
}
.media-item img, .media-item video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.media-item__embed {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 0.6rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-3);
  word-break: break-all;
}
.media-item__keep {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: var(--ink-2);
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
}
.media-item__keep input { accent-color: var(--cyan); }

.preview {
  width: 128px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.preview img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }

/* --------------------------------------------------------- member editor */

.member-rows { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 0.9rem; }

.member-row {
  display: grid;
  grid-template-columns: 62px 1fr 1fr 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-2);
}

.member-row__avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(79, 227, 255, 0.1);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-family: var(--mono);
}
.member-row__avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-row input[type='file'] { padding: 0.35rem; font-size: 0.75rem; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 880px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar__foot { margin-top: 1rem; }
  .field--row, .field--row-3 { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .row__thumb { width: 100%; height: 120px; }
  .row__actions { justify-content: flex-start; }
  .member-row { grid-template-columns: 62px 1fr; }
}
