/* ComplaintTerminal Ledger UI (CRT-ish, restrained) */
:root{
  --bg:#05070a;
  --panel:#070b10;
  --fg:rgba(200,255,215,.92);
  --muted:rgba(200,255,215,.65);
  --line:rgba(140,255,185,.18);
  --accent:rgba(140,255,185,.95);
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: radial-gradient(1200px 700px at 50% 0%, rgba(20,30,25,.35), transparent 60%), var(--bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.wrap{ max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
.frame{
  border:1px solid var(--line);
  border-radius: 22px;
  background: rgba(0,0,0,.35);
  padding: 18px 16px 16px;
  box-shadow: 0 30px 110px rgba(0,0,0,.65);
}
.header{
  display:flex; justify-content:space-between; align-items:flex-start; gap:12px;
  padding: 4px 6px 10px;
}
h1{ margin:0; font-size: 22px; letter-spacing: .6px; }
.sub{ margin-top:6px; color: var(--muted); font-size: 12px; max-width: 520px; line-height: 1.35; }
.grid{
  display:grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 10px;
}
.panel{
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0,0,0,.25);
  padding: 14px;
  min-height: 420px;
}
label{ display:block; font-size: 12px; color: var(--muted); letter-spacing: .8px; margin-bottom: 8px; }
.hint{ color: var(--muted); font-size: 12px; margin-bottom: 10px; line-height: 1.35; }
.checklist{
  border: 1px solid rgba(140,255,185,.12);
  border-radius: 14px;
  padding: 10px;
  max-height: 260px;
  overflow:auto;
  background: rgba(0,0,0,.22);
}
.cat{ margin: 10px 0 4px; color: rgba(200,255,215,.8); font-size: 12px; letter-spacing:.5px; }
.item{ display:flex; gap:10px; align-items:flex-start; padding: 7px 6px; border-radius: 10px; }
.item:hover{ background: rgba(140,255,185,.06); }
.item input{ margin-top: 2px; }
.item span{ color: rgba(200,255,215,.9); font-size: 13px; line-height: 1.25; }
.actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px; }
button{
  font: inherit;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(140,255,185,.18);
  background: rgba(0,0,0,.28);
  color: var(--fg);
  cursor:pointer;
}
button:hover{ border-color: rgba(140,255,185,.35); }
button:disabled{ opacity:.5; cursor:not-allowed; }
.primary{
  background: rgba(140,255,185,.12);
  border-color: rgba(140,255,185,.26);
}
.secondary{ color: rgba(200,255,215,.85); }
.link{
  border: none;
  background: transparent;
  padding: 0;
  color: rgba(140,255,185,.92);
  text-decoration: underline;
  cursor: pointer;
}
.right{ display:flex; gap:10px; }
.kv{
  margin-top: 12px;
  border-top: 1px dashed rgba(140,255,185,.16);
  padding-top: 10px;
  display:flex;
  flex-direction:column;
  gap: 6px;
  font-size: 12px;
}
.kv div{ display:flex; justify-content:space-between; gap:10px; color: var(--muted); }
.kv span:last-child{ color: rgba(200,255,215,.9); }
.output{
  white-space: pre-wrap;
  line-height: 1.28;
  font-size: 13px;
  padding: 10px;
  border: 1px solid rgba(140,255,185,.12);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  min-height: 320px;
}
.footer{
  display:flex; justify-content:space-between; align-items:center;
  margin-top: 10px; color: var(--muted); font-size: 12px;
}
.crt{ position:relative; overflow:hidden; }
.crt::before{
  content:"";
  position:absolute; inset:-2px;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.03), rgba(255,255,255,.03) 1px, transparent 2px, transparent 4px);
  opacity:.14;
  pointer-events:none;
}
.glow{ text-shadow: 0 0 10px rgba(140,255,185,.15); }
.output::after{
  content:"";
  display:inline-block;
  width: 9px;
  height: 1.1em;
  background: rgba(140,255,185,.9);
  vertical-align: -2px;
  margin-left: 4px;
  animation: blink 1s steps(1) infinite;
  opacity:.55;
}
@keyframes blink { 0%,49%{opacity:.6} 50%,100%{opacity:0} }
dialog{
  border: 1px solid rgba(140,255,185,.18);
  border-radius: 18px;
  background: rgba(0,0,0,.78);
  color: var(--fg);
  padding: 16px;
  box-shadow: 0 20px 80px rgba(0,0,0,.7);
}
dialog::backdrop{ background: rgba(0,0,0,.72); }
dialog .dialog-panel{
  border: 1px solid rgba(140,255,185,.14);
  border-radius: 14px;
  background: rgba(0,0,0,.25);
  padding: 14px;
}
dialog p{ color: rgba(200,255,215,.88); }
dialog strong{ color: var(--fg); }
body.kiosk .grid{ grid-template-columns: 1fr; }
body.kiosk .panel[aria-label="Intake panel"]{ order: 2; }
body.kiosk .panel[aria-label="Ledger panel"]{ order: 1; }
body.kiosk .kv, body.kiosk #aboutBtn{ display:none !important; }
body.kiosk .output{ min-height: 380px; font-size: 18px; }
@media (max-width: 880px){
  .grid{ grid-template-columns: 1fr; }
  .panel{ min-height: auto; }
  .output{ min-height: 240px; }
}

.footer-actions{ display:flex; gap:14px; align-items:center; }
.archives-list{
  border: 1px solid rgba(140,255,185,.12);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,.22);
  max-height: 240px;
  overflow:auto;
  color: rgba(200,255,215,.88);
  font-size: 13px;
  line-height: 1.35;
}
.archives-list .row{ display:flex; justify-content:space-between; padding: 8px 6px; border-radius: 10px; }
.archives-list .row:hover{ background: rgba(140,255,185,.06); }
.archives-list .row button{ padding: 8px 10px; border-radius: 12px; }

body.kiosk .wrap{ max-width: 1180px; }
body.kiosk .actions{ gap: 12px; }

.period-select select{
  background: rgba(0,0,0,.35);
  color: rgba(200,255,215,.92);
  border: 1px solid rgba(140,255,185,.18);
  border-radius: 12px;
  padding: 6px 10px;
  margin-left: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}
.period-select select:focus{
  outline: 2px solid rgba(140,255,185,.22);
  outline-offset: 2px;
}
body.kiosk .period-select{ display:none !important; }
body.kiosk .output{ font-size: 16px; line-height: 1.35; }


/* --- HOTFIX: Scrollbar theming (prevent white flash) --- */
:root { color-scheme: dark; }

/* Firefox */
#checklist, #ledgerOut, .output, .panel, .screen, .frame, body {
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 255, 160, 0.35) rgba(0, 0, 0, 0.55);
}

/* WebKit */
#checklist::-webkit-scrollbar,
#ledgerOut::-webkit-scrollbar,
.output::-webkit-scrollbar,
.panel::-webkit-scrollbar,
.screen::-webkit-scrollbar,
.frame::-webkit-scrollbar,
body::-webkit-scrollbar{
  width: 12px;
  height: 12px;
}
#checklist::-webkit-scrollbar-track,
#ledgerOut::-webkit-scrollbar-track,
.output::-webkit-scrollbar-track,
.panel::-webkit-scrollbar-track,
.screen::-webkit-scrollbar-track,
.frame::-webkit-scrollbar-track,
body::-webkit-scrollbar-track{
  background: rgba(0, 0, 0, 0.55);
  border-left: 1px solid rgba(255,255,255,0.06);
}
#checklist::-webkit-scrollbar-thumb,
#ledgerOut::-webkit-scrollbar-thumb,
.output::-webkit-scrollbar-thumb,
.panel::-webkit-scrollbar-thumb,
.screen::-webkit-scrollbar-thumb,
.frame::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb{
  background: rgba(120, 255, 160, 0.22);
  border: 1px solid rgba(120, 255, 160, 0.28);
  border-radius: 10px;
}
#checklist::-webkit-scrollbar-thumb:hover,
#ledgerOut::-webkit-scrollbar-thumb:hover,
.output::-webkit-scrollbar-thumb:hover,
.panel::-webkit-scrollbar-thumb:hover,
.screen::-webkit-scrollbar-thumb:hover,
.frame::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover{
  background: rgba(120, 255, 160, 0.32);
}
#checklist::-webkit-scrollbar-thumb:active,
#ledgerOut::-webkit-scrollbar-thumb:active,
.output::-webkit-scrollbar-thumb:active,
.panel::-webkit-scrollbar-thumb:active,
.screen::-webkit-scrollbar-thumb:active,
.frame::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active{
  background: rgba(120, 255, 160, 0.38);
}


/* --- HOTFIX: Keep NOTICE available in kiosk mode --- */
body.kiosk #aboutBtn,
body.kiosk .aboutBtn,
body.kiosk .about-btn,
body.kiosk [data-action="about"],
body.kiosk #noticeBtn {
  display: inline-flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}


/* --- Desktop sizing + centering (non-kiosk) --- */
@media (min-width: 701px){
  /* Center the terminal on desktop in standard mode */
  body:not(.kiosk){
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
  }

  /* Constrain overall width so it doesn't feel full-screen */
  body:not(.kiosk) .wrap{
    width: min(980px, 100%);
  }

  /* Keep the CRT frame from ballooning vertically */
  body:not(.kiosk) .frame{
    width: 100%;
    max-height: calc(100vh - 56px);
  }

  /* Allow internal scrolling where needed */
  body:not(.kiosk) .grid{
    max-height: calc(100vh - 160px);
  }
}

/* Kiosk mode can be wider, but still contained on desktop */
@media (min-width: 701px){
  body.kiosk .wrap{
    width: min(1180px, 100%);
  }
}
