/* crona'bot panel — velvet, lace & calligraphy (same palette as Crona's overlays) */
:root {
  --bg: #140508;
  --bg2: #1a070b;
  --panel: #1f080d;
  --panel2: #290c12;
  --line: rgba(227, 199, 160, .16);
  --line2: rgba(227, 199, 160, .32);
  --accent: #8a1f2a;
  --accent2: #a8293a;
  --gold: #e3c7a0;
  --ivory: #f6ebdc;
  --text: #f3e6d3;
  --muted: #b79f8a;
  --blush: #b86a4a;
  --ok: #bcd8a6;
  --bad: #e86a5c;
  --radius: 14px;
  --script: 'Pinyon Script', cursive;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 14px/1.5 var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(138, 31, 42, .35), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(184, 106, 74, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
/* velvet grain */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .5; z-index: 0;
  background-image: repeating-radial-gradient(circle at 30% 20%, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--ivory); }

.boot { display: grid; place-items: center; height: 100vh; font-size: 40px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.94); } }

/* ---------- petals ---------- */
#petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petal {
  position: absolute; top: -30px; width: 12px; height: 16px; border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #b8323f, #6e1520); opacity: .55;
  animation: fall linear infinite;
}
@keyframes fall {
  to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) { .petal { display: none; } }

/* ---------- login ---------- */
.login {
  position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(440px, 100%); text-align: center; padding: 44px 36px 36px;
  background: linear-gradient(180deg, rgba(41, 12, 18, .92), rgba(26, 7, 11, .92));
  border: 1px solid var(--line2); border-radius: 22px; position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 0 0 6px rgba(20,5,8,.6), inset 0 0 0 7px var(--line);
}
.login-card h1 { font: 400 64px/1 var(--script); color: var(--gold); margin: 0 0 4px; text-shadow: 0 2px 18px rgba(227,199,160,.25); }
.login-card .sub { font: italic 500 18px var(--serif); color: var(--muted); margin-bottom: 28px; }
.ornament { color: var(--gold); opacity: .7; letter-spacing: 8px; margin: 18px 0; font-family: var(--serif); }
.twitch-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent2), var(--accent)); color: var(--ivory); text-decoration: none;
  font-weight: 600; border: 1px solid rgba(227,199,160,.35); box-shadow: 0 8px 24px rgba(138,31,42,.45);
  transition: transform .15s, box-shadow .15s;
}
.twitch-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(138,31,42,.6); }
.login .error { margin-top: 18px; color: var(--bad); font-size: 13px; }
.login .hint { margin-top: 18px; color: var(--muted); font-size: 12px; }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px;
  background: linear-gradient(180deg, rgba(31,8,13,.95), rgba(20,5,8,.95));
  border-right: 1px solid var(--line);
}
.brand { text-align: center; padding: 4px 0 14px; }
.brand .logo { font: 400 40px/1 var(--script); color: var(--gold); }
.brand .tag { font: italic 500 14px var(--serif); color: var(--muted); }
.nav-group { margin: 16px 8px 6px; font: 600 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); opacity: .8; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500; border: 1px solid transparent;
}
.nav a:hover { background: rgba(138,31,42,.18); }
.nav a.active { background: linear-gradient(90deg, rgba(138,31,42,.45), rgba(138,31,42,.12)); border-color: var(--line2); color: var(--ivory); }
.nav .ico { width: 20px; text-align: center; }
.me { display: flex; align-items: center; gap: 10px; margin: 18px 6px 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.me img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line2); }
.me .who { flex: 1; min-width: 0; }
.me .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who small { color: var(--muted); }

.main { padding: 30px clamp(16px, 4vw, 44px) 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font: 600 34px/1.1 var(--serif); margin: 0; color: var(--ivory); }
.page-head h2 .script { font: 400 40px var(--script); color: var(--gold); margin-right: 6px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.btn.burger { display: none; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(41,12,18,.85), rgba(31,8,13,.85));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.card.lace { box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 0 0 4px rgba(20,5,8,.5), inset 0 0 0 5px var(--line); }
.card h3 { font: 600 20px var(--serif); margin: 0 0 12px; color: var(--ivory); display: flex; align-items: center; gap: 8px; }
.card h3 .right { margin-left: auto; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.stat .v { font: 600 30px var(--serif); color: var(--ivory); margin-top: 2px; }
.stat .v small { font: 500 13px var(--sans); color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line2); }
.pill.live { background: rgba(232,106,92,.15); color: #ffb1a8; border-color: rgba(232,106,92,.5); }
.pill.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); animation: pulse 1.2s infinite; }
.pill.ok { color: var(--ok); border-color: rgba(188,216,166,.45); background: rgba(188,216,166,.08); }
.pill.bad { color: var(--bad); border-color: rgba(232,106,92,.45); background: rgba(232,106,92,.08); }
.pill.mute { color: var(--muted); }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
label.f > small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; opacity: .85; }
input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 10px; background: rgba(12,3,5,.65);
  border: 1px solid var(--line); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227,199,160,.12); }
select option { background: var(--panel); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  background: rgba(227,199,160,.06); border: 1px solid var(--line2); color: var(--ivory); font-weight: 600; text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: rgba(227,199,160,.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--accent2), var(--accent)); border-color: rgba(227,199,160,.35); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #ffb1a8; border-color: rgba(232,106,92,.4); }
.btn.danger:hover { background: rgba(232,106,92,.12); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: rgba(12,3,5,.8); border: 1px solid var(--line2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--ivory); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(227,199,160,.25); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font: 500 11px ui-monospace, monospace; padding: 2px 8px; border-radius: 6px; background: rgba(227,199,160,.08); border: 1px solid var(--line); color: var(--gold); cursor: pointer; }
.chip:hover { background: rgba(227,199,160,.16); }

.preview { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.35); border-left: 3px solid var(--accent2); font-size: 13px; }
.preview b { color: #c9a0ff; }

/* ---------- lists / tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line2); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: rgba(138,31,42,.08); }
.table .actions { white-space: nowrap; text-align: right; }
.mono { font-family: ui-monospace, monospace; color: var(--gold); }
.muted { color: var(--muted); }
.trunc { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 30px; color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 17px; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.feed li { display: flex; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.feed .ic { width: 22px; text-align: center; flex: none; }
.feed .t { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }

.avatar { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; margin-right: 8px; border: 1px solid var(--line2); }
.bar { height: 6px; background: rgba(0,0,0,.4); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--blush), var(--gold)); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(8,2,3,.7); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- toast ---------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 60;
  padding: 10px 18px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { border-color: rgba(232,106,92,.6); color: #ffc2bb; }

.save-bar { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; z-index: 5; }
.save-bar .btn { box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.save-bar .btn:not(.primary) { background: var(--panel); }
.divider { text-align: center; color: var(--gold); opacity: .55; letter-spacing: 10px; margin: 26px 0 18px; font-family: var(--serif); }
.note { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line2); color: var(--muted); background: rgba(0,0,0,.2); }
.note b { color: var(--ivory); }
.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin: 4px 0; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,.6); }
  .btn.burger { display: inline-flex; }
  .g2 { grid-template-columns: 1fr; }
  .main { padding-top: 18px; }
}
