/* =====================================================================
   A2+ DESIGN — SITE REPORT
   css/app.css

   The colour tokens, font and radii are taken unchanged from Project
   Timeline, so the two apps look like one family. Nothing new was
   invented here.
   ===================================================================== */

:root {
  --bg:        #D1CCC5;
  --surface:   #FAF8F5;
  --surface-2: #EFEBE4;
  --option-panel: #F2F0EC;
  --action-panel: #E5E1DB;
  --line:      #E8E3DC;
  --line-2:    #CCC5BB;
  --divider:   #D8D1C8;
  --ink:       #1D1815;
  --ink-2:     #5F564C;
  --ink-3:     #948A7D;

  --accent:      #0E6E70;
  --accent-ink:  #FFFFFF;
  --accent-soft: #D8EAE9;

  --gold:      #A2761A;
  --gold-soft: #F3E7CD;
  --coral:     #C24429;
  --coral-soft:#F8E1DB;
  --green:     #3F8B33;
  --green-soft:#E2EFD8;
  --magenta:   #E8368F;

  --band-int:  #6C5A50;
  --band-lan:  #435E55;

  --urgent:   #C42A21;  --urgent-s:  #FBE3E0;
  --overdue:  #D97316;  --overdue-s: #FBEAD8;
  --chip:      rgba(29,24,21,.075);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tap: 44px;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg:        #0C0B0B;
  --surface:   #1E1B18;
  --surface-2: #26221F;
  --option-panel: #292622;
  --action-panel: #302D29;
  --line:      #302B26;
  --line-2:    #463F38;
  --divider:   #403933;
  --ink:       #F2EDE7;
  --ink-2:     #B6ABA0;
  --ink-3:     #857B70;

  --accent:      #3FBFBB;
  --accent-ink:  #0E1F1F;
  --accent-soft: #123634;

  --gold:      #DDB367;
  --gold-soft: #3A2E19;
  --coral:     #E4795C;
  --coral-soft:#3B211A;
  --green:     #6FBF5E;
  --green-soft:#1E3018;

  --band-int:  #4A3E37;
  --band-lan:  #2E413B;

  --urgent:   #E4675C;  --urgent-s:  #3A1C18;
  --overdue:  #E39448;  --overdue-s: #3A2716;
  --chip:      rgba(242,237,231,.075);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100dvh; }
.hidden { display: none !important; }

/* ----------------------------------------------------------- wordmark */

.wordmark { font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.wordmark .lite { font-weight: 300; }
.wordmark .plus { color: var(--magenta); font-weight: 700; padding: 0 1px; }
.wordmark .bold { font-weight: 700; }
.wordmark.lg { font-size: 22px; }

/* -------------------------------------------------------------- login */

.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  text-align: center;
}

.app-name {
  margin: 6px 0 22px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.login-fields { text-align: left; display: grid; gap: 14px; }

.field { display: grid; gap: 6px; }
.field > span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.err { color: var(--urgent); font-size: 13px; margin: 2px 0 0; min-height: 18px; }

/* ------------------------------------------------------------ buttons */

.btn {
  min-height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--urgent); border-color: var(--urgent); background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:active { background: var(--chip); }

/* ---------------------------------------------------------- masthead */

.mast {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-top, 0px));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.mast .wordmark { font-size: 15px; justify-self: start; }
.mast-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.mast-right { justify-self: end; display: flex; gap: 2px; }

/* ------------------------------------------------------------- views */

.view {
  padding: 14px 14px calc(84px + env(safe-area-inset-bottom, 0px));
  max-width: 720px;
  margin: 0 auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 34px;
}
.bar-date { font-size: 15px; font-weight: 600; }
.bar-count { font-size: 13px; color: var(--ink-2); }

.section-head {
  margin: 26px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.list { display: grid; gap: 8px; }

.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}

/* -------------------------------------------------------------- rows */

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.row:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.row-end { display: flex; align-items: center; gap: 8px; flex: none; }

.chip {
  display: inline-block;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.done    { background: var(--green-soft);  color: var(--green); }
.chip.pending { background: var(--gold-soft);   color: var(--gold); }
.chip.late    { background: var(--urgent-s);    color: var(--urgent); }
.chip.grade   { background: var(--accent-soft); color: var(--accent); }

.alert {
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13.5px;
  background: var(--overdue-s);
  color: var(--overdue);
  border: 1px solid var(--overdue);
  border-radius: 12px;
}
.alert b { font-weight: 600; }

/* ------------------------------------------------------------ toggle */

.switch {
  position: relative;
  width: 46px; height: 27px;
  flex: none;
  background: var(--line-2);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 21px; height: 21px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(19px); }

/* ------------------------------------------------------------- tabbar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--accent); }

/* -------------------------------------------------------------- sheet */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,.42);
}
.sheet-root.open { display: flex; }

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 620px) {
  .sheet-root { align-items: center; }
  .sheet { border-radius: 18px; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

.form-grid { display: grid; gap: 13px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 420px) { .form-2 { grid-template-columns: 1fr; } }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.sheet-actions .btn { flex: 1; }

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--tap);
}
.check-row span {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* -------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 14px);
  z-index: 60;
  max-width: 88vw;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--accent-ink);
  background: var(--ink);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
