/* WEBROOT/style.css (KOMPLETT) */

:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #fbfcff;
  --text: #0f172a;
  --muted: rgba(15,23,42,.65);
  --line: rgba(15,23,42,.10);
  --shadow: 0 18px 40px rgba(15,23,42,.08);
  --shadow2: 0 10px 22px rgba(15,23,42,.08);
  --radius: 18px;
  --radius2: 14px;
  --accent: #7c5cff;
  --accent2: rgba(124,92,255,.12);
  --danger: #ff4d6d;
  --danger2: rgba(255,77,109,.12);
  --ok: #2dd4bf;
  --ok2: rgba(45,212,191,.12);

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

:root[data-theme="dark"]{
  --bg: #0b1020;
  --panel: #0f172a;
  --panel2: #0b1326;
  --text: #e5e7eb;
  --muted: rgba(229,231,235,.65);
  --line: rgba(229,231,235,.12);
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --shadow2: 0 10px 22px rgba(0,0,0,.28);
  --accent: #9b8cff;
  --accent2: rgba(155,140,255,.16);
  --danger2: rgba(255,77,109,.16);
  --ok2: rgba(45,212,191,.14);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

/* Container / spacing */
.container{
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 22px 40px;
}

.h1{
  margin:0;
  font-size: 22px;
  letter-spacing: .2px;
}

.subline{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.small{
  font-size: 12px;
  color: var(--muted);
}

hr{
  border: none;
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

/* Cards */
.card{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.topHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.userBlock{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.navBar{
  padding: 10px;
  margin-bottom: 14px;
}

.navRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}

.navGroup{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}

.navTools{
  justify-content:flex-end;
}

.view{
  min-height: 50vh;
}

/* Buttons */
.btn{
  appearance:none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.35);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(15,23,42,.06);
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
:root[data-theme="dark"] .btn{
  background: rgba(255,255,255,.06);
  box-shadow: 0 8px 16px rgba(0,0,0,.22);
}

.btn:hover{
  transform: translateY(-1px);
  border-color: rgba(124,92,255,.35);
  background: var(--accent2);
}

.btn.active{
  border-color: rgba(124,92,255,.55);
  background: var(--accent2);
  box-shadow: 0 10px 22px rgba(124,92,255,.14);
}

.btn.primary{
  border-color: rgba(124,92,255,.55);
  background: linear-gradient(180deg, rgba(124,92,255,.18), rgba(124,92,255,.10));
}

.inp, textarea.inp, select.inp{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.50);
  color: var(--text);
  outline:none;
}
:root[data-theme="dark"] .inp{
  background: rgba(255,255,255,.06);
}

textarea.inp{
  min-height: 110px;
  resize: vertical;
}

/* Layout helpers */
.twoPane{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  align-items:start;
}
@media (max-width: 980px){
  .twoPane{ grid-template-columns: 1fr; }
}

.cardHead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}

.cardTitle{
  font-weight: 950;
  font-size: 14px;
}

.cardMeta{
  font-size: 12px;
  color: var(--muted);
}

.rowWrap{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 860px){
  .grid2{ grid-template-columns: 1fr; }
}

.miniLabel{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 800;
}

/* Character cards */
.charGrid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.charCard{
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  background: rgba(255,255,255,.42);
  padding: 12px;
  box-shadow: var(--shadow2);
}
:root[data-theme="dark"] .charCard{
  background: rgba(255,255,255,.05);
}

.charName{
  font-weight: 950;
  font-size: 14px;
  margin-bottom: 8px;
}

.charPills{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin-bottom: 8px;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(255,255,255,.35);
}
:root[data-theme="dark"] .chip{
  background: rgba(255,255,255,.06);
}

.dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
}

.charDesc{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  margin: 6px 0 10px;
}

.charFoot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.linkBtn{
  border:none;
  background:none;
  color: var(--accent);
  cursor:pointer;
  font-weight: 900;
  padding: 6px 8px;
  border-radius: 10px;
}
.linkBtn:hover{
  background: var(--accent2);
}

/* Status button group */
.statusGroup{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
}
.statusBtn{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.35);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 850;
  font-size: 12px;
  display:flex;
  align-items:center;
  gap: 8px;
}
:root[data-theme="dark"] .statusBtn{ background: rgba(255,255,255,.06); }
.statusBtn.active{
  border-color: rgba(124,92,255,.55);
  background: var(--accent2);
}

/* Graph container */
.graphWrap{ margin-top: 10px; }
.cyBox{
  border: 1px solid var(--line);
  border-radius: var(--radius2);
  overflow:hidden;
  background: rgba(255,255,255,.35);
  height: 640px;
  box-shadow: var(--shadow2);
  position: relative;
}
:root[data-theme="dark"] .cyBox{ background: rgba(255,255,255,.05); }

#cy{ width:100%; height:100%; }

.cyTip{
  position:absolute;
  top: 12px;
  left: 12px;
  min-width: 240px;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  display:none;
  z-index: 5;
}

.legendRow{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  margin-top: 10px;
}

.legendMeta{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   Loading Overlay
========================= */

#twzLoading{
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10050;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  min-width: 220px;
  display: none;
}
#twzLoading .title{
  font-weight: 950;
  font-size: 13px;
}
#twzLoading .sub{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
body.is-loading #twzLoading{
  display: block;
}

/* =========================
   Modal (Overlay)
========================= */

.modalOverlay{
  position: fixed;
  inset: 0;
  z-index: 10040;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal{
  width: min(980px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modalHeader{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.modalTitle{
  font-weight: 950;
  font-size: 14px;
}

.modalFooter{
  margin-top: 12px;
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  flex-wrap:wrap;
}

/* =========================
   Toasts
========================= */

#toastHost{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10060;
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
}

.toast{
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 10px 12px;
  cursor: pointer;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.hide{
  opacity: 0;
  transform: translateY(6px);
}
.toastTitle{
  font-weight: 950;
  font-size: 12px;
  margin-bottom: 3px;
}
.toastMsg{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}
.toast.ok{
  border-color: rgba(45,212,191,.35);
}
.toast.warn{
  border-color: rgba(251,191,36,.35);
}
.toast.err{
  border-color: rgba(255,77,109,.35);
}