/* ==========================================================================
   Damnatio bot panel — dark UI matching the bot's #B49C81 accent
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #101312;
  --bg-elevated: #181d1a;
  --bg-input: #111613;
  --border: #2a332d;
  --border-strong: #414d44;
  --text: #edf2ec;
  --text-dim: #a3afa5;
  --text-faint: #92a096;
  --accent: #c6e99b;
  --accent-dim: #93b675;
  --danger: #d05c5c;
  --success: #4fa872;
  --warning: #d3a24a;
  --discord: #5865f2;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

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

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

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

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #23262e 0%, var(--bg) 60%);
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-mark {
  width: 52px; height: 52px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dim));
  color: #1a1c21;
  font-size: 26px; font-weight: 700;
}

.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-sub { margin: 0 0 26px; color: var(--text-dim); font-size: 13.5px; }
.login-note { margin: 22px 0 0; color: var(--text-faint); font-size: 12.5px; line-height: 1.5; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: #29382c; border-color: #64775e; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #191b20; font-weight: 600; }
.btn-primary:hover { background: #d6f5b3; border-color: #d6f5b3; }
.btn-danger { border-color: #4a2c2c; color: #eba0a0; }
.btn-danger:hover { background: #3a2222; border-color: #6b3838; }
.btn-discord { width: 100%; background: var(--discord); border-color: var(--discord); color: #fff; font-weight: 600; padding: 12px; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* --- app shell ------------------------------------------------------------ */

.app { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  min-width: 0;
  background: #141915;
  border-right: 1px solid var(--border);
  padding: 30px 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 34px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dim));
  color: #1a1c21; display: grid; place-items: center; font-weight: 700;
}
.brand-name { font-weight: 650; font-size: 20px; letter-spacing: -.6px; }
.brand-sub { font-size: 8px; letter-spacing: 1px; color: var(--text-faint); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: 9px; margin-bottom: 5px;
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  background: none; border: 0; width: 100%; text-align: left;
  cursor: pointer; font-family: inherit;
}
.nav-item:hover { background: #242e25; color: var(--text); }
.nav-item.active { background: #283723; color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.nav-icon { width: 17px; text-align: center; opacity: .85; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.session { display: flex; align-items: center; gap: 9px; padding: 0 6px 12px; }
.session img { width: 30px; height: 30px; border-radius: 50%; }
.session-name { font-size: 13px; font-weight: 500; }
.session-role { font-size: 11px; color: var(--text-faint); }

.main { padding: 36px 38px 60px; max-width: 1560px; margin: auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(25px, 2.5vw, 34px); font-weight: 650; letter-spacing: -1px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

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

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card > h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card > .card-sub { margin: 0 0 16px; color: var(--text-dim); font-size: 12.5px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px;
}
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.stat-value { font-size: 32px; font-weight: 600; margin-top: 10px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 15px; font-weight: 500; }

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

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

input[type=text], input[type=search], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  padding: 8px 11px;
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-dim); }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
input[type=color] {
  width: 46px; height: 34px; padding: 2px; background: var(--bg-input);
  border: 1px solid var(--border-strong); border-radius: 7px; cursor: pointer;
}

.row { display: flex; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1; margin-bottom: 0; }

.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #d8dae0; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkline input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* --- tables / lists ------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); font-weight: 600; padding: 0 10px 9px; border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 6px; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
  background: #2a2f39; color: var(--text-dim);
}
.tag.on { background: rgba(79, 168, 114, .16); color: #7fd3a3; }
.tag.off { background: rgba(208, 92, 92, .14); color: #e59a9a; }
.tag.accent { background: #2b3925; color: var(--accent); }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* --- embed preview -------------------------------------------------------- */

.discord-preview { background: #313338; border-radius: 8px; padding: 16px; font-size: 14px; }
.preview-content { color: #dbdee1; margin-bottom: 8px; white-space: pre-wrap; word-break: break-word; }
.embed {
  border-left: 4px solid var(--accent);
  background: #2b2d31;
  border-radius: 4px;
  padding: 12px 16px 14px 12px;
  max-width: 520px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 16px;
}
.embed-body { min-width: 0; }
.embed-author { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #f2f3f5; margin-bottom: 8px; }
.embed-author img { width: 24px; height: 24px; border-radius: 50%; }
.embed-title { color: #00a8fc; font-size: 15px; font-weight: 600; margin-bottom: 8px; word-break: break-word; }
.embed-title.plain { color: #f2f3f5; }
.embed-desc { color: #dbdee1; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.embed-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.embed-field { grid-column: span 3; min-width: 0; }
.embed-field.inline { grid-column: span 1; }
.embed-field-name { color: #f2f3f5; font-size: 13px; font-weight: 600; margin-bottom: 2px; word-break: break-word; }
.embed-field-value { color: #dbdee1; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.embed-thumb { width: 72px; height: 72px; border-radius: 4px; object-fit: cover; }
.embed-image { grid-column: 1 / -1; margin-top: 12px; max-width: 100%; border-radius: 4px; }
.embed-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 10px; color: #949ba4; font-size: 12px; }
.embed-footer img { width: 20px; height: 20px; border-radius: 50%; }

/* --- toasts --------------------------------------------------------------- */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  min-width: 260px; max-width: 380px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 12px 15px; font-size: 13px;
  box-shadow: var(--shadow);
  animation: slide-in .2s ease-out;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
@keyframes slide-in { from { opacity: 0; transform: translateX(12px); } }

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

.divider { height: 1px; background: var(--border); margin: 18px 0; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.loading { padding: 40px; text-align: center; color: var(--text-faint); }
.field-editor { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: var(--bg-input); }
.field-editor .row { margin-bottom: 8px; }
.field-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* Dashboard and support archive */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 200; background: var(--accent); color: #101312; padding: 12px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.workspace { min-width: 0; }
.topbar { min-height: 72px; border-bottom: 1px solid var(--border); padding: 18px 38px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.breadcrumb { color: var(--text-faint); margin-left: 10px; }
.workspace-label, .nav-label, .eyebrow { color: var(--text-faint); font-size: 10px; letter-spacing: 1.6px; font-weight: 600; }
.nav-label { padding: 0 12px 14px; font-size: 9px; }
.eyebrow { color: var(--accent); margin-bottom: 8px; }
.welcome-banner { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px; margin-bottom: 24px; border: 1px solid #3d5132; border-radius: 16px; background: radial-gradient(ellipse at top right, #34452b 0, #1b261b 65%); }
.welcome-banner h2 { font-size: 23px; letter-spacing: -.5px; margin: 14px 0 6px; }
.welcome-banner p { margin: 0; color: #b0bda9; }
.welcome-banner .btn { flex-shrink: 0; }
.stat-note { font-size: 12px; color: var(--text-faint); margin-top: 9px; }
.archive-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 26px 0; }
.archive-stats .stat { padding: 24px; }
.archive-stats .stat:first-child { border-color: #576b43; }
.archive-stats .stat:first-child .stat-value { color: var(--accent); }
.archive-card { padding: 0; overflow: hidden; }
.archive-heading { padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.archive-heading h2 { font-size: 17px; margin: 0; }
.archive-heading p { margin: 4px 0 0; font-size: 12px; }
.archive-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 22px 24px; }
.archive-toolbar label { display: grid; gap: 7px; font-size: 11px; color: var(--text-dim); min-width: 130px; }
.archive-toolbar .search-field { flex: 1; min-width: 200px; }
.archive-toolbar input, .archive-toolbar select { width: 100%; min-height: 42px; }
.table-scroll { overflow-x: auto; }
.archive-table { min-width: 780px; margin: 0; }
.archive-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); background: #141915; padding: 14px 20px; }
.archive-table td { padding: 18px 20px; vertical-align: middle; }
.archive-table tbody tr:hover { background: #1d251e; }
.ticket-name { display: flex; align-items: center; gap: 12px; }
.ticket-name strong { display: block; font-size: 13px; font-weight: 600; }
.ticket-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #3c4936; border-radius: 10px; color: var(--accent); background: #242f21; font-size: 20px; flex-shrink: 0; }
.ticket-id { display: block; color: var(--text-faint); font-size: 10px; margin-top: 3px; overflow-wrap: anywhere; }
.ticket-description { max-width: 280px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: 11px; color: var(--text-dim); margin: 8px 0 0 48px; }
.date-cell { white-space: nowrap; color: var(--text-dim); font-size: 12px; }
.download-link { background: transparent; color: var(--text-dim); }
.pagination { border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 15px; align-items: center; justify-content: space-between; padding: 18px 24px; color: var(--text-faint); font-size: 12px; }
.pagination .inline-actions { align-items: center; gap: 14px; }
.archive-empty { text-align: center; padding: 65px 20px; color: var(--text-dim); }
.archive-empty > span { font-size: 36px; color: var(--accent); }
.archive-empty h3 { color: var(--text); margin-bottom: 5px; }
.archive-empty p { margin: 0; }
.error-card { margin-top: 24px; border-color: var(--danger); }
.login-body { background: radial-gradient(ellipse at 50% 0, #31432a, #101312 65%); }
.login-card { padding: 48px 36px; border-color: #3f5037; }
.login-card h1 { font-size: 26px; letter-spacing: -.7px; }
@media (max-width: 1100px) {
  .main { padding: 28px 22px 50px; }
  .welcome-banner { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 0; }
  .nav-label { display: none; }
  #nav { display: flex; overflow-x: auto; width: 100%; order: 3; margin-top: 16px; }
  .nav-item { width: auto; white-space: nowrap; flex-shrink: 0; }
  .sidebar-footer { margin-top: 0; border-top: 0; padding-top: 0; }
  .sidebar-footer { margin-left: auto; }
  .session { padding-bottom: 0; }
  .session-role, .session img { display: none; }
  .main { padding: 20px 16px 50px; }
  .topbar { padding: 14px 20px; min-height: 52px; }
  .workspace-label { display: none; }
  .page-head { flex-wrap: wrap; }
  .archive-stats { gap: 8px; }
  .archive-stats .stat { padding: 14px; }
  .stat-note { display: none; }
  .archive-stats .stat-label { font-size: 9px; overflow-wrap: anywhere; }
  .archive-toolbar { padding: 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
