  :root{
    --paper: #F6F1E6;
    --paper-line: #E4DCC8;
    --card: #FFFDF8;
    --ink: #23271F;
    --ink-soft: #5B5E52;
    --sidebar: #22261D;
    --sidebar-text: #D9D6C6;

    --gold: #C9962A;
    --line: #DCD4BE;

    --font-display: "Fraunces", serif;
    --font-mono: "Space Mono", monospace;
    --font-body: "Inter", sans-serif;
  }

  *{ box-sizing: border-box; }
  html{ scroll-behavior: smooth; }

  body{
    margin:0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
  }

  a{ color: inherit; text-decoration: none; }
  button{ font-family: inherit; }

  .page{
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
  }

  /* ---------- SIDEBAR ---------- */
  .sidebar{
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 28px 20px 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
  }

  .brand{
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 22px;
    color: #F6F1E6;
    letter-spacing: 0.2px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
  }
  .brand .dot-brand{ color: var(--gold); }
  .brand-sub{
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8A8A72;
    margin-bottom: 36px;
  }

  nav.tabs{
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .tab{
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #C7C4B2;
    position: relative;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
  }
  .tab .glyph{
    width: 18px;
    text-align: center;
    font-size: 15px;
    opacity: .9;
  }
  .tab:hover{ background: rgba(255,255,255,0.06); color: #F6F1E6; }
  .tab.active{
    background: #2E3325;
    color: #F6F1E6;
  }
  .tab.active::before{
    content: "";
    position: absolute;
    left: -20px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--gold);
    border-radius: 2px;
  }

  .sidebar-foot{
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #363A2C;
  }
  .streak{
    font-family: var(--font-mono);
    font-size: 11px;
    color: #A9A692;
    display:flex;
    align-items:center;
    gap:8px;
  }
  .streak b{ color: #F6F1E6; }

  /* ---------- MAIN ---------- */
  main{
    padding: 44px 56px 80px;
    background-image: repeating-linear-gradient(
      to bottom, transparent 0px, transparent 37px,
      var(--paper-line) 37px, var(--paper-line) 38px
    );
    background-position: 0 128px;
  }

  .top-row{
    display:flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 34px;
  }

  .eyebrow{
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0 0 8px;
  }
  h1.greeting{
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 34px;
    margin: 0;
    line-height: 1.15;
  }
  .greeting .accent{ color: #B5563C; font-style: italic; }
  .top-row p.sub{ margin: 8px 0 0; color: var(--ink-soft); font-size: 14.5px; }

  .date-badge{
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: right;
    color: var(--ink-soft);
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    line-height: 1.5;
    white-space: nowrap;
  }
  .date-badge b{ display:block; color: var(--ink); font-size: 13px; }

  /* ---------- STAT STRIP ---------- */
  .stats{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 34px; }
  .stat-card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
  }
  .stat-card::after{
    content: "";
    position: absolute;
    top: -18px; right: -18px;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--stat-tint, #E4ECE6);
    opacity: .7;
  }
  .stat-card .num{ font-family: var(--font-display); font-size: 30px; font-weight: 600; display: block; position: relative; z-index: 1; }
  .stat-card .label{ font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); position: relative; z-index: 1; }
  .stat-card.c1{ --stat-tint: #E4ECE6; }
  .stat-card.c2{ --stat-tint: #F6E5DF; }
  .stat-card.c3{ --stat-tint: #EBE5F1; }

  /* ---------- GRID / PANELS ---------- */
  .grid{ display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; align-items: start; }
  .panel{ background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px 24px; margin-bottom: 22px; }
  .panel h2{ font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0 0 16px; display:flex; align-items:center; justify-content: space-between; }
  .panel h2 .count{ font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); font-weight: 400; }

  /* ---------- generic subject-colored primitives ---------- */
  .dot{ width:7px; height:7px; border-radius:50%; display:inline-block; background: var(--c, #8A8A72); margin-right:5px; vertical-align:middle; }
  .tag{
    font-family: var(--font-mono);
    font-size: 9.5px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink:0;
    background: var(--c-tint, #eee);
    color: var(--c, #666);
  }
  .bar-fill{ height: 100%; border-radius: 5px; background: var(--c, #8A8A72); transition: width .2s ease; }

  /* ---------- Tasks ---------- */
  .task-add{ display:flex; gap:8px; margin-bottom: 16px; }
  .task-add input[type="text"]{
    flex:1; border: 1px solid var(--line); background: var(--paper); border-radius: 8px;
    padding: 10px 12px; font-size: 13.5px; font-family: var(--font-body); color: var(--ink);
  }
  .task-add input:focus, .subject-select:focus{ outline: 2px solid var(--gold); outline-offset: 1px; }
  .task-add button, .sched-form button{
    background: var(--ink); color: var(--paper); border: none; border-radius: 8px;
    padding: 0 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  }
  .task-add button:hover, .sched-form button:hover{ background: #34392A; }

  .subject-select{
    font-family: var(--font-body); font-size: 13px; border: 1px solid var(--line);
    background: var(--paper); border-radius: 8px; padding: 0 10px; color: var(--ink);
  }

  ul.tasks{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
  .task-item{ display:flex; align-items:center; gap:12px; padding: 10px 4px; border-bottom: 1px dashed var(--line); }
  .task-item:last-child{ border-bottom:none; }
  .checkbox{
    width:18px; height:18px; border: 1.5px solid var(--ink-soft); border-radius: 5px; flex-shrink:0;
    cursor:pointer; display:flex; align-items:center; justify-content:center; font-size: 11px; color: transparent;
    transition: all .12s ease;
  }
  .task-item.done .checkbox{ background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: white; }
  .task-item .text{ flex:1; font-size: 14px; color: var(--ink); }
  .task-item.done .text{ color: var(--ink-soft); text-decoration: line-through; }
  .task-item .del{ opacity:0; background:none; border:none; color: var(--ink-soft); cursor:pointer; font-size: 15px; line-height:1; padding: 2px 4px; }
  .task-item:hover .del{ opacity: 1; }
  .empty-note{ font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); padding: 12px 4px; }

  /* ---------- Filter / subject chips ---------- */
  .filter-row{ display:flex; gap:8px; margin-bottom: 18px; flex-wrap: wrap; }
  .filter-pill{
    font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card);
    color: var(--ink-soft); cursor: pointer;
  }
  .filter-pill.active{ background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .subject-chip{
    font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.03em;
    padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--c, var(--line));
    color: var(--c, var(--ink-soft)); background: var(--card); cursor: pointer;
  }
  .subject-chip.active{ background: var(--c, var(--ink)); color: #fff; }

  /* ---------- Progress ---------- */
  .progress-row{ margin-bottom: 14px; }
  .progress-row:last-child{ margin-bottom: 0; }
  .progress-row .meta{ display:flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
  .pct-readout{
    font-family: var(--font-mono); color: var(--ink-soft); font-size: 13px;
  }
  .bar-track{ height: 8px; background: var(--paper-line); border-radius: 5px; overflow: hidden; }

  /* ---------- Now block / schedule ---------- */
  .now-block{ border-left: 3px solid var(--gold); background: #FBF3E0; padding: 12px 14px; border-radius: 0 8px 8px 0; margin-bottom: 18px; }
  .now-block .now-eyebrow{ font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #9A7517; margin-bottom: 3px; }
  .now-block .now-title{ font-size: 14.5px; font-weight: 600; }
  .schedule-list{ display:flex; flex-direction:column; gap:0; }
  .sched-row{ display:flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; align-items: baseline; }
  .sched-row:last-child{ border-bottom: none; }
  .sched-row .time{ font-family: var(--font-mono); color: var(--ink-soft); width: 62px; flex-shrink:0; }
  .sched-row .what b{ font-weight: 600; }

  /* ---------- sticky quick-note (dashboard only) ---------- */
  .sticky{
    background: #F3ECC9; border: 1px solid #E2D8A3; border-radius: 3px; padding: 16px 18px;
    transform: rotate(-0.6deg); box-shadow: 0 6px 14px -8px rgba(0,0,0,0.35);
    font-family: var(--font-display); font-size: 14.5px; line-height: 1.5; color: #4A4322; position: relative;
  }
  .sticky textarea{
    width:100%; background:transparent; border:none; resize:none; font-family: var(--font-display);
    font-size: 14.5px; line-height: 1.5; color: #4A4322; min-height: 70px;
  }
  .sticky textarea:focus{ outline:none; }
  .sticky .pin{ position:absolute; top:-6px; left: 20px; width:12px; height:12px; border-radius:50%; background: #B5563C; box-shadow: 0 2px 3px rgba(0,0,0,0.3); }

  footer.foot{ margin-top: 30px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); text-align: center; }

  /* ---------- Sub-page headers ---------- */
  .page-head{ margin-bottom: 28px; }
  .page-head h1{ font-family: var(--font-display); font-weight: 600; font-size: 28px; margin: 0 0 6px; }
  .page-head p{ margin:0; color: var(--ink-soft); font-size: 14px; }

  /* ---------- Schedule form/rows ---------- */
  .sched-form{ display:grid; grid-template-columns: 120px 160px 1fr auto; gap: 8px; margin-bottom: 20px; }
  .sched-form input[type="time"], .sched-form input[type="text"]{
    border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 9px 10px;
    font-size: 13px; font-family: var(--font-body); color: var(--ink); width: 100%;
  }
  .full-sched-row{ display:flex; align-items:center; gap: 14px; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
  .full-sched-row:last-child{ border-bottom:none; }
  .full-sched-row.is-now{ background: #FBF3E0; border-radius: 8px; padding: 12px 10px; border-bottom: none; }
  .full-sched-row .time{ font-family: var(--font-mono); color: var(--ink-soft); width: 78px; flex-shrink:0; }
  .full-sched-row .what{ flex:1; font-size: 14px; }
  .full-sched-row .del{ background:none; border:none; color: var(--ink-soft); cursor:pointer; font-size:15px; opacity:0; }
  .full-sched-row:hover .del{ opacity:1; }

  /* ---------- Timer ---------- */
  .timer-wrap{ display:flex; flex-direction:column; align-items:center; padding: 20px 0 10px; }
  .timer-dial{ position: relative; width: 260px; height: 260px; margin-bottom: 22px; }
  .timer-dial svg{ width:100%; height:100%; transform: rotate(-90deg); }
  .timer-dial .track{ fill:none; stroke: var(--paper-line); stroke-width: 10; }
  .timer-dial .fill{ fill:none; stroke: #B5563C; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.3s linear, stroke .3s ease; }
  .timer-readout{ position:absolute; top:0; left:0; width:100%; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; }
  .timer-time{ font-family: var(--font-display); font-size: 46px; font-weight: 600; }
  .timer-mode{ font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-top: 6px; }
  .timer-controls{ display:flex; gap: 10px; margin-bottom: 20px; }
  .timer-btn{
    font-family: var(--font-body); font-weight: 600; font-size: 13.5px; padding: 11px 22px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  }
  .timer-btn.primary{ background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .timer-btn.primary:hover{ background: #34392A; }
  .duration-row{ display:flex; gap:16px; align-items:center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); flex-wrap: wrap; justify-content: center; margin-bottom: 6px; }
  .duration-row label{ display:flex; align-items:center; gap:6px; }
  .duration-row input[type="number"]{
    width: 54px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px;
    padding: 5px 8px; font-family: var(--font-mono); color: var(--ink);
  }
  .session-log{ margin-top: 22px; width: 100%; }
  .log-row{ display:flex; justify-content: space-between; align-items:center; font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .log-row:last-child{ border-bottom:none; }
  .log-row .mins{ font-family: var(--font-mono); color: var(--ink-soft); }

  /* ---------- Notes ---------- */
  .notes-grid{ display:grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .note-card{
    background: #F3ECC9; border: 1px solid #E2D8A3; border-radius: 3px; padding: 14px 16px 12px;
    box-shadow: 0 6px 14px -8px rgba(0,0,0,0.35); position: relative; min-height: 150px; display:flex; flex-direction:column;
  }
  .note-card .pin{ position:absolute; top:-6px; left:18px; width:12px; height:12px; border-radius:50%; background: var(--c, #B5563C); box-shadow: 0 2px 3px rgba(0,0,0,0.3); }
  .note-card select.subject-select{ font-size: 10.5px; padding: 3px 6px; margin-bottom: 8px; align-self: flex-start; }
  .note-card textarea{ flex:1; width:100%; background:transparent; border:none; resize:none; font-family: var(--font-display); font-size: 14px; line-height: 1.5; color: #4A4322; }
  .note-card textarea:focus{ outline:none; }
  .note-card .note-foot{ display:flex; justify-content: space-between; align-items:center; margin-top: 8px; }
  .note-card .note-time{ font-family: var(--font-mono); font-size: 10px; color: #8A7F4E; }
  .note-card .note-del{ background:none; border:none; color:#8A7F4E; cursor:pointer; font-size:13px; }
  .add-note-btn{
    border: 1.5px dashed var(--line); border-radius: 3px; min-height: 150px; display:flex; align-items:center;
    justify-content:center; color: var(--ink-soft); font-family: var(--font-mono); font-size: 12px; cursor:pointer; background: transparent;
  }
  .add-note-btn:hover{ border-color: var(--gold); color: var(--ink); }

  /* ---------- Subjects manager ---------- */
  .subject-add-form{ display:flex; gap:10px; margin-bottom: 20px; flex-wrap: wrap; align-items:center; }
  .subject-add-form input[type="text"]{
    flex:1; min-width: 160px; border: 1px solid var(--line); background: var(--paper); border-radius: 8px;
    padding: 10px 12px; font-size: 13.5px; font-family: var(--font-body); color: var(--ink);
  }
  .swatch-row{ display:flex; gap:6px; }
  .swatch{
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent;
    background: var(--c);
  }
  .swatch.selected{ border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
  .subject-row{
    display:flex; align-items:center; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--line);
  }
  .subject-row:last-child{ border-bottom:none; }
  .subject-row .swatch-static{ width:16px; height:16px; border-radius:50%; background: var(--c); flex-shrink:0; }
  .subject-row .name{ flex:1; font-size: 14.5px; font-weight: 500; cursor: text; }
  .subject-row .rename-hint{ font-family: var(--font-mono); font-size: 10px; color: var(--ink-soft); }
  .subject-row .del{ background:none; border:none; color: var(--ink-soft); cursor:pointer; font-size: 13px; }
  .subject-row .del:hover{ color: #B5563C; }
  .reset-link{ font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; background:none; border:none; padding:0; }

  @media (max-width: 900px){
    .page{ grid-template-columns: 1fr; }
    .sidebar{ position: relative; height:auto; flex-direction: row; align-items:center; padding: 14px 18px; overflow-x:auto; }
    .sidebar-foot{ display:none; }
    nav.tabs{ flex-direction: row; }
    .brand-sub{ display:none; }
    .brand{ margin-bottom:0; }
    main{ padding: 28px 20px 60px; }
    .grid{ grid-template-columns: 1fr; }
    .stats{ grid-template-columns: 1fr 1fr; }
    .top-row{ flex-direction: column; gap: 14px; }
    .sched-form{ grid-template-columns: 1fr 1fr; }
    .notes-grid{ grid-template-columns: 1fr; }
    .credits-grid{ grid-template-columns: 1fr; }
  }

  /* ---------- Credits ---------- */
  .credits-grid{ display:grid; grid-template-columns: repeat(2, 1fr); gap:18px; margin-bottom: 22px; }
  .credit-card{ background: var(--card); border:1px solid var(--line); border-radius:14px; padding:28px 22px; text-align:center; }
  .credit-avatar{
    width:60px; height:60px; border-radius:50%; margin:0 auto 14px; display:flex; align-items:center; justify-content:center;
    font-family: var(--font-display); font-size:20px; font-weight:600; color:#fff;
  }
  .credit-name{ font-family: var(--font-display); font-size:18px; font-weight:600; margin-bottom:4px; }
  .credit-role{ font-family: var(--font-mono); font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; color: var(--ink-soft); }

  /* ---------- Guide / how-to-use ---------- */
  .guide-steps{ list-style:none; margin:0; padding:0; counter-reset: guide-step; }
  .guide-steps li{
    counter-increment: guide-step;
    display:grid; grid-template-columns: 34px 1fr; gap:14px;
    padding: 16px 0; border-bottom: 1px solid var(--line);
  }
  .guide-steps li:last-child{ border-bottom:none; padding-bottom:4px; }
  .guide-steps li::before{
    content: counter(guide-step);
    width:34px; height:34px; border-radius:50%; background: var(--ink); color: var(--paper);
    display:flex; align-items:center; justify-content:center; font-family: var(--font-mono); font-size:13px; font-weight:700;
  }
  .guide-steps h3{ font-family: var(--font-display); font-size:15.5px; font-weight:600; margin:0 0 4px; }
  .guide-steps p{ font-size:13.5px; color: var(--ink-soft); line-height:1.6; margin:0; }

  .guide-tips{ list-style:none; margin:0; padding:0; display:grid; gap:10px; }
  .guide-tips li{
    display:flex; gap:10px; align-items:flex-start; font-size:13.5px; color: var(--ink-soft); line-height:1.6;
  }
  .guide-tips li::before{ content:"\2726"; color: var(--gold); flex-shrink:0; margin-top:1px; }
  .guide-steps p a, footer.foot a{ color:#B5563C; text-decoration: underline; font-weight:600; }