/* 360Ledger admin UI
 * Editorial / print-magazine direction.
 * Fonts: Fraunces (display, serif w/ optical-size axis) + IBM Plex Sans (body) + IBM Plex Mono (code).
 */

:root {
  --paper:        #F7F5EE;   /* warm off-white page bg */
  --paper-2:      #EFEDE4;   /* subtle alt */
  --card:         #FFFFFF;
  --ink:          #0E0E12;   /* deep near-black text */
  --ink-2:        #4A4A52;   /* secondary text */
  --ink-3:        #8A8A92;   /* tertiary / labels */
  --rule:         #E4E1D6;   /* warm hairline */
  --rule-strong:  #C8C5B8;
  --accent:       #2436E8;   /* electric cobalt */
  --accent-2:     #1825BE;
  --accent-soft:  #E9EBFF;
  --warn:         #B11C2A;
  --warn-soft:    #FCEEEF;
  --glow:         #F5C518;   /* warm yellow, used sparingly */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Atmospheric dotted texture across the whole page */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(14,14,18,0.045) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative; z-index: 1;
  min-height: 100%;
  display: flex; flex-direction: column;
}

a { color: var(--accent); }

/* ---------------------------------- Header ----------------------------- */

header.site {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 22px 40px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 96;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
}
.brand .deg {
  color: var(--accent);
  font-weight: 900;
  font-size: 22px;
  margin: 0 1px 0 1px;
  transform: translateY(-2px);
  display: inline-block;
}
.brand .ledger {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-style: italic;
  font-variation-settings: "opsz" 24;
  font-size: 17px;
  color: var(--ink-2);
  margin-left: 6px;
  letter-spacing: 0;
}

nav.primary {
  display: flex;
  align-items: center;
  gap: 30px;
}
nav.primary a, nav.primary .linkish {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  border-left: none; border-right: none; border-top: none;
  cursor: pointer;
  transition: color .14s, border-color .14s;
}
nav.primary a:hover { color: var(--ink); }
nav.primary a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
nav.primary form { display: inline; }
nav.primary .linkish:hover { color: var(--warn); }

/* ---------------------------------- Main ------------------------------- */

main.app {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 40px 96px;
}

/* Page header — h1 with editorial weight */
.pageHead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--rule);
}
.pageHead h1 {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.pageHead h1 .deg {
  color: var(--accent);
  font-weight: 900;
  font-style: normal;
}
.pageHead .meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}
.pageHead .meta strong { color: var(--ink); font-weight: 500; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.card .h-section {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 36;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
  display: flex; align-items: baseline; gap: 14px;
}
.card .h-section .note {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------------------------------- Forms ------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }

.field label, label.field-label {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field select,
.field textarea {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  padding: 8px 0 10px;
  width: 100%;
  border-radius: 0;
  transition: border-color .14s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
  border-bottom-width: 2px;
  padding-bottom: 9px;
}
.field input::placeholder { color: var(--ink-3); }
.field input[type="file"] {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  border-bottom-color: var(--rule);
  padding: 12px 0;
  cursor: pointer;
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
                    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 6px center, right 0 center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 24px;
}

/* Compact two-up grid for shorter forms (used on Effects) */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
}
.grid-2 .full { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Inline form (single line) — used by Events */
.form-inline {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}
.form-inline .field { flex: 1; margin-bottom: 0; }
@media (max-width: 600px) {
  .form-inline { flex-direction: column; align-items: stretch; }
}

/* ---------------------------------- Buttons ----------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: #FFF;
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background .14s, color .14s, border-color .14s, transform .14s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--ink); color: #FFF; border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn.danger:hover { background: var(--warn); color: #FFF; border-color: var(--warn); }
.btn.small { padding: 7px 12px; font-size: 10px; letter-spacing: 0.12em; }
.btn.wide { width: 100%; }

/* Alert */
.alert {
  background: var(--warn-soft);
  border: 1px solid #F4C8CD;
  border-left: 4px solid var(--warn);
  padding: 14px 18px;
  font-size: 14px;
  color: #6F0C18;
  margin-bottom: 24px;
}

/* ---------------------------------- Tables ----------------------------- */

table.list {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.list th {
  text-align: left;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--rule-strong);
}
table.list td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  color: var(--ink);
}
table.list tr:last-child td { border-bottom: none; }
table.list tr:hover td { background: rgba(36, 54, 232, 0.025); }
table.list .right { text-align: right; }
table.list .meta-cell {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

/* Access code chip — special render for the 6-char codes */
.code {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.22em;
  color: var(--ink);
  padding: 6px 12px 6px 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
}

/* Effect thumbnail */
.thumb {
  width: 48px; height: 48px;
  object-fit: cover;
  border: 1px solid var(--rule);
  background:
    linear-gradient(135deg, transparent 49%, var(--rule) 49%, var(--rule) 51%, transparent 51%),
    var(--paper-2);
  display: inline-block;
  vertical-align: middle;
}

/* Type pill */
.pill {
  display: inline-block;
  padding: 4px 11px 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  background: var(--paper-2);
  color: var(--ink-2);
}
.pill.speed   { background: #FFF3D1; color: #6A4A00; }
.pill.music   { background: #DDF7E6; color: #115F31; }
.pill.overlay { background: var(--accent-soft); color: var(--accent-2); }
.pill.lut     { background: #F1E6FF; color: #4B1F8A; }

/* Empty state */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-3);
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 36;
  font-style: italic;
  font-size: 17px;
}

.muted { color: var(--ink-3); }
.muted-mono {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ---------------------------------- Dashboard -------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule);
  background: var(--card);
}
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: 1fr; }
}
.stat {
  padding: 48px 40px 36px;
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  gap: 18px;
  min-height: 240px;
  position: relative;
}
.stat:last-child { border-right: none; }
@media (max-width: 720px) {
  .stat { border-right: none; border-bottom: 1px solid var(--rule); }
  .stat:last-child { border-bottom: none; }
}
.stat .lbl {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat .val {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 144;
  font-weight: 500;
  font-size: 116px;
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--ink);
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.stat .val .deg {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--accent);
  margin-left: 4px;
  vertical-align: 78px;
  letter-spacing: 0;
}
.stat .lnk {
  margin-top: auto;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--accent);
}
.stat .lnk:hover { color: var(--accent); }
.stat .lnk .arr { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }

/* ---------------------------------- Footer ----------------------------- */

footer.site {
  padding: 24px 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-transform: uppercase;
}

/* ============================== LOGIN PAGE ============================ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 5fr 7fr;
  background: var(--paper);
}
@media (max-width: 880px) {
  .login-wrap { grid-template-columns: 1fr; }
}

.login-brand {
  background: var(--ink);
  color: #FFF;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  min-height: 360px;
}

/* Giant "360°" watermark behind everything */
.login-brand::before {
  content: "360°";
  position: absolute;
  bottom: -80px;
  right: -50px;
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 144;
  font-weight: 900;
  font-size: clamp(280px, 36vw, 520px);
  line-height: 1;
  color: rgba(255,255,255,0.05);
  letter-spacing: -0.08em;
  pointer-events: none;
  user-select: none;
}

/* Slowly rotating ring with two accent dots */
.login-brand .ring {
  position: absolute;
  width: 540px; height: 540px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 50%;
  right: -180px; bottom: -180px;
  animation: spin 60s linear infinite;
  pointer-events: none;
}
.login-brand .ring::before,
.login-brand .ring::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  left: 50%; margin-left: -4px;
}
.login-brand .ring::before { top: -4px; background: var(--accent); box-shadow: 0 0 16px rgba(36,54,232,.5); }
.login-brand .ring::after  { bottom: -4px; background: var(--glow); box-shadow: 0 0 16px rgba(245,197,24,.5); }

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .login-brand .ring { animation: none; }
}

.brand-mark {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 144;
  font-weight: 700;
  font-size: 60px;
  letter-spacing: -0.035em;
  line-height: 1;
  position: relative; z-index: 2;
  color: #FFF;
  text-decoration: none;
}
.brand-mark .deg { color: var(--accent); font-weight: 900; }
.brand-mark .ledger { font-weight: 400; font-style: italic; font-size: 30px; color: rgba(255,255,255,.7); margin-left: 6px; }

.login-brand .tagline {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 36;
  font-weight: 400;
  font-style: italic;
  font-size: 22px;
  line-height: 1.4;
  margin-top: 20px;
  max-width: 360px;
  color: rgba(255,255,255,0.88);
  position: relative; z-index: 2;
}
.login-brand .stamp {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  position: relative; z-index: 2;
}
.login-brand .stamp .dot { color: var(--glow); }

.login-form {
  padding: 56px;
  display: flex;
  align-items: center;
  background: var(--paper);
  position: relative;
}
.login-form-inner { width: 100%; max-width: 380px; }
.login-form h1 {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 96;
  font-weight: 500;
  font-size: 56px;
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}
.login-form .sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 44px;
}
.login-form .btn {
  width: 100%;
  padding: 16px;
  margin-top: 12px;
}
