:root{
  /* Modern LIGHT theme */
  --bg:#f3f4f6;        /* light gray background */
  --card:#ffffff;      /* white cards */
  --text:#111827;      /* slate-900 */
  --muted:#6b7280;     /* gray-500 */
  --border:#d1d5db;    /* gray-300 */
  --primary:#06b6d4;   /* cyan-500 accent */
  --success:#16a34a;   /* green-600 */
  --warn:#b45309;      /* amber-700 */
  --accent:#06b6d4;    /* alias for emphasis */
  color-scheme: light dark;
}
*{box-sizing:border-box}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font:clamp(15px,1.6vw,16px)/1.6 "Inter",system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
h1,h2,h3{margin:0 0 .5rem}
h1{font-size:1.25rem} h2{font-size:1.1rem} h3{font-size:1rem}
.small{font-size:.85rem} .muted{color:var(--muted)} .bold{font-weight:600}
.topbar{position:sticky;top:0;z-index:10;background:rgba(255,255,255,.9);backdrop-filter:saturate(140%) blur(8px);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem}
.brand{display:flex;gap:.75rem;align-items:center}
.logo{font-size:1.6rem}
.actions{display:flex;gap:.5rem;align-items:center}
.container{max-width:1240px;margin:1rem auto;padding: 4px 1rem}
.grid{display:grid;grid-template-columns:2fr 1.44fr;gap:1rem}
.col-2{grid-column:1/2} .col-1{grid-column:2/3}
.card{background:var(--card);border:2px solid var(--border);border-radius:14px;padding:1rem;box-shadow:0 6px 16px rgba(0,0,0,.08)}
.card-head{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}
.card-sub{padding: .9rem 0}
.row{display:flex} .gap{gap:.5rem} .grow{flex:1}
.form-row{display:flex;gap:.5rem;margin:.5rem 0 1rem}
.form-field{display:flex;flex-direction:column;gap:.25rem;min-width:160px}
.label{font-size:.75rem;color:var(--muted)}
.select, input[type=date], input[type=text], input[type=number]{border:1px solid var(--border);border-radius:12px;padding:.6rem .8rem;background:#ffffff;color:#111827}
.select:hover, input[type=date]:hover, input[type=text]:hover, input[type=number]:hover{border-color:#bfc7d1}
.select option{color:#111827;background:#ffffff}
.select::placeholder, input[type=text]::placeholder, input[type=number]::placeholder{color:#9aa3af}
.select:focus, input[type=date]:focus, input[type=text]:focus, input[type=number]:focus{outline:2px solid var(--primary);outline-offset:0;box-shadow:0 0 0 3px rgba(6,182,212,.25);border-color:var(--primary)}
*:focus{outline:none}
*:focus-visible{outline:3px solid var(--primary);outline-offset:2px}
.btn{border:1px solid var(--border);background:#ffffff;border-radius:12px;padding:.6rem .9rem;cursor:pointer;color:#111827;font-weight:600;transition:background .15s ease, filter .15s ease, transform .05s ease, border-color .15s ease}
.btn.small{padding:.25rem .5rem;font-size:.85rem}
.btn.primary{background:var(--primary);color:#04252b;border-color:var(--primary)}
.btn.success{background:var(--success);color:white;border-color:var(--success)}
.btn.outline{background:transparent;color:var(--primary);border-color:var(--primary)}
.btn:active{transform:translateY(1px)}
.btn.filebtn{display:inline-flex;align-items:center;gap:.4rem}
.btn:disabled{opacity:.6;cursor:not-allowed}
/* subtle button hover for light theme */
.btn:hover{filter:brightness(0.98);border-color:var(--primary)}
.btn.primary:hover,.btn.success:hover{filter:brightness(1.05)}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:.6rem;border-top:1px solid var(--border);text-align:left;vertical-align:top}
.table thead th{background:#f3f4f6;color:#111827;font-weight:600}
.table thead th:first-child{border-top-left-radius:8px}
.table thead th:last-child{border-top-right-radius:8px}
.table tbody tr:nth-child(odd){background:#fafafa}
.table tbody tr:hover{background:#f3f4f6}
.table .right{text-align:right}
.table-wrap{overflow:auto;border:1px solid var(--border);border-radius:10px}
.list{margin:.5rem 0 0;padding-left:1.2rem}
.switch{position:relative;display:inline-block;width:40px;height:22px}
.switch input{opacity:0;width:0;height:0}
.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#e2e8f0;border-radius:22px;transition:.2s}
.slider:before{position:absolute;content:"";height:18px;width:18px;left:2px;top:2px;background:white;border-radius:50%;transition:.2s;box-shadow:0 1px 2px rgba(0,0,0,.1)}
.switch input:checked + .slider{background:#16a34a}
.switch input:checked + .slider:before{transform:translateX(18px)}
.badge{display:inline-flex;align-items:center;gap:.25rem;border-radius:999px;padding:.2rem .5rem;font-size:.75rem}
.badge.ok{color:#10b981;background:rgba(16,185,129,.18)}
.badge.warn{color:#f59e0b;background:rgba(245,158,11,.20)}
.badge.muted{color:#9ca3af;background:rgba(148,163,184,.14)}
.mt-12{margin-top:.75rem} .mt-16{margin-top:1rem}
.mb-12{margin-bottom:.75rem}
.footer{max-width:1100px;margin:1rem auto 2rem;padding:0 1rem;text-align:center}
.brand #course-title a{ color: inherit; text-decoration: none; font-style: italic; }
.ledger-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:.75rem}
.ledger-card{border:1px solid var(--border);border-radius:10px;overflow:hidden}
.ledger-head{background:var(--primary);color:white;padding:.4rem .6rem;display:flex;justify-content:space-between;font-size:.85rem}
.ledger-table{width:100%;border-collapse:collapse;font-size:.85rem}
.ledger-table th,.ledger-table td{border-top:1px solid var(--border);padding:.3rem .4rem}
.right{ text-align:right }
@media (max-width: 900px){ .grid{grid-template-columns:1fr} .col-2,.col-1{grid-column:auto} }

/* Ledger: auto align to left grid column */
.ledger-left{ grid-column:1 / 2; width:100%; margin:0 }
@media (max-width: 900px){ .ledger-left{ grid-column:auto; width:auto } }

/* Touch ergonomics: larger tap targets */
@media (pointer: coarse){
  .btn{padding:.7rem 1rem}
  .select, input[type=date], input[type=text], input[type=number]{padding:.75rem .9rem}
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce){
  *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}

/* Automatic dark mode for eye comfort */
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0b1220;
    --card:#0f172a;
    --text:#e5e7eb;
    --muted:#9aa3b2;
    --border:#233041;
    --primary:#22d3ee;
    --success:#10b981;
    --warn:#f59e0b;
    --accent:#22d3ee;
  }
  .topbar{background:rgba(11,18,32,.92);border-bottom:1px solid var(--border)}
  .card{box-shadow:0 6px 16px rgba(0,0,0,.25)}
  .select, input[type=date], input[type=text], input[type=number]{background:#0b1220;color:#f1f5f9;border-color:#2b3a4d}
  .select:hover, input[type=date]:hover, input[type=text]:hover, input[type=number]:hover{border-color:#3a4e67}
  .btn{background:#0b1220;color:#e6edf5;border-color:#2b3a4d}
  .btn.outline{background:#0f1b2d}
  .btn:hover{filter:brightness(1.08)}
  .table thead th{background:#1f2937;color:#e5e7eb}
  .table tbody tr:nth-child(odd){background:rgba(255,255,255,.03)}
  .table tbody tr:hover{background:rgba(255,255,255,.06)}
}
