/* ===================== NOVA Logs — theme ===================== */
:root {
  --accent: #5b8cff;
  --accent-2: #6f6bff;
  --good: #2ecc71;
  --bad: #ff5b6b;
  --warn: #ffb648;
  --bg: #0b0d14;
  --bg-2: #0e1019;
  --panel: rgba(16, 18, 26, 0.92);
  --panel-soft: rgba(20, 23, 32, 0.72);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #f1f3f8;
  --muted: #8b90a0;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(91,140,255,.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111,107,255,.10), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; }
.muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ===================== LOGIN ===================== */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(420px, 100%); text-align: center;
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 22px; padding: 42px 34px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.brand-mark {
  width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 18px;
  display: grid; place-items: center; font-weight: 900; font-size: 30px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px -6px var(--accent);
}
.brand-mark.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; margin: 0; }
.login-card h1 { font-size: 28px; font-weight: 900; letter-spacing: -.5px; }
.login-card h1 span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 8px 0 26px; font-size: 14px; line-height: 1.5; }
.btn-discord {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 15px;
  color: #fff; background: #5865F2; transition: transform .12s, filter .12s;
}
.btn-discord:hover { filter: brightness(1.08); transform: translateY(-1px); }
.login-error { margin-top: 16px; color: var(--bad); font-size: 13px; }
.login-note { margin-top: 16px; color: var(--warn); font-size: 13px; line-height: 1.5; }

/* ===================== APP SHELL ===================== */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px; background: rgba(10,12,18,.82);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--stroke);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; white-space: nowrap; }
.brand-name b { color: var(--accent); font-weight: 800; }

.nav { display: flex; gap: 6px; margin-left: 8px; }
.nav-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background .12s, color .12s;
}
.nav-btn .ic { font-size: 15px; }
.nav-btn:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-btn.active { color: #fff; background: rgba(91,140,255,.16); border-color: rgba(91,140,255,.35); }

.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--stroke-2); }
#me-name { font-size: 13.5px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04); font-size: 15px; display: grid; place-items: center;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: rgba(255,91,107,.15); color: var(--bad); }

.main { flex: 1; padding: 20px 22px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }
.view { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===================== BUTTONS / INPUTS ===================== */
.btn-primary {
  padding: 11px 18px; border: none; border-radius: 11px; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -8px var(--accent); transition: transform .12s, filter .12s;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04); color: var(--text); font-weight: 600; font-size: 13.5px;
  transition: background .12s;
}
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.link-btn { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 600; }
input[type=text], input[type=number], input[type=datetime-local] {
  width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  background: rgba(255,255,255,.04); border: 1px solid var(--stroke); color: var(--text); outline: none;
  transition: border-color .15s;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: #5c6173; }

/* ===================== LOGS ===================== */
.logs-count { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.logs-list { display: flex; flex-direction: column; gap: 12px; }
.logs-foot { display: flex; justify-content: center; margin-top: 16px; }

/* --- search bar --- */
.search-bar {
  background: var(--panel-soft); border: 1px solid var(--stroke); border-radius: var(--radius);
  padding: 16px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px;
}
.sb-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sb-search { flex: 1; min-width: 220px; position: relative; display: flex; align-items: center; }
.sb-search .sb-ic { position: absolute; left: 13px; font-size: 14px; opacity: .7; pointer-events: none; }
.sb-search input { padding-left: 38px; height: 44px; }
.sb-field { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sb-field input { width: auto; }
.sb-live { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; margin-left: auto; }
.sb-live input { width: 15px; height: 15px; accent-color: var(--accent); }
.sb-foot { justify-content: space-between; }
.sb-arch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.sb-arch input { width: 15px; height: 15px; accent-color: var(--accent); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: background .2s; }
.live-dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.btn-coral {
  padding: 11px 18px; border: 1px solid rgba(255,91,107,.5); border-radius: 11px; font-weight: 700; font-size: 13.5px;
  color: #ffd2d7; background: rgba(255,91,107,.16); transition: background .12s, transform .12s; white-space: nowrap;
}
.btn-coral:hover { background: rgba(255,91,107,.28); transform: translateY(-1px); }

/* --- categories dropdown --- */
.dropdown { position: relative; }
.dd-btn {
  height: 44px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,.04); color: var(--text); font-weight: 600; font-size: 13.5px;
  display: flex; align-items: center; gap: 10px; min-width: 160px; justify-content: space-between;
}
.dd-btn:hover { background: rgba(255,255,255,.07); }
.dd-caret { color: var(--muted); }
.dd-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 25; min-width: 230px;
  background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: 12px; padding: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5); max-height: 320px; overflow-y: auto;
}
.dd-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.dd-opt:hover { background: rgba(255,255,255,.05); }
.dd-opt input { width: 15px; height: 15px; accent-color: var(--accent); }
.dd-opt .dot { width: 9px; height: 9px; border-radius: 50%; }
.dd-actions { display: flex; justify-content: space-between; padding: 6px 8px 2px; border-top: 1px solid var(--stroke); margin-top: 6px; }

/* --- log entry (header + détail box, façon terminal) --- */
.log-entry {
  position: relative; background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 14px 16px 14px 18px; overflow: hidden;
}
.log-entry::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--accent)); }
.log-entry.flash { animation: flash 1.2s ease; }
@keyframes flash { from { background: color-mix(in srgb, var(--c) 22%, var(--panel)); } to { background: var(--panel); } }
.le-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.le-cat { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--c, var(--accent)); }
.le-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.le-title { font-size: 14.5px; font-weight: 700; color: var(--text); margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.le-box {
  margin-top: 11px; background: rgba(0,0,0,.28); border: 1px solid var(--stroke);
  border-radius: 9px; padding: 11px 13px; display: flex; flex-direction: column; gap: 5px;
}
.le-line { font-size: 12.5px; color: #c2c7d4; line-height: 1.5; word-break: break-word; }
.le-line .lk { color: var(--muted); }
.le-line .lv { color: var(--text); }
.le-line .who { color: var(--c, var(--accent)); font-weight: 600; }
.le-chip { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; background: var(--c, var(--accent)); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 12px; }

/* ===================== WATCHDOG ===================== */
.wd-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.wd-head h2 { font-size: 22px; font-weight: 800; }
.wd-head input { max-width: 360px; }
.wd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wd-card {
  padding: 15px; border-radius: 13px; background: var(--panel); border: 1px solid var(--stroke);
  cursor: pointer; transition: border-color .12s, transform .12s;
}
.wd-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.wd-card .u { display: flex; align-items: center; gap: 10px; }
.wd-av { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 16px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.wd-card .uname { font-weight: 700; font-size: 15px; }
.wd-card .uulid { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
.wd-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: rgba(255,255,255,.05); border: 1px solid var(--stroke); color: #b9bdc9; font-weight: 600; }
.pill.role { color: var(--accent); border-color: rgba(91,140,255,.4); }

/* ===================== DRAWER ===================== */
.drawer-overlay { position: fixed; inset: 0; background: rgba(5,6,10,.6); z-index: 40; animation: fade .2s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 41;
  background: var(--bg-2); border-left: 1px solid var(--stroke); display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,.5); animation: slidein .25s cubic-bezier(.22,1,.36,1);
}
@keyframes slidein { from { transform: translateX(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--stroke); }
.drawer-head h3 { font-size: 17px; font-weight: 800; }
.drawer-body { overflow-y: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; }

.d-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); font-weight: 600; }
.kv .v { word-break: break-word; font-family: ui-monospace, monospace; font-size: 12.5px; }
.card-mini { background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 14px; }
.card-mini + .card-mini { margin-top: 10px; }
.card-mini .title { font-weight: 700; font-size: 14px; margin-bottom: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bank-bal { font-weight: 800; color: var(--good); }
.journal { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.jrow { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; font-size: 12px; padding: 6px 9px; border-radius: 8px; background: rgba(255,255,255,.03); }
.jrow .amt.pos { color: var(--good); } .jrow .amt.neg { color: var(--bad); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 7px; margin-top: 8px; }
.inv-item { font-size: 12px; padding: 7px 9px; border-radius: 8px; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); }
.inv-item b { color: var(--accent); }
.badge-row { display: flex; gap: 7px; flex-wrap: wrap; }

/* ===================== CONFIG ===================== */
.cfg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.cfg-head h2 { font-size: 22px; font-weight: 800; }
.cfg-head p { font-size: 13px; margin-top: 4px; max-width: 520px; line-height: 1.5; }
.cfg-actions { display: flex; gap: 10px; }
.cfg-warn { padding: 12px 16px; border-radius: 12px; background: rgba(255,182,72,.12); border: 1px solid rgba(255,182,72,.4); color: var(--warn); font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.cfg-table-wrap { overflow-x: auto; border: 1px solid var(--stroke); border-radius: var(--radius); background: var(--panel); }
.cfg-table { border-collapse: collapse; width: 100%; min-width: 540px; }
.cfg-table th, .cfg-table td { padding: 12px 14px; text-align: center; border-bottom: 1px solid var(--stroke); }
.cfg-table thead th { position: sticky; top: 0; background: var(--bg-2); font-size: 12.5px; font-weight: 700; }
.cfg-table th.role-col { white-space: nowrap; }
.cfg-table th.role-col .rname { color: var(--accent); }
.cfg-table td.cat-cell, .cfg-table th.cat-cell { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--panel); }
.cfg-table td.cat-cell .ic { margin-right: 7px; }
.cfg-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.cfg-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.cfg-col-toggle { cursor: pointer; font-size: 10.5px; color: var(--muted); display: block; margin-top: 4px; }
.cfg-col-toggle:hover { color: var(--accent); }

/* ===================== TOASTS ===================== */
#toasts { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 90; width: 320px; max-width: calc(100% - 36px); }
.toast {
  --c: var(--accent); position: relative; padding: 13px 15px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--stroke); box-shadow: 0 12px 32px rgba(0,0,0,.45);
  font-size: 13.5px; animation: tin .3s cubic-bezier(.22,1,.36,1); overflow: hidden;
}
.toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.toast.success { --c: var(--good); } .toast.error { --c: var(--bad); } .toast.warn { --c: var(--warn); }
@keyframes tin { from { transform: translateX(110%); } to { transform: none; } }

.mobile-only { display: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 10px 14px; }
  .brand-name { display: none; }
  .nav { margin-left: 0; gap: 3px; }
  .nav-btn { padding: 8px 11px; }
  .nav-btn span:not(.ic) { display: none; }
  #me-name { display: none; }
  .main { padding: 14px 14px 36px; }
  .me { gap: 7px; }
  .sb-search { min-width: 100%; flex: 1 0 100%; }
  .dropdown, .dd-btn { width: 100%; }
  .dd-panel { left: 0; right: 0; }
  .sb-live { margin-left: 0; }
}
@media (max-width: 480px) {
  .sb-row { gap: 9px; }
  .sb-field { flex: 1 0 100%; }
  .btn-coral, .sb-row .btn-ghost { flex: 1; text-align: center; }
  .wd-grid { grid-template-columns: 1fr; }
}
