/* TutorNest: a warm, calm look for parents, pupils and tutors */
@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url(/fonts/nunito-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url(/fonts/nunito-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url(/fonts/nunito-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url(/fonts/nunito-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 600; font-display: swap; src: url(/fonts/fraunces-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 700; font-display: swap; src: url(/fonts/fraunces-latin-700-normal.woff2) format('woff2'); }

:root {
  --ink: #1D2B3A;
  --ink-2: #4A5A6B;
  --muted: #7A8796;
  --paper: #FBF8F3;
  --card: #FFFFFF;
  --line: #E8E1D6;
  --line-2: #F1ECE4;
  --nest: #C9853A;
  --nest-soft: #FBF0E1;
  --leaf: #2E7D6B;
  --leaf-dark: #23614F;
  --leaf-soft: #E3F1EC;
  --coral: #E05A47;
  --coral-soft: #FCE9E5;
  --sky: #3B6E8F;
  --sky-soft: #E6EFF5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 43, 58, .06), 0 6px 20px rgba(29, 43, 58, .06);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; font-family: var(--font); font-weight: 800; }
a { color: var(--leaf); }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- Buttons and fields ---------- */
.btn { font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 9px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #D3C9BA; background: #FFFDF9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn.primary:hover { background: var(--leaf-dark); }
.btn.danger { color: var(--coral); }
.btn.danger.solid { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 13px 22px; font-size: 17px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--leaf); font-weight: 700; cursor: pointer; }
label.field, .field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > span:first-child { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(46, 125, 107, .25); outline-offset: 1px; border-color: var(--leaf); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--leaf); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; cursor: pointer; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 700; font-size: 13px; }
.days label:has(input:checked) { background: var(--leaf); color: #fff; border-color: var(--leaf); }
.days input { display: none; }
.error { color: var(--coral); font-weight: 700; font-size: 14px; min-height: 1em; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 21px; color: var(--ink); text-decoration: none; }
.brand svg { flex: none; }

/* ---------- App frame ---------- */
.frame { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #DCE3EA; padding: 22px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; padding: 0 8px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: #C8D2DC; text-decoration: none; font-weight: 700; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--nest); }
.nav .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8495A6; padding: 12px 12px 4px; font-weight: 800; }
.side .who { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 13px; }
.side .who strong { color: #fff; display: block; }
.main { padding: 28px 34px 60px; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.top .sub { color: var(--muted); margin: 0; }
.mobile-top { display: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 30px; font-weight: 600; }
.stat span { color: var(--muted); font-weight: 700; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 800; background: var(--line-2); color: var(--ink-2); }
.pill.live { background: var(--coral); color: #fff; }
.pill.ok { background: var(--leaf-soft); color: var(--leaf-dark); }
.pill.warn { background: var(--nest-soft); color: #8A5A1F; }
.pill.off { background: var(--coral-soft); color: #A33A2B; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------- Lists and tables ---------- */
table.list { width: 100%; border-collapse: separate; border-spacing: 0; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 12px; font-weight: 800; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 260px; }
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty svg { opacity: .7; margin-bottom: 8px; }

/* ---------- Lessons ---------- */
.lesson { display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.lesson .bar { align-self: stretch; border-radius: 6px; }
.lesson .when { font-weight: 800; }
.lesson .what { font-weight: 700; }
.lesson.cancelled { opacity: .55; }
.lesson.cancelled .what { text-decoration: line-through; }
.lessons { display: grid; gap: 10px; }
.next-hero { background: linear-gradient(135deg, #24394E, #1D2B3A); color: #fff; border: 0; padding: 26px; border-radius: 18px; position: relative; overflow: hidden; }
.next-hero h2 { color: #fff; font-size: 26px; }
.next-hero .muted { color: #B9C6D3; }
.next-hero .nest-art { position: absolute; right: -10px; bottom: -18px; opacity: .14; }

/* ---------- Week timetable ---------- */
.week { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: auto; }
.week .head { position: sticky; top: 0; background: #fff; z-index: 2; padding: 10px 8px; border-bottom: 1px solid var(--line); font-weight: 800; font-size: 13px; text-align: center; }
.week .head.today { color: var(--leaf); }
.week .head small { display: block; color: var(--muted); font-weight: 700; }
.week .hours { position: relative; border-right: 1px solid var(--line); }
.week .hours div { position: absolute; right: 6px; font-size: 11px; color: var(--muted); transform: translateY(-7px); }
.week .hours div:first-child { transform: translateY(2px); }
.week .col { position: relative; border-right: 1px solid var(--line-2); }
.week .col:last-child { border-right: 0; }
.week .col.today { background: #FFFCF6; }
.week .slot { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 5px 7px; font-size: 12px; color: #fff; overflow: hidden; cursor: pointer; line-height: 1.25; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); border: 0; text-align: left; font: inherit; font-size: 12px; }
.week .slot b { display: block; font-weight: 800; }
.week .slot.cancelled { opacity: .45; text-decoration: line-through; }
.week .gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line-2); }
.week .now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--coral); z-index: 1; }

/* ---------- Dialogs ---------- */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); color: var(--ink); }
dialog::backdrop { background: rgba(20, 30, 40, .45); }
dialog form, dialog .body { padding: 24px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
dialog h2 { margin-bottom: 14px; }
.creds { background: var(--nest-soft); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.creds div { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: #fff; border-radius: 10px; padding: 10px 12px; }
.creds code { font-size: 15px; font-weight: 800; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 100; box-shadow: var(--shadow); max-width: calc(100vw - 30px); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art .brand { color: #fff; }
.login .art h1 { font-size: 40px; color: #fff; max-width: 460px; }
.login .art p { color: #B9C6D3; max-width: 420px; font-size: 17px; }
.login .art .subjects { display: flex; flex-wrap: wrap; gap: 8px; }
.login .art .subjects span { border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 5px 13px; font-weight: 700; font-size: 13px; color: #E4EAF0; }
.login .art .big-nest { position: absolute; right: -60px; bottom: 40px; opacity: .12; }
.login .panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login form { width: min(380px, 100%); }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; color: var(--muted); padding: 6px; }

@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-102%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
  .main { padding: 18px 16px 50px; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px 22px; min-height: auto; }
  .login .art h1 { font-size: 28px; }
  .login .art .big-nest { display: none; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list td { border: 0; padding: 4px 4px; }
  .lesson { grid-template-columns: 6px 1fr; }
  .lesson > :last-child { grid-column: 2; }
}
