/* ---------- Brand variable overrides (replace orange/blue-gray from app.css) ---------- */
:root{
  --acc:#D4A800;
  --acc2:#B88F00;
  --side:#1F1B1C;
  --side2:#2E2A2B;
  --card:var(--surface);
  --ink:var(--text);
  --mute:var(--muted);
  --line:var(--border);
  --blue:#8C7A3A;
}
/* primary buttons: dark text on gold for readability */
.btn,a.btn,button.btn{color:#231F20}
.btn.alt,.btn.ghost,.btn.sec,.btn-light{color:var(--text)}

/* Rasan - Sidebar + Topbar (uses real classes: .side .brand nav a.on .ic .top .top-r .pill .usr .av) */

/* ---------- Sidebar ---------- */
.side{
  background:linear-gradient(180deg,#2B2728 0%,#171415 100%)!important;
  border:0!important;
  padding:14px 6px!important;
  box-shadow:0 0 40px rgba(0,0,0,.18);
}
.side .brand{
  display:flex;align-items:center;gap:12px;
  margin:4px 10px 18px;padding:12px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(212,168,0,.25);
  border-radius:16px;
  color:#fff!important;text-decoration:none;
}
.side .brand img{
  width:44px;height:44px;object-fit:contain;
  background:#fff;border-radius:12px;padding:4px;
}
.side .brand b{display:block;color:#fff;font-weight:800;font-size:1rem}
.side .brand small{display:block;color:#D4A800;font-size:.72rem;opacity:.9}

.side nav{display:flex;flex-direction:column;gap:2px}
.side nav a{
  display:flex!important;align-items:center;gap:12px;
  margin:2px 10px!important;padding:8px 10px!important;
  color:#CFC9C4!important;
  border-radius:14px;
  text-decoration:none;
  font-weight:600;
  transition:background .2s,color .2s,transform .2s;
}
.side nav a .ic{
  box-sizing:border-box;
  flex:0 0 auto;
  width:36px;height:36px;padding:8px;
  border-radius:11px;
  background:rgba(255,255,255,.07);
  color:#E8D48A;
  transition:background .2s,color .2s,transform .2s;
}
.side nav a:hover{
  background:rgba(212,168,0,.12)!important;
  color:#fff!important;
}
.side nav a:hover .ic{
  background:rgba(212,168,0,.25);
  color:#F0CF55;
  transform:scale(1.08);
}
/* active item */
.side nav a.on{
  background:linear-gradient(135deg,#D4A800,#EBC52E)!important;
  color:#231F20!important;
  font-weight:800;
  box-shadow:0 8px 18px rgba(212,168,0,.35);
}
.side nav a.on .ic{
  background:rgba(35,31,32,.9);
  color:#F0CF55;
}

/* ---------- Top bar ---------- */
.top{
  background:var(--surface)!important;
  border-bottom:1px solid var(--border)!important;
  backdrop-filter:blur(8px);
}
.top-title{font-weight:800;color:var(--text)!important}
.top .pill{
  background:transparent!important;
  color:var(--gold-600)!important;
  border:1px solid var(--gold)!important;
  border-radius:999px!important;
  padding:4px 14px!important;
  font-weight:600;
  transition:all .2s;
}
html[data-theme="dark"] .top .pill{color:var(--gold)!important}
.top .pill:hover{background:var(--gold)!important;color:#231F20!important}
.top .pill.out{border-color:#C0392B!important;color:#C0392B!important}
.top .pill.out:hover{background:#C0392B!important;color:#fff!important}
.usr .av{
  background:linear-gradient(135deg,#D4A800,#EBC52E)!important;
  color:#231F20!important;font-weight:800;
}

/* ---------- Theme toggle inside top bar ---------- */
.top-r #theme-toggle{
  position:static;
  width:38px;height:38px;font-size:17px;
  box-shadow:none;
  margin-inline-end:6px;
}

/* ---------- Mobile ---------- */
@media (max-width:900px){
  .side nav a .ic{width:34px;height:34px}
}

/* =====================================================================
   v3: Forms, filters, buttons, tables, dark-mode fixes
   (classes x-btn / x-light / x-gold are added automatically by theme.js)
   ===================================================================== */

/* ---------- Fields: consistent size ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]),
select{
  min-height:40px;
  padding:8px 12px!important;
  font-size:.92rem;
  line-height:1.3;
}
textarea{padding:10px 12px!important;min-height:90px;font-size:.92rem}
input[type=checkbox],input[type=radio]{accent-color:#D4A800;width:18px;height:18px;vertical-align:middle}
input[type=date],input[type=month]{min-width:140px}

/* select: custom gold arrow */
html select{
  appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23D4A800' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;
  padding-inline-end:36px!important;
}
html[dir=rtl] select{background-position:left 12px center!important}
html[dir=ltr] select{background-position:right 12px center!important}

/* file input */
input[type=file]{padding:6px!important;cursor:pointer}
input[type=file]::file-selector-button{
  background:#D4A800;color:#231F20;border:0;border-radius:8px;
  padding:6px 14px;margin-inline-end:10px;
  font-family:inherit;font-weight:700;cursor:pointer;
}

/* ---------- Inline bars (month picker, report bar): keep label + field in one row ---------- */
.bar{gap:10px 12px}
.bar label{display:inline-flex;align-items:center;gap:8px;font-weight:600;color:var(--muted)}
.bar input:not([type=checkbox]):not([type=radio]),.bar select{min-width:160px}
.bar .btn,.bar button{min-height:40px;padding:0 18px}

/* ---------- Form cards ---------- */
.card form label{display:block;margin:10px 0 6px;font-weight:600;font-size:.88rem}
.card form input:not([type=checkbox]):not([type=radio]),.card form select,.card form textarea{width:100%}
.card form .btn[type=submit],.card form button[type=submit]{min-height:44px;width:100%;font-size:1rem}

/* ---------- Buttons ---------- */
.btn,button.btn,a.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  font-weight:700;cursor:pointer;text-decoration:none;
}
.x-gold,.x-gold *{color:#231F20!important}
html[data-theme="dark"] .x-btn{
  background:var(--surface-2)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
  box-shadow:none!important;
}
html[data-theme="dark"] .x-btn:hover{border-color:#D4A800!important;color:#D4A800!important}
html[data-theme="dark"] .x-btn svg{stroke:currentColor}
html[data-theme="dark"] .x-light{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-color:var(--border)!important;
}

/* ---------- Tables (dark) ---------- */
html[data-theme="dark"] tbody tr,
html[data-theme="dark"] tbody tr:hover{background:transparent!important}
html[data-theme="dark"] tbody tr:nth-child(even) td{background:rgba(255,255,255,.025)!important}
html[data-theme="dark"] tbody tr:hover td{background:var(--gold-100)!important}
html[data-theme="dark"] tr.on td,html[data-theme="dark"] tr.cur td,html[data-theme="dark"] tr.hl td,
html[data-theme="dark"] tr.sel td,html[data-theme="dark"] tr.active td,html[data-theme="dark"] tr.current td{
  background:var(--gold-100)!important;color:var(--text)!important;
}
html[data-theme="dark"] td a{color:#D4A800}

/* =====================================================================
   v4: exact fixes using the real app.css classes
   (.btn .btn.sec .btn.sm .filters .ph .tabs a)
   ===================================================================== */

/* ---------- Primary buttons: dark text on gold ---------- */
html[data-theme="dark"] a.btn:not(.sec):not(.ok):not(.danger):not(.dark),
html[data-theme="dark"] button.btn:not(.sec):not(.ok):not(.danger):not(.dark){
  color:#231F20!important;
}
html[data-theme="dark"] a.btn.ok,html[data-theme="dark"] a.btn.danger,html[data-theme="dark"] a.btn.dark,
html[data-theme="dark"] button.btn.ok,html[data-theme="dark"] button.btn.danger,html[data-theme="dark"] button.btn.dark{
  color:#fff!important;
}
html[data-theme="dark"] .btn.dark{border:1px solid var(--border)}

/* ---------- Secondary buttons (.btn.sec): Excel, PDF, Clear, Import, icon buttons ---------- */
html[data-theme="dark"] .btn.sec,
html[data-theme="dark"] a.btn.sec,
html[data-theme="dark"] button.btn.sec{
  background:var(--surface-2)!important;
  color:var(--text)!important;
  border:1px solid var(--border)!important;
}
html[data-theme="dark"] .btn.sec:hover{border-color:#D4A800!important;color:#D4A800!important;background:var(--surface)!important}
.btn.sec svg{stroke:currentColor}

/* ---------- Filter form (.filters) ---------- */
.filters{
  display:flex;flex-wrap:wrap;gap:12px 14px;align-items:flex-end;
  padding:16px 18px;border-radius:var(--radius);margin-bottom:14px;
}
.filters label{
  display:flex;flex-direction:column;gap:6px;
  flex:1 1 150px;min-width:130px;max-width:230px;
  font-size:.78rem;font-weight:700;color:var(--muted);
}
.filters label input,.filters label select{width:100%}
.filters .btn,.filters .btn.sm{min-height:40px;padding:0 20px;font-size:.9rem;border-radius:10px;justify-content:center}
html[data-theme="dark"] .filters{
  background:var(--surface)!important;
  border:1px solid var(--border)!important;
  box-shadow:var(--shadow);
}

/* ---------- Photo cards (.ph) ---------- */
.ph{transition:transform .2s,box-shadow .2s,border-color .2s}
.ph:hover{transform:translateY(-3px);box-shadow:var(--shadow-hover)}
html[data-theme="dark"] .ph{background:var(--surface)!important;border-color:var(--border)!important}
html[data-theme="dark"] .ph img{background:var(--surface-2)}
html[data-theme="dark"] .ph div{color:var(--muted)}
html[data-theme="dark"] .ph b{color:#F0CF55}
html[data-theme="dark"] .ph a{color:var(--text)}

/* ---------- Tabs (.tabs a) ---------- */
html[data-theme="dark"] .tabs a{
  background:var(--surface)!important;
  color:var(--text)!important;
  border-color:var(--border)!important;
}
html[data-theme="dark"] .tabs a:hover{border-color:#D4A800!important;color:#D4A800!important}
.tabs a.on,html[data-theme="dark"] .tabs a.on{
  background:linear-gradient(135deg,#D4A800,#EBC52E)!important;
  color:#231F20!important;
  border-color:transparent!important;
  box-shadow:0 6px 14px rgba(212,168,0,.3);
}

/* =====================================================================
   v5: dark / colored buttons keep white text (both light and dark mode)
   Cause: the generic ".btn{color:#231F20}" rule made text dark on .btn.dark
   ===================================================================== */
html .btn.dark,html a.btn.dark,html button.btn.dark,
html .btn.ok,html a.btn.ok,html button.btn.ok,
html .btn.danger,html a.btn.danger,html button.btn.danger{
  color:#fff!important;
}
html .btn.dark,html a.btn.dark,html button.btn.dark{
  background:#231F20!important;
  border:1px solid #3A3536!important;
}
html .btn.dark:hover,html a.btn.dark:hover,html button.btn.dark:hover{
  background:#3A3536!important;
  border-color:#D4A800!important;
  color:#F0CF55!important;
}
html .btn.ok:hover,html .btn.danger:hover{filter:brightness(1.1)}
/* icons inside these buttons follow the text color */
.btn.dark svg,.btn.ok svg,.btn.danger svg{stroke:currentColor}
