/* LRC Task Tracker — mobile-first styles (Section 12 "Visual style", P8, NFR-13, NFR-14) */

:root {
  --navy: #1F3A5F;
  --red: #C62828;
  --orange: #E67E22;
  --bg: #FFFFFF;
  --surface: #F5F7FA;
  --text: #1A1A1A;
  --muted: #5B6573;
  --border: #DDE2E8;
  --topbar: #FFFFFF;
  --accent: var(--navy);
  --warn-bg: #FFF4C2;
  --warn-text: #5C4A00;
  --orange-text: #A84E00;   /* orange that keeps AA contrast as text */
  --grey-head: #5B6573;

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: 17px;
  --bs-primary: #1F3A5F;
  --bs-primary-rgb: 31, 58, 95;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1720;
    --surface: #1A2430;
    --text: #E8EDF2;
    --muted: #A3AFBD;
    --border: #2C3947;
    --topbar: #0F1720;
    --accent: #8FB3E0;
    --red: #EF6B6B;
    --orange-text: #F0A055;
    --warn-bg: #3D3410;
    --warn-text: #FCE58A;
    --grey-head: #A3AFBD;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--bs-body-font-family);
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
}
a { color: var(--accent); }
[hidden] { display: none !important; }
.text-red { color: var(--red) !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: 56px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 4px 0 12px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}
.tb-title { flex: 1; margin: 0 0 0 4px; font-size: 1.25rem; font-weight: 700; }
.tb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); font-size: 1.35rem; text-decoration: none;
}
.tb-btn:active { background: var(--surface); }
.tb-search { display: none; flex: 1; }
.tb-search .form-control { height: 44px; font-size: 17px; border-radius: 999px; background: var(--surface); color: var(--text); border-color: var(--border); }
.topbar.searching .tb-title { display: none; }
.topbar.searching .tb-search { display: block; }

.content { max-width: 720px; margin: 0 auto; padding: 12px 16px 120px; }
.content-form { padding-bottom: 140px; }

/* Status lines and hints */
.status-line {
  background: var(--warn-bg); color: var(--warn-text);
  font-size: 15px; padding: 8px 12px; border-radius: 10px; margin-bottom: 8px;
}
.status-line .link-btn { color: inherit; font-weight: 600; text-decoration: underline; padding: 0; min-height: 0; font-size: 15px; }
.offline-line { background: var(--warn-bg); color: var(--warn-text); font-size: 15px; padding: 8px 16px; text-align: center; }
.hint-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 52px 14px 14px; margin-bottom: 12px;
}
.hint-card p { margin: 0 0 8px; }
.hint-close { position: absolute; top: 4px; right: 4px; width: 48px; height: 48px; border: 0; background: transparent; color: var(--muted); }
.push-blocked { display: block; color: var(--red); font-size: 15px; margin-top: 4px; }

/* Groups */
.group { margin-top: 16px; }
.group-head {
  font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  margin: 0 0 8px; display: flex; align-items: center; gap: 8px;
}
.group-count {
  font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: var(--surface); color: inherit;
}
.g-earlier { color: var(--red); }
.g-today { color: var(--orange-text); }
.g-tomorrow { color: var(--accent); }
.g-later { color: var(--grey-head); }

/* Task card */
.task-card {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  background: var(--surface); border-radius: 12px;
  padding: 10px 6px 10px 14px; margin-bottom: 8px;
  transition: opacity .2s, transform .2s;
}
.task-card.leaving { opacity: 0; transform: translateX(30px); }
.task-body { flex: 1; min-width: 0; }
.task-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 17px; line-height: 1.35;
}
.task-title.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 12px; }
.task-title .star { color: var(--orange); margin-right: 2px; }
.task-meta { margin-top: 3px; font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 6px; align-items: center; }
.officer-link { position: relative; z-index: 2; color: var(--accent); text-decoration: none; font-weight: 500; padding: 4px 0; }
.officer-link:hover { text-decoration: underline; }
.badge-reassign { font-size: 13px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge-reassign.is-red { border-color: var(--red); color: var(--red); }
.task-actions { position: relative; z-index: 2; display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn {
  width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: transparent; color: var(--accent); font-size: 1.4rem;
}
.icon-btn:active { background: var(--border); }
.btn-pill { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; }

.empty { text-align: center; color: var(--muted); margin: 48px 16px; }
.show-done { text-align: center; margin: 32px 0 0; }
.show-done a { display: inline-block; padding: 12px; }

.filter-chip-row { margin: 4px 0 8px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; background: var(--navy); color: #fff; text-decoration: none; font-weight: 500;
}

/* Floating button */
.fab {
  position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 30;
  height: 56px; min-width: 56px; padding: 0 16px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: #fff; text-decoration: none; font-size: 1.6rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.fab-label { display: none; font-size: 17px; font-weight: 600; }
@media (min-width: 600px) { .fab-label { display: inline; } .fab { padding: 0 22px 0 18px; } }

/* Forms */
.field { margin-bottom: 18px; }
.field-label { display: block; font-weight: 600; margin: 0 0 6px; font-size: 16px; }
.input-lg, .form-control.input-lg {
  font-size: 17px; min-height: 52px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,58,95,.25); background: var(--bg); color: var(--text); }
.form-control::placeholder { color: var(--muted); opacity: 1; }
textarea.autogrow { resize: none; overflow: hidden; }
.field-error { color: var(--red); font-size: 15px; margin: 6px 0 0; }
.link-btn {
  background: none; border: 0; padding: 12px 0; min-height: 48px; color: var(--accent);
  font-weight: 600; font-size: 17px; text-decoration: none; display: inline-flex; align-items: center;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; min-height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 500; display: inline-flex; align-items: center; margin: 0; cursor: pointer;
}
.chip.selected { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-pick { overflow: hidden; }
.chips-days { margin-top: 8px; }
.chip-day { padding: 0 14px; color: var(--muted); }
.chip-day.selected { color: #fff; }
.date-hidden {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  border: 0; padding: 0; margin: 0;
}

.switch-lg { display: flex; align-items: center; gap: 12px; padding-left: 0; min-height: 48px; }
.switch-lg .form-check-input { width: 3.2em; height: 1.7em; margin: 0; float: none; cursor: pointer; }
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }
.btn-primary { --bs-btn-bg: #1F3A5F; --bs-btn-border-color: #1F3A5F; --bs-btn-hover-bg: #172d4a; --bs-btn-hover-border-color: #172d4a; --bs-btn-active-bg: #12233a; --bs-btn-disabled-bg: #8a99ad; --bs-btn-disabled-border-color: #8a99ad; }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #1F3A5F; --bs-btn-hover-border-color: #1F3A5F; --bs-btn-active-bg: #1F3A5F; }
.btn-lg { min-height: 52px; border-radius: 12px; font-size: 17px; font-weight: 600; }

.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
}
.save-bar .btn { max-width: 688px; display: block; margin: 0 auto; }

/* Bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 720px; margin: 0 auto; max-height: 90vh; overflow-y: auto;
  background: var(--bg); border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.sheet-handle { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 12px; }
.sheet-title { font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-sub { color: var(--muted); margin: 2px 0 14px; }
.sheet .field-label { margin-top: 10px; }

/* Toast */
.toast-pill {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(88px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px); width: max-content;
  display: flex; align-items: center; gap: 16px;
  background: #222B36; color: #fff; border-radius: 999px; padding: 6px 8px 6px 20px; min-height: 48px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); font-size: 16px;
}
.toast-undo { background: none; border: 0; color: #9CC3FF; font-weight: 700; min-height: 40px; padding: 0 12px; font-size: 16px; }

/* Task screen */
.status-pill { display: inline-block; padding: 2px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.task-head { display: flex; align-items: flex-start; gap: 8px; }
.task-big-title { flex: 1; font-size: 1.45rem; font-weight: 700; margin: 4px 0 6px; line-height: 1.3; word-break: break-word; }
.star-toggle { color: var(--muted); }
.star-toggle.is-on { color: var(--orange); }
.task-officer { margin: 0 0 4px; font-size: 17px; }
.task-ref, .task-note { margin: 0 0 6px; color: var(--muted); word-break: break-word; }
.facts { background: var(--surface); border-radius: 12px; padding: 4px 14px; margin: 14px 0; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font-weight: 500; color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.task-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.task-buttons .btn { flex: 1 1 140px; }
.section-title { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 28px 0 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--border); position: relative; font-size: 16px; word-break: break-word; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 17px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); }
.note-form { display: flex; gap: 8px; margin-top: 16px; align-items: flex-end; }
.note-form .btn { width: 52px; flex-shrink: 0; padding: 0; }
.edit-block { margin-bottom: 8px; }
.edit-block .field-label { margin-top: 10px; }
.edit-actions { display: flex; gap: 10px; margin-top: 12px; }
.edit-actions .btn { flex: 1; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 4px; top: 50px; z-index: 50; min-width: 180px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
  padding: 4px 0;
}
.menu-item { display: block; width: 100%; text-align: left; min-height: 48px; padding: 0 16px; border: 0; background: transparent; color: var(--text); font-size: 17px; }
.menu-item:active { background: var(--surface); }

/* Settings */
.settings-list { list-style: none; padding: 0; margin: 0; }
.settings-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.settings-list label { margin: 0; }
.setting-input { width: auto; min-width: 130px; min-height: 48px; font-size: 17px; border-radius: 12px; background: var(--bg); color: var(--text); border-color: var(--border); }
.setting-sub { color: var(--muted); font-size: 15px; }
.footer-note { color: var(--muted); font-size: 14px; text-align: center; margin-top: 32px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
