/* ==========================================================================
   Teacher Planner Online — application design system
   Professional SaaS · teal identity · no purple · light + dark
   ========================================================================== */
:root {
  /* Brand */
  --teal:        #0E7C6B;
  --teal-600:    #0A6B5C;
  --teal-700:    #085247;
  --teal-wash:   #E4F0ED;
  --amber:       #C77A3A;
  --amber-wash:  #F6EADE;
  --red:         #C4483B;
  --red-wash:    #F6E4E1;
  --green:       #2F9E6B;
  --blue:        #2C6E9E;

  /* Neutrals — slight green bias, chosen not defaulted */
  --paper:       #F4F6F5;
  --surface:     #FFFFFF;
  --surface-2:   #FAFBFA;
  --ink:         #16221F;
  --ink-2:       #46544E;
  --ink-3:       #6E7A74;
  --line:        #E4E7E4;
  --line-2:      #EEF1EF;

  --shadow-sm: 0 1px 2px rgba(16,34,31,.05);
  --shadow-md: 0 4px 12px rgba(16,34,31,.08);
  --shadow-lg: 0 12px 32px rgba(16,34,31,.12);

  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --sidebar-w: 244px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --pill-urgent-bg: var(--red-wash);   --pill-urgent-fg: var(--red);
  --pill-important-bg: var(--amber-wash); --pill-important-fg: var(--amber);
  --pill-low-bg: var(--teal-wash);     --pill-low-fg: var(--teal-600);
}
:root[data-theme="dark"], html.dark {
  --teal: #35A392; --teal-600: #57BCAB; --teal-700: #6FC7B7; --teal-wash: #16302B;
  --amber: #DFA067; --amber-wash: #2E2417; --red: #E07B6F; --red-wash: #33201D;
  --green: #4FB587; --blue: #5C93BE;
  --paper: #0E1413; --surface: #172120; --surface-2: #131C1B;
  --ink: #ECEFED; --ink-2: #AEB8B3; --ink-3: #7E8983;
  --line: #29332F; --line-2: #212a27;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --pill-low-fg: #6FC7B7;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--teal-wash); }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px;
  font-weight: 800; letter-spacing: -.02em; font-size: 1.02rem;
}
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-700) 100%);
  color: #fff; display: grid; place-items: center; font-size: 1rem;
  box-shadow: var(--shadow-sm);
}
.brand small { display: block; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.brand .name span { color: var(--teal); }

.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 550; font-size: .9rem; transition: background .15s, color .15s;
}
.nav a .fa-fw { width: 18px; text-align: center; color: var(--ink-3); transition: color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--teal-wash); color: var(--teal-700); font-weight: 650; }
.nav a.active .fa-fw { color: var(--teal); }
.nav .nav-sep { height: 1px; background: var(--line-2); margin: 8px 12px; }

.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.user-chip .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.user-chip .meta { overflow: hidden; }
.user-chip .meta b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta small { color: var(--ink-3); font-size: .72rem; }
.user-chip .out { margin-left: auto; color: var(--ink-3); background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; }
.user-chip .out:hover { color: var(--red); background: var(--red-wash); }

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 30;
}
.topbar .menu-btn { display: none; }
.topbar .pill-week {
  margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .8rem;
  background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; color: var(--ink-2);
}
.topbar .pill-week b { color: var(--teal-700); }
.topbar .clock { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.view { padding: 28px; max-width: 1240px; width: 100%; margin: 0 auto; }
.view-head { margin-bottom: 22px; }
.view-head .eyebrow { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 750; }
.view-head h1 { font-size: 1.7rem; letter-spacing: -.025em; margin: 4px 0 4px; font-weight: 780; }
.view-head p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.view-head .row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.view-head .row .spacer { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: var(--r-sm);
  font-weight: 600; font-size: .875rem; cursor: pointer; border: 1px solid transparent; transition: all .15s;
  white-space: nowrap;
}
.btn.primary { background: var(--teal); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--teal-600); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--teal); color: var(--teal-700); }
.btn.subtle { background: transparent; color: var(--ink-2); }
.btn.subtle:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--red); border-color: transparent; }
.btn.danger:hover { background: var(--red-wash); }
.btn.sm { padding: 6px 10px; font-size: .8rem; }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px; }
.grid { display: grid; gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 10px; font-size: .95rem; }
.stat .num { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--ink-3); font-size: .82rem; }
.tint-teal  { background: var(--teal-wash);  color: var(--teal-700); }
.tint-amber { background: var(--amber-wash); color: var(--amber); }
.tint-red   { background: var(--red-wash);   color: var(--red); }
.tint-blue  { background: color-mix(in srgb,var(--blue) 14%, transparent); color: var(--blue); }

.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 750; }
.section-title .fa-fw { color: var(--teal); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 650; margin-bottom: 6px; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; transition: border .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-wash); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---------- Pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.urgent { background: var(--pill-urgent-bg); color: var(--pill-urgent-fg); }
.pill.important { background: var(--pill-important-bg); color: var(--pill-important-fg); }
.pill.low { background: var(--pill-low-bg); color: var(--pill-low-fg); }
.pill.overdue { background: var(--red-wash); color: var(--red); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .fa-fw, .empty i { font-size: 1.8rem; color: var(--teal); opacity: .6; margin-bottom: 10px; display: block; }
.empty p { margin: 4px 0 14px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--r-sm); font-size: .85rem;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; animation: toastIn .25s ease;
}
.toast.ok i { color: #6FE0C0; } .toast.err i { color: #ff9a8f; }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Save indicator ---------- */
.saved-ind { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--green); }
.saved-ind.saving { color: var(--ink-3); }

/* ---------- Modal (reuse feature-request styles as base) ---------- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal.active { display: flex; animation: toastIn .2s ease; }
.modal .box { background: var(--surface); color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal .box header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal .box header h3 { margin: 0; font-size: 1.1rem; }
.modal .box .body { padding: 20px; }
.modal .box footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.x { background: none; border: none; font-size: 1.4rem; color: var(--ink-3); cursor: pointer; width: 32px; height: 32px; border-radius: 7px; }
.x:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Utilities ---------- */
.muted { color: var(--ink-3); }
.tabular { font-variant-numeric: tabular-nums; }
.hstack { display: flex; align-items: center; gap: 10px; }
.hstack.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.hide { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); transition: transform .25s; width: 260px; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar .menu-btn { display: inline-flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }
  .scrim.on { display: block; }
}
@media (max-width: 560px) {
  .view { padding: 18px; }
  .row2, .row3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: none; background: transparent; color: var(--ink-2); font-weight: 600; font-size: .82rem; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--teal-700); box-shadow: var(--shadow-sm); }

/* ---------- Checkboxes ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal); }

/* ---------- Dashboard bits ---------- */
.tt-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-left: 3px solid var(--teal); background: var(--surface-2); border-radius: 8px; margin-bottom: 8px; }
.tt-row .p { font-weight: 800; color: var(--teal-700); width: 34px; font-size: .82rem; }
.tt-row .c { flex: 1; } .tt-row .c b { display: block; font-size: .92rem; } .tt-row .c small { color: var(--ink-3); font-size: .76rem; }
.task-mini { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.task-mini:last-child { border-bottom: 0; }
.task-mini .tick { background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 1rem; padding: 2px; }
.task-mini .tick:hover { color: var(--teal); }
.task-mini .t b { font-size: .88rem; font-weight: 600; } .task-mini .meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.ev-mini { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.ev-mini:last-child { border-bottom: 0; }
.ev-mini .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ev-mini b { font-size: .88rem; display: block; } .ev-mini small { color: var(--ink-3); font-size: .76rem; }

/* ---------- Timetable grid ---------- */
table.tt { width: 100%; border-collapse: collapse; min-width: 720px; }
table.tt th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 12px 8px; border-bottom: 1px solid var(--line); }
table.tt th.corner { text-align: left; padding-left: 16px; }
.pcell { font-weight: 800; color: var(--teal-700); font-size: .85rem; padding: 10px 16px; width: 92px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.pcell small { display: block; font-weight: 500; color: var(--ink-3); font-size: .68rem; margin-top: 2px; }
.pcell.brk { color: var(--ink-3); }
.cell { border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 10px; min-height: 58px; cursor: pointer; transition: background .12s; vertical-align: top; margin: 3px; }
td.cell { height: 60px; }
.cell:hover { background: var(--surface-2); }
.cell b { font-size: .84rem; display: block; line-height: 1.25; } .cell small { color: var(--ink-3); font-size: .72rem; }
.cell .add { color: var(--line); font-size: 1.1rem; } .cell:hover .add { color: var(--teal); }
.cell.brk { background: var(--surface-2); cursor: pointer; } .cell .duty { font-size: .82rem; font-weight: 600; color: var(--amber); }
.subj-list { display: flex; flex-direction: column; gap: 8px; }
.subj-row { display: flex; gap: 8px; align-items: center; }
.subj-row input[type=color] { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; flex-shrink: 0; }

/* ---------- Lesson plans ---------- */
.lp-card { margin-bottom: 14px; }
.lp-p { font-weight: 800; color: #fff; background: var(--teal); border-radius: 7px; padding: 3px 9px; font-size: .78rem; }

/* ---------- Term planner ---------- */
.term-week { margin-bottom: 14px; }
.tw-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.tw-head b { font-size: .95rem; } .tw-head small { color: var(--ink-3); font-size: .76rem; }
.tw-days { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.tw-cell { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; min-height: 92px; cursor: pointer; transition: box-shadow .12s; }
.tw-cell:hover { box-shadow: var(--shadow-md); }
.tw-cell.off { background: var(--surface-2); cursor: default; opacity: .7; }
.tw-cell .d { font-weight: 700; font-size: .78rem; margin-bottom: 6px; }
.tw-cell .foc { font-size: .78rem; color: var(--ink-2); line-height: 1.4; }
.tw-cell .add-plan { color: var(--teal); font-size: .78rem; font-weight: 600; display: flex; align-items: center; gap: 5px; opacity: .8; }

/* ---------- Calendar ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 10px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700; text-align: left; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px 7px; cursor: pointer; transition: background .12s; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.pad-cell { background: var(--surface-2); cursor: default; }
.cal-cell.today .dn { background: var(--teal); color: #fff; }
.cal-cell .dn { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 600; margin-bottom: 4px; }
.cal-ev { font-size: .72rem; font-weight: 600; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- To-do ---------- */
.todo-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 10px; }
.todo-row .t { flex: 1; } .todo-row .t b { font-size: .94rem; } .todo-row .meta { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.todo-row .acts { display: flex; gap: 2px; }

/* ---------- Sticky notes ---------- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(230px,1fr)); gap: 16px; }
.note { border-radius: 12px; padding: 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 180px; border: 1px solid rgba(0,0,0,.04); }
.note textarea { background: transparent; border: none; resize: none; font-family: inherit; color: #16221F; width: 100%; }
.note textarea:focus { outline: none; }
.note-title { font-weight: 700; font-size: .95rem; margin-bottom: 6px; }
.note-body { flex: 1; font-size: .86rem; line-height: 1.5; }
.note-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.note .cbtn { background: rgba(0,0,0,.06); border: none; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; color: #16221F; }
.note .cbtn:hover { background: rgba(0,0,0,.12); }

/* Feature-request button sizing inside the app topbar */
.topbar .btn-feature-request { padding: 7px 12px; font-size: .82rem; }
@media (max-width: 640px){ .topbar .btn-feature-request { display: none; } }
