/* ============================================================
   LittleLibrary — Design System v2
   ============================================================
   Background    #F5F0E8  warm cream
   Sidebar       #1A1A18  near-black
   Surface       #FFFFFF
   Text          #1A1A18
   Muted         #6B6B63
   Border        #DDD8CE
   Danger        #C93030

   Section colours (set via --section-color on each page):
     Activity Log    #E8593C  coral
     Evidence Vault  #4B9B7A  teal
     Correspondence  #7F77DD  purple
     Reports         #E8A030  amber
     Settings        #378ADD  blue
     Library         #C4703A  burnt sienna  (light tint #FAF0E8 · dark text #7A3E1A)

   Typography: 400 regular · 500 medium only
   Flat: no gradients, no drop shadows
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --section-color: #1A1A18;
  --bg:            #F5F0E8;
  --sidebar:       #1A1A18;
  --surface:       #FFFFFF;
  --text:          #1A1A18;
  --muted:         #6B6B63;
  --border:        #DDD8CE;
  --border-light:  #EDE8E0;
  --danger:        #C93030;
  --radius:        8px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Auth pages ─────────────────────────────────────────────── */

.auth-split {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* Left decorative panel */
.auth-panel {
  display: none;
  flex: 1;
  background: var(--sidebar);
  color: #fff;
  padding: 3rem;
  flex-direction: column;
  justify-content: center;
}
@media (min-width: 780px) { .auth-panel { display: flex; } }

.auth-panel-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 3rem;
  opacity: 0.95;
}
.auth-panel-logo small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 0.1rem;
}
.auth-panel h2 {
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 1rem;
}
.auth-panel p {
  opacity: 0.8;
  font-size: 0.96rem;
  line-height: 1.75;
  max-width: 340px;
}
.auth-panel-list {
  list-style: none;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-panel-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  font-size: 0.93rem;
  opacity: 0.88;
}
.auth-panel-list li .icon-wrap {
  flex-shrink: 0;
  margin-top: 0.1rem;
  opacity: 0.75;
}
.step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 500;
}

/* Right form panel */
.auth-form-side {
  flex: 0 0 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--bg);
}
@media (max-width: 779px) { .auth-form-side { flex: 1; } }

.auth-card { width: 100%; max-width: 400px; }

.auth-header { margin-bottom: 2rem; }
.auth-header .logo-mark {
  width: 40px; height: 40px;
  background: var(--sidebar);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 1rem;
}
.auth-header h1 {
  font-size: 1.65rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.auth-header .tagline {
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: 0.35rem;
}

.auth-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.auth-alt-link {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.auth-alt-link a {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border);
}
.auth-alt-link a:hover { text-decoration-color: var(--text); }

.forgot-link {
  display: block;
  text-align: right;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 0.4rem;
}
.forgot-link:hover { color: var(--text); text-decoration: underline; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 1.25rem;
}
.back-link:hover { color: var(--text); }

/* Auth success state */
.success-state {
  text-align: center;
  padding: 0.5rem 0;
}
.success-state .s-icon {
  width: 48px; height: 48px;
  background: #E8F4EE;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3A7D5A;
  margin: 0 auto 1rem;
}
.success-state h2 {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.success-state p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
.email-highlight {
  display: inline-block;
  background: var(--border-light);
  color: var(--text);
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 0.1rem 0;
}

/* ── Forms ──────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.1rem; }

label {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.93rem;
  font-weight: 400;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
  font-family: inherit;
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.6rem; }
.pw-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #888780;
  display: flex;
  align-items: center;
  line-height: 1;
  transition: color 0.15s;
  touch-action: manipulation;
}
.pw-toggle:hover,
.pw-toggle:focus-visible { color: #1A1A18; outline: none; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--section-color);
}
textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ── Buttons ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary {
  background: var(--section-color);
  color: #fff;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-outline {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--section-color); color: var(--section-color); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }

.btn-ghost {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--section-color); color: var(--section-color); }

.btn-ghost-danger {
  background: none;
  border: 1.5px solid #F5C0C0;
  color: var(--danger);
}
.btn-ghost-danger:hover { background: #FEF2F2; border-color: var(--danger); }

.btn-full  { width: 100%; }
.btn-sm    { padding: 0.3rem 0.75rem; font-size: 0.8rem; border-radius: 5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Feedback messages ──────────────────────────────────────── */

.msg {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.86rem;
  margin-bottom: 1rem;
  display: none;
  font-weight: 400;
}
.msg.error   { background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; display: block; }
.msg.success { background: #F0FDF4; color: #2D6A4F;       border: 1px solid #BBF7D0; display: block; }

/* ── App shell ──────────────────────────────────────────────── */

.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo-mark {
  flex-shrink: 0;
  color: rgba(255,255,255,0.9);
}
.sidebar-logo-text {
  min-width: 0;
}
.sidebar-logo-name {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.sidebar-logo-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.5;
  margin-top: 0.05rem;
  white-space: nowrap;
}

nav { flex: 1; padding: 0.75rem 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.nav-icon  { flex-shrink: 0; display: flex; align-items: center; }
.nav-label { white-space: nowrap; }

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
}
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--section-color);
  font-weight: 500;
}

/* Per-link colour overrides — Learning Atlas (moss green) & My Philosophy (warm rose) */
.nav-link[href="atlas.html"]:hover { background: #EAF3DE; color: #173404; }
.nav-link[href="atlas.html"]:hover .nav-icon { color: #5A7A3A; }
.nav-link[href="atlas.html"].active { border-left-color: #5A7A3A; }
.nav-link[href="atlas.html"].active .nav-icon { color: #5A7A3A; }
.nav-link[href="philosophy.html"]:hover { background: #FBEAF0; color: #4B1528; }
.nav-link[href="philosophy.html"]:hover .nav-icon { color: #D4537E; }
.nav-link[href="philosophy.html"].active { border-left-color: #D4537E; }
.nav-link[href="philosophy.html"].active .nav-icon { color: #D4537E; }
.nav-link[href="timeline.html"]:hover { background: #FBF5E0; color: #6B5A0A; }
.nav-link[href="timeline.html"]:hover .nav-icon { color: #C4A832; }
.nav-link[href="timeline.html"].active { border-left-color: #C4A832; }
.nav-link[href="timeline.html"].active .nav-icon { color: #C4A832; }

/* Sidebar footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 500;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 0.7rem;
  opacity: 0.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout-btn {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.7);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.sidebar-logout-btn:hover {
  background: rgba(255,255,255,0.13);
  color: #fff;
}

/* ── Main content ────────────────────────────────────────────── */

.main-content { flex: 1; padding: 2rem 2.25rem; overflow-y: auto; }

.page-header { margin-bottom: 1.75rem; }
.page-header h2 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.page-header h2 .page-icon {
  color: var(--section-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.page-header p { color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }

/* ── Cards ──────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card.accent-top {
  border-top: 3px solid var(--section-color);
}

.form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.form-card-header h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

/* ── Stat grid (dashboard) ──────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.25rem 1.4rem 1.1rem;
  border-left: 3px solid var(--border);
}
/* Per-section accent colours on dashboard stat cards */
.stat-card.activities { border-left-color: #E8593C; }
.stat-card.evidence   { border-left-color: #4B9B7A; }
.stat-card.letters    { border-left-color: #7F77DD; }
.stat-card.days       { border-left-color: #E8A030; }

.stat-icon {
  display: flex;
  align-items: center;
  margin-bottom: 0.6rem;
}
.stat-card.activities .stat-icon { color: #E8593C; }
.stat-card.evidence   .stat-icon { color: #4B9B7A; }
.stat-card.letters    .stat-icon { color: #7F77DD; }
.stat-card.days       .stat-icon { color: #E8A030; }

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  margin-top: 0.25rem;
}
.stat-sublabel {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Days warning colours */
.days-ok   .stat-value { color: var(--text); }
.days-warn .stat-value { color: #9A6500; }
.days-warn { border-left-color: #E8A030 !important; }
.days-late .stat-value { color: var(--danger); }
.days-late { border-left-color: var(--danger) !important; }

/* ── Section header ─────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h3 { font-size: 1rem; font-weight: 500; color: var(--text); }
.section-header a  {
  font-size: 0.83rem;
  color: var(--section-color);
  text-decoration: none;
  font-weight: 500;
}
.section-header a:hover { text-decoration: underline; }

/* ── Alert/notice banners ───────────────────────────────────── */

.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.86rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}
.alert-info {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}
.alert-notice {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #78350F;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.86rem;
  line-height: 1.6;
}
.alert-notice strong { font-weight: 500; }

.reassurance-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.reassurance-banner .banner-icon {
  flex-shrink: 0;
  color: var(--section-color);
  display: flex;
  align-items: center;
  margin-top: 0.1rem;
}
.reassurance-banner p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* ── Subject checkboxes ─────────────────────────────────────── */

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem 0.75rem;
}
@media (max-width: 480px) { .subjects-grid { grid-template-columns: repeat(2, 1fr); } }

.subject-checkbox {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.86rem;
  color: var(--text);
  user-select: none;
}
.subject-checkbox input[type="checkbox"] {
  width: 15px !important;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--section-color);
  cursor: pointer;
  padding: 0 !important;
  border: none !important;
}

/* ── Subject badges ─────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  line-height: 1.5;
  white-space: nowrap;
}
.badge-maths     { background: #DBEAFE; color: #1E40AF; }
.badge-english   { background: #DCFCE7; color: #166534; }
.badge-science   { background: #F3E8FF; color: #6B21A8; }
.badge-history   { background: #FEF3C7; color: #92400E; }
.badge-geography { background: #CFFAFE; color: #155E75; }
.badge-art       { background: #FCE7F3; color: #9D174D; }
.badge-music     { background: #EDE9FE; color: #4C1D95; }
.badge-pe        { background: #FFEDD5; color: #9A3412; }
.badge-other     { background: var(--border-light); color: var(--muted); }

/* ── Entry list cards (activity, correspondence) ────────────── */

.entry-card,
.corr-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.entry-date-block {
  flex-shrink: 0;
  text-align: center;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  min-width: 50px;
  border: 1px solid var(--border-light);
}
.entry-date-block .eday   {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--section-color);
  line-height: 1;
}
.entry-date-block .emonth {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}
.entry-date-block .eyear  { font-size: 0.65rem; color: var(--muted); margin-top: 0.05rem; }

.entry-body,
.corr-body { flex: 1; min-width: 0; }

.entry-meta,
.corr-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.child-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 0.12rem 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.entry-desc {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-notes {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-style: italic;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}
.entry-actions,
.corr-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Correspondence-specific ────────────────────────────────── */

.corr-subject {
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.corr-notes {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sender-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.18rem 0.55rem;
  border-radius: 99px;
  white-space: nowrap;
}
.sender-la     { background: #FEF3C7; color: #92400E; }
.sender-school { background: #DBEAFE; color: #1E40AF; }
.sender-ofsted { background: #FCE7F3; color: #9D174D; }
.sender-other  { background: var(--border-light); color: var(--muted); }

/* ── Editing notice ─────────────────────────────────────────── */

.editing-notice {
  display: none;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.84rem;
  color: #78350F;
  margin-bottom: 1.1rem;
  align-items: center;
  gap: 0.5rem;
}
.editing-notice.show { display: flex; }

/* ── Empty state ────────────────────────────────────────────── */

.empty-state {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 3rem 2rem;
  text-align: center;
}
.empty-state .empty-icon {
  width: 48px; height: 48px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--section-color);
  margin: 0 auto 1rem;
}
.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.55rem;
}
.empty-state p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 400px;
  margin: 0 auto 1.25rem;
}

/* ── Drop zone (evidence upload) ────────────────────────────── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--section-color);
  background: var(--surface);
}
.drop-zone .drop-icon  {
  display: flex;
  justify-content: center;
  margin-bottom: 0.65rem;
  color: var(--muted);
}
.drop-zone .drop-text  { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.25rem; }
.drop-zone .drop-text button {
  background: none; border: none; color: var(--section-color);
  font-weight: 500; cursor: pointer; font-size: inherit; padding: 0;
  font-family: inherit;
}
.drop-zone .drop-text button:hover { text-decoration: underline; }
.drop-zone .drop-hint  { font-size: 0.76rem; color: var(--muted); opacity: 0.7; }

.selected-file-strip {
  display: none;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 3px solid var(--section-color);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem;
  margin-top: 0.75rem;
  font-size: 0.86rem;
  color: var(--text);
}
.selected-file-strip.show { display: flex; }
.selected-file-strip .file-icon { flex-shrink: 0; color: var(--section-color); display: flex; align-items: center; }
.selected-file-strip .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.selected-file-strip .clear-file {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; line-height: 1; padding: 0; flex-shrink: 0;
}
.selected-file-strip .clear-file:hover { color: var(--danger); }

/* Upload progress */
.upload-progress { display: none; margin-top: 0.75rem; }
.upload-progress.show { display: block; }
.progress-bar-track {
  background: var(--border);
  border-radius: 99px;
  height: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--section-color);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}
.progress-label { font-size: 0.76rem; color: var(--muted); margin-top: 0.3rem; text-align: center; }

/* File attach button (correspondence) */
.file-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: 100%;
  justify-content: center;
  font-family: inherit;
}
.file-attach-btn:hover { border-color: var(--section-color); color: var(--section-color); background: var(--surface); }

.current-attachment {
  display: none;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color);
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font-size: 0.84rem;
  color: var(--text);
  margin-top: 0.5rem;
}
.current-attachment.show { display: flex; }
.current-attachment .att-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.current-attachment .att-remove {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem; padding: 0; flex-shrink: 0;
}
.current-attachment .att-remove:hover { color: var(--danger); }

/* ── Evidence grid ──────────────────────────────────────────── */

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}
.evidence-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--section-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.evidence-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.evidence-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdf-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--danger);
}
.pdf-thumb .pdf-icon-big { font-size: 2.5rem; line-height: 1; display: flex; align-items: center; }
.pdf-thumb .pdf-label   { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em; color: var(--danger); }
.evidence-info { padding: 0.85rem 1rem 0.5rem; flex: 1; }
.evidence-desc {
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.evidence-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.evidence-actions {
  padding: 0.6rem 1rem 0.85rem;
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--border-light);
}

/* ── Reports page ───────────────────────────────────────────── */

.generate-hero {
  background: var(--section-color);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  color: #fff;
  margin-bottom: 2rem;
}
.generate-hero h3 { font-size: 1.35rem; font-weight: 500; margin-bottom: 0.5rem; }
.generate-hero p {
  opacity: 0.85;
  font-size: 0.93rem;
  margin-bottom: 1.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.btn-hero {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.7rem 1.75rem;
  border-radius: 6px;
  font-weight: 500;
  border: 1.5px solid rgba(255,255,255,0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-hero:hover { background: rgba(255,255,255,0.25); }

.spinner-wrap { text-align: center; padding: 2.5rem 1rem; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--section-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-wrap p { color: var(--muted); font-size: 0.9rem; }

.report-preview-card { margin-bottom: 2rem; }
.report-textarea {
  width: 100%;
  min-height: 380px;
  padding: 1.1rem 1.25rem;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.95rem;
  line-height: 1.8;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}
.report-textarea:focus { outline: none; border-color: var(--section-color); }
.report-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.1rem; }
.report-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

.saved-report-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid var(--section-color);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.saved-report-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.1s;
  flex-wrap: wrap;
}
.saved-report-header:hover { background: var(--bg); }
.saved-report-meta { flex: 1; min-width: 0; }
.saved-report-title { font-size: 0.93rem; font-weight: 500; color: var(--text); }
.saved-report-sub   { font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; }
.saved-report-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.saved-report-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border-light);
}
.saved-report-body.open { display: block; }
.saved-report-text {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  margin-top: 1rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.5rem;
}
.saved-report-text::-webkit-scrollbar { width: 4px; }
.saved-report-text::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Settings page ──────────────────────────────────────────── */

.settings-section { margin-bottom: 2rem; }
.settings-section-title {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.75rem;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.settings-row-sub   { font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; }
.settings-row-value { font-size: 0.88rem; color: var(--muted); }

.inline-edit { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.inline-edit input {
  padding: 0.4rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  width: 200px;
}
.inline-edit input:focus { outline: none; border-color: var(--section-color); }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 0.75rem; }
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--section-color); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle-status { font-size: 0.8rem; color: var(--muted); min-width: 24px; }

/* Child list */
.child-list { margin-bottom: 1.1rem; }
.child-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}
.child-item:last-child { border-bottom: none; }
.child-info { flex: 1; min-width: 0; }
.child-name { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.child-dob  { font-size: 0.78rem; color: var(--muted); margin-top: 0.1rem; }

.add-child-form {
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}
.add-child-form h4 {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.password-form {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
  margin-top: 0.5rem;
  display: none;
}
.password-form.open { display: block; }

/* Dashboard activity cards */
.activity-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 3px solid #E8593C;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.activity-date-block {
  flex-shrink: 0;
  text-align: center;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  min-width: 50px;
  border: 1px solid var(--border-light);
}
.activity-date-block .day   { font-size: 1.25rem; font-weight: 500; color: #E8593C; line-height: 1; }
.activity-date-block .month { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }
.activity-body { flex: 1; min-width: 0; }
.activity-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.activity-desc {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.subject-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.subject-pill {
  font-size: 0.7rem;
  background: var(--bg);
  color: var(--muted);
  padding: 0.12rem 0.45rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.filter-bar label { font-size: 0.83rem; color: var(--muted); white-space: nowrap; }
.filter-bar select {
  padding: 0.4rem 0.7rem;
  font-size: 0.83rem;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: auto;
}
.filter-bar select:focus { outline: none; border-color: var(--section-color); }

.entry-count,
.file-count { font-size: 0.83rem; color: var(--muted); margin-bottom: 1rem; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.25rem; flex-wrap: wrap; }

/* Password hint */
.password-hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }

/* Setup notice */
.setup-notice {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.86rem;
  color: #78350F;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.setup-notice strong { font-weight: 500; }
.setup-notice code {
  background: rgba(0,0,0,0.07);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
  font-family: monospace;
}

/* Print */
@media print {
  .sidebar, .page-header, #generate-hero, #gen-form-wrap,
  .section-header, .saved-reports-section, .report-actions,
  .report-hint { display: none !important; }
  .main-content { padding: 0 !important; }
  .report-preview-card { border: none !important; }
  #report-textarea { border: none !important; min-height: unset !important; font-size: 12pt !important; }
  #print-header { display: block !important; }
}

/* ── Sidebar overlay backdrop ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

/* ── Mobile hamburger (injected into sidebar by mobile-sidebar.js) ── */
.mobile-menu-btn {
  display: none;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  padding: 1.1rem 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: color 0.15s;
}
.mobile-menu-btn:hover { color: #fff; }

/* ── Mobile logout button (injected into .page-header by mobile-sidebar.js) ── */
.mobile-logout-btn {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #F5F0E8;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.mobile-logout-btn:hover { opacity: 0.7; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Collapsed sidebar — icon only */
  .sidebar { width: 54px; }
  .sidebar-logo,
  .nav-label,
  .sidebar-footer { display: none; }
  .nav-link { justify-content: center; padding: 0.8rem; border-left: none; }
  .nav-link.active { background: rgba(255,255,255,0.12); border-radius: 0; }
  .main-content { padding: 1.25rem; }

  /* Hamburger visible */
  .mobile-menu-btn { display: flex; }

  /* Sidebar fully open — driven by JS adding .mobile-open */
  .sidebar.mobile-open {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 240px;
    z-index: 150;
    overflow-y: auto;
  }
  .sidebar.mobile-open .sidebar-logo   { display: flex; }
  .sidebar.mobile-open .nav-label      { display: inline; }
  .sidebar.mobile-open .sidebar-footer { display: block; }
  .sidebar.mobile-open .nav-link {
    justify-content: flex-start;
    padding: 0.6rem 1.25rem;
    border-left: 3px solid transparent;
  }
  .sidebar.mobile-open .nav-link.active {
    border-left-color: var(--section-color);
    border-radius: 0;
  }
  .sidebar.mobile-open .mobile-menu-btn { display: none; }

  /* Mobile logout in page header */
  .mobile-logout-btn { display: flex; }
  .page-header { position: relative; padding-right: 52px; }
}
