:root {
  --ink: #17251f;
  --muted: #68756f;
  --paper: #f5f3ec;
  --card: #fffef9;
  --line: #dcded5;
  --green: #1e5b46;
  --green-dark: #154332;
  --sage: #dce8df;
  --gold: #e1ac4b;
  --rose: #a64b43;
  --shadow: 0 10px 30px rgba(25, 43, 35, .07);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header { min-height: 78px; padding: 12px clamp(18px, 4vw, 64px); display: flex; align-items: center; gap: clamp(24px, 5vw, 70px); background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); min-width: max-content; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 13px; background: var(--green); color: #fff; font-family: Georgia, serif; font-size: 24px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-mark.large { width: 64px; height: 64px; border-radius: 20px; font-size: 36px; }
.brand span:last-child { display: flex; flex-direction: column; line-height: 1.08; }
.brand strong { font-family: Georgia, serif; font-size: 20px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
nav { display: flex; align-items: center; gap: 30px; flex: 1; }
nav a, .account-menu a, .link-button { color: #47544e; font-size: 14px; font-weight: 650; }
nav a:hover, .account-menu a:hover, .link-button:hover { color: var(--green); }
.account-menu { display: flex; align-items: center; gap: 18px; }
.account-menu form { margin: 0; }
.link-button { border: 0; background: none; padding: 0; cursor: pointer; }

.page-shell { width: min(1280px, calc(100% - 36px)); margin: 0 auto; padding: 50px 0 70px; min-height: calc(100vh - 134px); }
.login-shell { min-height: calc(100vh - 54px); display: grid; place-items: center; padding: 32px 18px; background: radial-gradient(circle at 20% 15%, #e5eee6 0, transparent 35%), radial-gradient(circle at 85% 80%, #efe5cd 0, transparent 38%), var(--paper); }
footer { min-height: 54px; padding: 16px 24px; display: flex; justify-content: center; gap: 9px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 34px; }
.page-heading.compact { align-items: center; }
.page-heading h1 { margin: 4px 0 8px; font: 700 clamp(30px, 4vw, 48px)/1.06 Georgia, serif; letter-spacing: -.025em; }
.page-heading.compact h1 { font-size: clamp(29px, 3vw, 40px); }
.page-heading p:not(.eyebrow) { color: var(--muted); margin: 0; font-size: 16px; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 10px 17px; border: 1px solid var(--green); border-radius: 11px; background: var(--green); color: #fff; font-weight: 750; font-size: 14px; cursor: pointer; }
.button:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.button.secondary { background: transparent; color: var(--green); border-color: #a9bbb1; }
.button.secondary:hover { background: var(--sage); }
.button.danger { border-color: #d9aaa5; background: transparent; color: var(--rose); }
.button.danger:hover { background: #f8e9e7; }
.button.full { width: 100%; }
.button.icon-button { width: 43px; padding: 0; font-size: 19px; }
.push-right { margin-left: auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.notice { margin-bottom: 24px; padding: 13px 16px; background: #dcebdd; border: 1px solid #aecab2; color: #21482e; border-radius: 11px; font-weight: 650; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 4px 0 0; font: 700 24px/1.1 Georgia, serif; }
.section-heading > a { font-size: 13px; font-weight: 750; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 20px 22px; background: #eceee8; border-radius: 15px; display: grid; grid-template-columns: 1fr auto; align-items: end; border: 1px solid transparent; }
.stat-card.accent { background: var(--green); color: #fff; }
.stat-card span { grid-column: 1; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { grid-column: 2; grid-row: 1 / span 2; font: 700 38px/1 Georgia, serif; }
.stat-card small { grid-column: 1; color: var(--muted); margin-top: 5px; }
.stat-card.accent small { color: #d4e6dc; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.dashboard-grid > .card { padding: 26px; }
.dashboard-grid .span-two { grid-column: 1; }
.dashboard-grid > .card:nth-child(2) { grid-column: 2; grid-row: 1 / span 2; }
.item-list { display: grid; }
.item-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 15px; align-items: center; padding: 15px 0; color: var(--ink); border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; padding-top: 3px; }
.item-row:hover { color: var(--ink); }
.date-tile { width: 50px; height: 53px; border-radius: 12px; display: grid; place-items: center; align-content: center; background: var(--sage); line-height: 1; }
.date-tile small { font-size: 10px; font-weight: 850; text-transform: uppercase; }
.date-tile strong { font: 700 22px/1.1 Georgia, serif; }
.date-tile.overdue { background: #f5dedb; color: #873b35; }
.item-main { min-width: 0; display: flex; flex-direction: column; }
.item-main .meta, .item-main small { color: var(--muted); font-size: 12px; }
.item-main strong { font-size: 16px; margin: 2px 0 4px; }
.item-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #eceee8; color: #53615a; font-size: 11px; font-weight: 750; }
.study-stack { display: grid; gap: 10px; }
.study-stack > a { padding: 15px; border-radius: 13px; background: #f1f1eb; color: var(--ink); display: flex; align-items: flex-start; gap: 11px; }
.subject-dot { width: 9px; height: 9px; background: var(--gold); border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }
.study-stack span:last-child { display: flex; flex-direction: column; min-width: 0; }
.study-stack small, .study-card small { color: var(--green); font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.study-stack strong { margin: 2px 0 5px; }
.study-stack em { font-style: normal; color: var(--muted); font-size: 12px; }
.compact-list { display: grid; }
.compact-list > a { display: grid; grid-template-columns: 85px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); color: var(--ink); }
.compact-list > a:first-child { border-top: 0; }
.compact-list span:not(.type-badge) { display: flex; flex-direction: column; }
.compact-list small { color: var(--muted); font-size: 11px; }
.compact-list strong { font-size: 14px; }
.type-badge { display: inline-flex; width: max-content; padding: 4px 8px; border-radius: 6px; background: #e8eae5; color: #4e5b55; font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.type-test, .type-quiz { background: #f5e2c1; color: #7a5114; }
.type-project { background: #e5def1; color: #5a427a; }
.type-assignment { background: #dce9e1; color: #285b43; }
.empty-inline { min-height: 110px; padding: 24px; border-radius: 12px; display: grid; place-items: center; align-content: center; text-align: center; background: #f3f2ec; color: var(--muted); }
.empty-inline strong { color: var(--ink); }

.calendar { overflow: hidden; }
.weekday-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { background: var(--green); color: #fff; }
.weekday-row span { padding: 12px; text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.calendar-day { position: relative; min-height: 145px; padding: 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.muted { background: #f1f0eb; color: #9ca29f; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--gold); }
.day-number { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.day-number span { width: 26px; height: 26px; display: grid; place-items: center; font-weight: 750; font-size: 12px; }
.today .day-number span { background: var(--green); color: #fff; border-radius: 50%; }
.day-number small { color: var(--green); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.calendar-entry { display: block; margin-bottom: 5px; padding: 6px 7px; border-radius: 7px; background: #e5e8e1; color: var(--ink); font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-entry small { margin-right: 5px; opacity: .7; font-size: 8px; text-transform: uppercase; }
.calendar-entry.study { background: #f4e4bd; }
.calendar-entry.type-test, .calendar-entry.type-quiz { background: #f2d5cf; color: #6d322d; }
.calendar-entry.type-assignment { background: #dbe8df; }
.calendar-entry.type-project { background: #e6def0; }
.day-add { position: absolute; right: 8px; bottom: 7px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #829088; font-weight: 800; opacity: 0; }
.calendar-day:hover .day-add, .day-add:focus { opacity: 1; background: var(--sage); }

.filter-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; width: max-content; max-width: 100%; border-radius: 12px; background: #e7e8e2; }
.filter-tabs a { padding: 8px 14px; border-radius: 9px; color: #55615c; font-size: 13px; font-weight: 750; }
.filter-tabs a.active { background: var(--card); color: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.table-card { overflow: hidden; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 16px; background: #edeee9; color: #606d67; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .09em; }
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
tbody tr:first-child td { border-top: 0; }
td > strong, td > small { display: block; }
td > small { color: var(--muted); margin-top: 3px; }
td .type-badge + strong { margin-top: 6px; }
.clamp { display: -webkit-box; max-width: 340px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); }
.text-link { font-weight: 800; }

.editor { width: min(840px, 100%); padding: clamp(22px, 4vw, 36px); }
.editor.narrow { width: min(620px, 100%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-two { grid-column: span 2; }
.field label { font-size: 12px; font-weight: 800; color: #405049; }
.field input, .field select, .field textarea, .login-form input { width: 100%; border: 1px solid #bdc5c0; border-radius: 10px; background: #fff; padding: 11px 12px; color: var(--ink); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .login-form input:focus { outline: 3px solid rgba(30,91,70,.15); border-color: var(--green); }
.field small { color: var(--muted); font-size: 11px; }
.field-error, .validation-summary { color: var(--rose); font-size: 12px; }
.validation-summary:empty, .field-error:empty { display: none; }
.validation-summary ul { margin: 0 0 20px; padding-left: 20px; }
.grade-box { margin: 28px 0 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #f4f3ed; }
.grade-box legend { padding: 0 8px; font-weight: 800; }
.grade-box legend span { color: var(--muted); font-size: 11px; font-weight: 500; }
.grade-fields { display: flex; align-items: center; gap: 14px; }
.grade-fields .field { max-width: 170px; }
.grade-fields > span { padding-top: 24px; color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 28px; }

.timeline { display: grid; gap: 34px; }
.week-group { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; }
.week-label { display: flex; flex-direction: column; padding-top: 13px; }
.week-label small { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; }
.week-label strong { margin-top: 3px; font-family: Georgia, serif; }
.week-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.study-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: flex-start; gap: 12px; padding: 20px; color: var(--ink); }
.study-card:hover { color: var(--ink); border-color: #b7c9be; }
.study-card span:nth-child(2) { display: flex; flex-direction: column; }
.study-card strong { margin: 4px 0 6px; font-size: 16px; }
.study-card p { margin: 0; color: var(--muted); font-size: 12px; }
.edit-arrow { color: var(--green); font-weight: 800; }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state h1, .empty-state h2 { margin: 4px 0 8px; font-family: Georgia, serif; }
.empty-state p { color: var(--muted); margin: 0 0 20px; }
.narrow-card { width: min(620px, 100%); margin: 40px auto; }
.center-actions { display: flex; justify-content: center; gap: 10px; }

.login-card { width: min(900px, 100%); min-height: 500px; display: grid; grid-template-columns: 1.2fr 1fr; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 30px 70px rgba(25,43,35,.12); }
.login-intro { padding: clamp(36px, 6vw, 70px); display: flex; flex-direction: column; justify-content: center; background: linear-gradient(145deg, #e1ece3, #f5ead1); }
.login-intro .eyebrow { margin-top: 26px; }
.login-intro h1 { margin: 9px 0 18px; font: 700 clamp(34px, 5vw, 54px)/1.02 Georgia, serif; letter-spacing: -.035em; }
.login-intro > p:last-child { color: #59685f; max-width: 420px; }
.login-form { padding: clamp(32px, 5vw, 54px); display: flex; flex-direction: column; justify-content: center; }
.login-form h2 { margin: 0 0 24px; font: 700 28px Georgia, serif; }
.login-form > label:not(.check-row) { margin: 13px 0 6px; font-size: 12px; font-weight: 800; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 16px 0 20px; color: var(--muted); font-size: 13px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--green); }

@media (max-width: 980px) {
  .site-header { flex-wrap: wrap; gap: 13px 24px; }
  nav { order: 3; flex-basis: 100%; gap: 20px; overflow-x: auto; padding: 4px 0; }
  .account-menu { margin-left: auto; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .span-two, .dashboard-grid > .card:nth-child(2) { grid-column: 1; grid-row: auto; }
  .calendar-day { min-height: 120px; padding: 7px; }
  .calendar-entry { padding: 5px; }
  .calendar-entry small { display: none; }
}

@media (max-width: 720px) {
  .site-header { position: static; }
  .brand { flex: 1; }
  .account-menu a { display: none; }
  .page-shell { width: min(100% - 24px, 1280px); padding-top: 30px; }
  .page-heading, .page-heading.compact { align-items: flex-start; flex-direction: column; gap: 18px; }
  .heading-actions { justify-content: flex-start; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 15px 18px; }
  .dashboard-grid > .card { padding: 20px; }
  .item-row { grid-template-columns: 48px minmax(0, 1fr); }
  .item-row .status-pill { grid-column: 2; width: max-content; }
  .compact-list > a { grid-template-columns: 70px minmax(0, 1fr); }
  .compact-list .type-badge { display: none; }
  .calendar { box-shadow: none; background: transparent; border: 0; overflow-x: auto; }
  .weekday-row, .calendar-grid { min-width: 760px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span-two { grid-column: 1; }
  .form-actions { flex-wrap: wrap; }
  .push-right { margin-left: 0; }
  .week-group { grid-template-columns: 1fr; gap: 10px; }
  .week-cards { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-intro { padding: 34px; }
  .login-intro h1 { font-size: 38px; }
  .login-form { padding: 34px; }
  .responsive-table table, .responsive-table thead, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tr { padding: 12px 16px; border-top: 1px solid var(--line); }
  .responsive-table tr:first-child { border-top: 0; }
  .responsive-table td { border: 0; padding: 6px 0 6px 105px; position: relative; min-height: 30px; }
  .responsive-table td::before { content: attr(data-label); position: absolute; left: 0; color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
  .responsive-table td:last-child { padding-left: 0; text-align: right; }
  .clamp { max-width: none; }
}
