/* ============================================================================
   Daily Tracking - visual design
   ----------------------------------------------------------------------------
   Design language adopted from the LalaAlgo frontend so the two apps read as
   one family: true-black + gold, DM Sans / DM Mono, 10px radius, uppercase
   micro-headers on tables, gold-tinted borders on inputs.

   Nothing here is linked or imported from LalaAlgo - the tokens below were
   read from its stylesheet and re-declared locally. Fonts are self-hosted in
   /static/fonts, so there is no CDN request at runtime.
   ========================================================================= */

@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400 800;
             font-display: swap; src: url('/static/fonts/dmsans-var.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400;
             font-display: swap; src: url('/static/fonts/dmmono-400.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500;
             font-display: swap; src: url('/static/fonts/dmmono-500.woff2') format('woff2'); }

:root {
  /* palette - lalaalgo dark theme */
  --bg: #0B0910;
  --sf: #17141F;
  --sf2: #211D2B;
  --bd: #2C2636;
  --bd-gold: rgba(212, 169, 71, .16);
  --bd-gold-soft: rgba(212, 169, 71, .12);
  --tx: #F4EFE4;
  --tx2: #A9A090;
  --tx3: #6E6658;
  --acc: #D4A947;
  --acc2: #E5BE5C;
  --grn: #34D399;
  --grn-dim: rgba(52, 211, 153, .13);
  --red: #F8776F;
  --red-dim: rgba(248, 119, 111, .14);
  --yel: #D4A947;
  --yel-dim: rgba(212, 169, 71, .15);
  --teal: #56B4CE;
  --teal-dim: rgba(86, 180, 206, .14);
  --input-bg: #1B1826;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 34px rgba(0, 0, 0, .45);
  --glow: 0 0 26px rgba(212, 169, 71, .12);
  --sans: 'DM Sans', 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  overflow-x: hidden;
}
button, input, select { font-family: inherit; color: inherit; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.dim { color: var(--tx3); }
.mono { font-family: var(--mono); }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--bd); border-radius: var(--radius);
  padding: 9px 13px; background: var(--sf2); color: var(--tx);
  font-size: 12px; font-weight: 700; font-family: var(--sans);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.btn:hover { background: rgba(212, 169, 71, .08); border-color: rgba(212, 169, 71, .36); color: var(--acc2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--sf2); border-color: var(--bd); color: var(--tx); }
.btn-primary {
  background: linear-gradient(135deg, #D4A947, #0b72ff);
  border-color: transparent; color: #fff;
  box-shadow: 0 14px 28px rgba(212, 169, 71, .22);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #D4A947, #0b72ff); color: #fff; border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- fields */
.field { margin-bottom: 14px; }
.field label,
.filters label {
  display: block; margin-bottom: 6px;
  font-size: 11px; color: var(--tx3);
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.field input, .field select,
.filters input, .filters select {
  width: 100%; min-height: 34px; padding: 0 9px;
  background: var(--input-bg); border: 1px solid var(--bd-gold);
  border-radius: var(--radius-sm); color: var(--tx);
  font-size: 13px; font-family: var(--sans);
}
.field input:focus, .field select:focus,
.filters input:focus, .filters select:focus {
  outline: none; border-color: rgba(212, 169, 71, .52); box-shadow: var(--glow);
}
.field.err input, .field.err select { border-color: var(--red); }
.field .msg { margin-top: 5px; font-size: 11.5px; color: var(--red); }

.alert {
  padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px;
  font-size: 12px; background: var(--red-dim);
  border: 1px solid rgba(248, 119, 111, .4); color: var(--red);
}

/* ----------------------------------------------------------------- login */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: min(400px, 100%); padding: 32px;
  background: var(--sf); border: 1px solid var(--bd-gold);
  border-radius: var(--radius); box-shadow: var(--shadow), var(--glow);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.login-card h1 .accent { color: var(--acc); }
.login-card .sub { margin: 0 0 24px; color: var(--tx3); font-size: 12px; }

/* --------------------------------------------------------------- app shell */
#app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 22px; flex: 0 0 auto;
  min-height: 76px; padding: 18px clamp(18px, 3.6vw, 56px);
  background: rgba(33, 29, 43, .84);
  border-bottom: 1px solid var(--bd-gold-soft);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-family: var(--sans); font-weight: 800; font-size: 18px; display: flex; align-items: baseline; gap: 8px; }
.brand .accent { color: var(--acc); }
.brand span.tag { color: var(--tx3); font-weight: 400; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.who { text-align: right; line-height: 1.3; }
.who .u { font-weight: 700; font-size: 13px; }
.who .r { font-size: 10px; color: var(--acc); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.body { display: flex; flex: 1; min-height: 0; }
.nav {
  width: 200px; flex: 0 0 auto; padding: 16px 12px;
  background: var(--sf); border-right: 1px solid var(--bd);
}
.nav a {
  display: block; padding: 9px 13px; border-radius: var(--radius-sm); margin-bottom: 4px;
  color: var(--tx2); text-decoration: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; border: 1px solid transparent;
}
.nav a:hover { background: var(--sf2); color: var(--tx); }
.nav a.active {
  background: rgba(212, 169, 71, .10); border-color: rgba(212, 169, 71, .36);
  color: var(--acc2); font-weight: 700;
}
.main { flex: 1; min-width: 0; padding: 22px clamp(16px, 2.4vw, 32px); overflow: auto; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.count { color: var(--tx3); font-size: 11.5px; }

/* --------------------------------------------------------------- filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px;
  padding: 12px 14px; background: var(--sf);
  border: 1px solid var(--bd); border-radius: var(--radius); box-shadow: var(--shadow);
}
.filters input, .filters select { width: auto; }
.filters input[type=text] { min-width: 220px; }
.filters label { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 7px; color: var(--tx3); cursor: pointer;
         font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.check input { width: auto; min-height: 0; accent-color: var(--acc); }

/* ---------------------------------------------------------------- tables */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  border: 1px solid var(--bd); border-radius: var(--radius); background: var(--sf);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 11.5px; white-space: nowrap; }
th {
  text-align: left; padding: 10px;
  color: var(--tx3); font-weight: 750; font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--bd);
}
td {
  padding: 9px 10px; border-bottom: 1px solid var(--bd);
  color: var(--tx2); font-size: 11.5px; line-height: 1.45;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(212, 169, 71, .045); }
tbody tr:hover td { color: var(--tx); }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

.pill { display: inline-block; padding: 3px 9px; border-radius: 99px;
        font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.pill.on { background: var(--grn-dim); color: var(--grn); }
.pill.off { background: var(--red-dim); color: var(--red); }
.empty { padding: 36px; text-align: center; color: var(--tx3); font-size: 12px; }

/* ----------------------------------------------------------------- modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .68); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px; overflow: auto; backdrop-filter: blur(3px);
}
.modal {
  width: min(720px, 100%); background: var(--sf);
  border: 1px solid var(--bd-gold); border-radius: var(--radius);
  padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6), var(--glow);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; font-weight: 800; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  padding: 11px 16px; border-radius: var(--radius);
  background: var(--sf2); border: 1px solid var(--bd);
  box-shadow: var(--shadow); font-size: 12px; font-weight: 600;
}
.toast.ok { border-color: rgba(52, 211, 153, .5); color: var(--grn); }
.toast.bad { border-color: rgba(248, 119, 111, .5); color: var(--red); }

.placeholder {
  padding: 44px; text-align: center; color: var(--tx3); font-size: 12px;
  background: var(--sf); border: 1px dashed var(--bd); border-radius: var(--radius);
}

/* ------------------------------------------------------------ attendance */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  padding: 8px 15px; border-radius: var(--radius) var(--radius) 0 0; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--tx3);
  font-size: 12px; font-weight: 700; font-family: var(--sans);
}
.tab:hover { color: var(--tx); }
.tab.active {
  background: var(--sf); border-color: var(--bd); border-bottom-color: var(--sf);
  color: var(--acc2);
}

.banner {
  padding: 10px 13px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 12px;
  background: var(--yel-dim); border: 1px solid rgba(212, 169, 71, .35); color: var(--acc2);
}

#att-table td, #att-table th { padding: 6px 9px; }
#att-table tbody tr.changed { background: var(--teal-dim); }
#att-table tbody tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--acc); }
#att-table select, #att-table input {
  padding: 4px 7px; min-height: 30px; border-radius: 6px;
  background: var(--input-bg); border: 1px solid var(--bd-gold);
  color: var(--tx); font-size: 11.5px; max-width: 100%;
}
#att-table select:focus, #att-table input:focus { outline: none; border-color: rgba(212, 169, 71, .52); }
#att-table input.line { width: 68px; font-family: var(--mono); }
#att-table input.remarks { width: 150px; }
.carry { font-size: 9.5px; color: var(--tx3); display: block; letter-spacing: .02em; }

.statusgroup { display: inline-flex; border: 1px solid var(--bd); border-radius: var(--radius-sm); overflow: hidden; }
.statusgroup button {
  width: 30px; padding: 5px 0; border: none; background: transparent;
  color: var(--tx3); cursor: pointer; font-weight: 800; font-size: 11px; font-family: var(--mono);
}
.statusgroup button:hover { background: var(--sf2); color: var(--tx); }
.statusgroup:focus-within { border-color: rgba(212, 169, 71, .52); box-shadow: var(--glow); }
.statusgroup button[aria-checked="true"][data-s="P"] { background: var(--grn-dim); color: var(--grn); }
.statusgroup button[aria-checked="true"][data-s="H"] { background: var(--yel-dim); color: var(--yel); }
.statusgroup button[aria-checked="true"][data-s="A"] { background: var(--red-dim); color: var(--red); }

.counterbar {
  position: sticky; bottom: 0; margin-top: 12px; padding: 11px 15px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: rgba(33, 29, 43, .92); backdrop-filter: blur(16px);
  border: 1px solid var(--bd-gold-soft); border-radius: var(--radius);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--tx3); font-weight: 600;
}
.counterbar b { font-family: var(--mono); font-size: 14px; font-weight: 700; margin-left: 5px; }
.cP { color: var(--grn); } .cH { color: var(--yel); } .cA { color: var(--red); }

/* --------------------------------------------------------------- reports */
#rep-table { font-size: 11px; }
#rep-table th, #rep-table td { padding: 5px 7px; text-align: center; }
#rep-table th.name, #rep-table td.name { text-align: left; white-space: nowrap; }
#rep-table tbody td.s-P { color: var(--grn); font-weight: 700; font-family: var(--mono); }
#rep-table tbody td.s-H { color: var(--yel); font-weight: 700; font-family: var(--mono); }
#rep-table tbody td.s-A { color: var(--red); font-weight: 700; font-family: var(--mono); }
#rep-table tbody td.s-none { color: #3a3340; }
#rep-table th.sunday, #rep-table td.sunday { background: rgba(212, 169, 71, .05); }
#rep-table tfoot td { font-weight: 800; color: var(--tx); border-top: 1px solid var(--bd-gold); }

/* ------------------------------------------- connectivity + install */
.net-pill {
  padding: 4px 10px; border-radius: 99px; font-size: 10px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid transparent;
}
.net-pill.on { background: var(--grn-dim); color: var(--grn); border-color: rgba(52,211,153,.3); }
.net-pill.off { background: var(--red-dim); color: var(--red); border-color: rgba(248,119,111,.35); }
.net-pill.pending { background: var(--yel-dim); color: var(--acc2); border-color: rgba(212,169,71,.4); }
.btn-install { border-color: rgba(212,169,71,.4); color: var(--acc2); }
.toast.warn { border-color: rgba(212,169,71,.55); color: var(--acc2); }

/* ------------------------------------------------------ language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--bd); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch .lang-btn {
  padding: 5px 10px; border: none; background: transparent; color: var(--tx3);
  font-size: 11px; font-weight: 800; letter-spacing: .06em; cursor: pointer;
  font-family: var(--sans);
}
.lang-switch .lang-btn:hover { background: var(--sf2); color: var(--tx); }
.lang-switch .lang-btn.active { background: rgba(212, 169, 71, .14); color: var(--acc2); }
/* On the login card the switcher sits above the title, right-aligned. */
#login-lang { display: flex; float: right; margin: -8px -8px 0 0; }

.modal-narrow { width: min(420px, 100%); }
.modal-narrow .field { margin-bottom: 14px; }
.hint { font-size: 11px; margin-top: 5px; }
.legend { font-size: 11px; }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 720px) {
  .topbar { min-height: 62px; padding: 12px 16px; gap: 12px; }
  .brand { font-size: 15px; }
  .brand span.tag { display: none; }
  .nav { width: 66px; padding: 12px 8px; }
  .nav a { text-align: center; font-size: 10.5px; padding: 9px 4px; letter-spacing: .02em; }
  .main { padding: 16px 12px; }
  .grid { grid-template-columns: 1fr; }
  .filters { gap: 8px; padding: 10px; }
  .filters input[type=text] { min-width: 140px; }
  .counterbar { gap: 10px; font-size: 10px; }
  .who .u { font-size: 12px; }
}
