:root {
  --ink: #211b20;
  --ink-soft: #635a61;
  --sidebar: #22171c;
  --sidebar-2: #321f27;
  --wine: #7b2638;
  --wine-2: #9a3347;
  --teal: #24746f;
  --teal-soft: #e5f2f0;
  --gold: #b8872f;
  --gold-soft: #fff5dc;
  --blue: #386f9d;
  --blue-soft: #eaf2f8;
  --red-soft: #fff0f1;
  --surface: #fbfbfa;
  --paper: #ffffff;
  --line: #dedbd7;
  --muted: #f1efed;
  --danger: #aa3642;
  --shadow: 0 14px 30px rgba(39, 27, 33, .08);
  --radius: 8px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--surface);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
select { cursor: pointer; }
svg { display: block; }

.hidden { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 1.1fr) minmax(420px, .9fr);
  background: var(--surface);
}

.auth-visual {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 8vw, 110px);
  color: #fff;
  background:
    linear-gradient(145deg, rgba(123, 38, 56, .94), rgba(34, 23, 28, .98)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.1) 0 1px, transparent 1px 18px);
}

.auth-brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid rgba(241, 204, 126, .55);
  border-radius: 50%;
  color: #f1cc7e;
  font-family: Georgia, serif;
  font-size: 32px;
}

.auth-visual > span {
  color: #f1cc7e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .2em;
}

.auth-visual h1 {
  max-width: 620px;
  margin: 14px 0;
  font-family: Georgia, serif;
  font-size: clamp(40px, 5vw, 68px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-visual p {
  max-width: 580px;
  color: #ebdce1;
  font-size: 14px;
  line-height: 1.7;
}

.auth-points {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  color: #f5e7dc;
  font-size: 11px;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 35px;
}

.auth-panel > div { width: min(440px, 100%); }
.auth-panel h2 { margin: 8px 0; font-family: Georgia, serif; font-size: 35px; font-weight: 500; }
.auth-panel p { margin: 0 0 24px; color: var(--ink-soft); font-size: 12px; }
.auth-panel form { display: grid; gap: 14px; }
.auth-panel input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 13px; outline: 0; background: var(--paper); }
.auth-panel small { display: block; margin-top: 12px; color: var(--ink-soft); font-size: 9px; line-height: 1.5; text-align: center; }
.auth-error { border-radius: var(--radius); padding: 11px 13px; color: #8b3434; background: #ffedeb; font-size: 10px; }

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 252px;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  color: #fff;
  background: linear-gradient(170deg, var(--sidebar-2), var(--sidebar));
  box-shadow: 14px 0 34px rgba(24, 16, 19, .18);
  overflow-y: auto;
  transition: transform .22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  color: #f1cc7e;
  background: rgba(255,255,255,.06);
}

.brand-mark svg {
  width: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  line-height: 1;
  letter-spacing: 0;
}

.brand span {
  display: block;
  margin-top: 5px;
  color: #d7a9b2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
}

.main-nav { display: grid; gap: 5px; }

.nav-item {
  position: relative;
  width: 100%;
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 12px;
  color: #e3d5d9;
  background: transparent;
  text-align: left;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.14); }

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: #efc675;
  background: rgba(255,255,255,.07);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item > span:not(.nav-icon):not(.nav-badge) {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  min-width: 24px;
  margin-left: auto;
  border-radius: 999px;
  padding: 3px 7px;
  color: #2b181d;
  background: #efc675;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.sidebar-bottom {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.exam-mini {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255,255,255,.07);
}

.exam-mini span, .exam-mini small {
  display: block;
  color: #c9b7be;
  font-size: 11px;
}

.exam-mini strong { display: block; margin: 5px 0 12px; font-size: 14px; }

.progress-track {
  height: 5px;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
}

.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #efc675;
}

.main-content {
  min-height: 100vh;
  margin-left: 252px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 34px;
  border-bottom: 1px solid rgba(222, 219, 215, .88);
  background: rgba(251, 251, 250, .92);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  color: var(--wine);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 2.1vw, 32px);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: 0;
}

#view-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.sync-indicator {
  max-width: 160px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.install-button {
  min-height: 38px;
  border: 1px solid var(--wine);
  border-radius: var(--radius);
  padding: 0 13px;
  color: #fff;
  background: var(--wine);
  font-size: 11px;
  font-weight: 800;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 4px;
  background: transparent;
  text-align: left;
}

.profile-button > span:first-child {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--wine);
  font-family: Georgia, serif;
  font-size: 18px;
}

.profile-copy strong, .profile-copy small { display: block; }
.profile-copy strong { font-size: 13px; }
.profile-copy small { margin-top: 2px; color: var(--ink-soft); font-size: 11px; }

.mobile-menu, .icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 20px;
}

.mobile-menu { display: none; }

.view {
  display: none;
  padding: 30px 34px 54px;
  animation: fade-in .22s ease;
}

.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } }

.today-hero {
  position: relative;
  min-height: 248px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 36px 46px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(123, 38, 56, .95), rgba(34, 23, 28, .96)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.12) 0 1px, transparent 1px 16px);
  box-shadow: var(--shadow);
}

.today-hero::after {
  content: "§";
  position: absolute;
  right: 42px;
  bottom: -24px;
  color: rgba(255,255,255,.08);
  font-family: Georgia, serif;
  font-size: 230px;
  line-height: 1;
}

.hero-copy { position: relative; z-index: 2; max-width: 650px; }
.date-pill { color: #f1cc7e; font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.hero-copy h2 { margin: 12px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(32px, 4vw, 50px); font-weight: 400; letter-spacing: 0; }
.hero-copy p { max-width: 590px; margin: 0; color: #ebdce1; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.primary-button, .secondary-button, .timer-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 760;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}

.primary-button {
  border: 1px solid var(--wine);
  color: #fff;
  background: var(--wine);
  box-shadow: 0 7px 16px rgba(123, 38, 56, .18);
}

.today-hero .primary-button { border-color: #f7d58e; color: #25181d; background: #f7d58e; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--paper); }
.today-hero .secondary-button { border-color: rgba(255,255,255,.22); color: #fff; background: rgba(255,255,255,.08); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.full { width: 100%; }

.hero-ring-wrap {
  position: relative;
  z-index: 2;
  min-width: 145px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.hero-ring {
  --progress: 0deg;
  position: relative;
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#f1cc7e var(--progress), rgba(255,255,255,.14) 0);
}

.hero-ring::before {
  content: "";
  position: absolute;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: #321f27;
}

.hero-ring div { position: relative; display: grid; justify-items: center; }
.hero-ring strong { font-family: Georgia, serif; font-size: 28px; font-weight: 400; }
.hero-ring span, .hero-ring-wrap small { color: #e7cbd2; font-size: 11px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.stat-card {
  min-height: 112px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--paper);
}

.stat-card small { grid-column: 2; margin-top: -13px; color: var(--ink-soft); font-size: 10px; }
.stat-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: var(--radius); font-family: Georgia, serif; font-size: 20px; }
.stat-card span { display: block; color: var(--ink-soft); font-size: 11px; }
.stat-card strong { display: block; margin-top: 4px; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.accent-red .stat-icon { color: var(--wine); background: var(--red-soft); }
.accent-teal .stat-icon { color: var(--teal); background: var(--teal-soft); }
.accent-gold .stat-icon { color: var(--gold); background: var(--gold-soft); }
.accent-blue .stat-icon { color: var(--blue); background: var(--blue-soft); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 24px rgba(39, 27, 33, .04);
}

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 18px; }
.study-plan-panel, .focus-panel, .weak-points-panel { padding: 22px; }
.weak-points-panel { margin-top: 18px; }

.panel-header, .calendar-header, .cards-summary, .questions-hero, .piece-hero, .radar-hero, .progress-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-kicker {
  color: #756a70;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .14em;
}

.panel-header h3, .calendar-header h2, .cards-summary h2, .questions-hero h2, .piece-hero h2, .radar-hero h2, .progress-hero h2, .method-hero h2 {
  margin: 5px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.panel-header h3 { font-size: 21px; }
.time-chip { border-radius: 999px; padding: 7px 11px; color: var(--wine); background: var(--red-soft); font-size: 11px; font-weight: 800; }
.text-button, .danger-text { border: 0; padding: 4px; color: var(--wine); background: transparent; font-size: 12px; font-weight: 750; }
.danger-text { color: var(--danger); }

.plan-list { display: grid; gap: 10px; margin-top: 18px; }
.plan-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 13px;
  border: 1px solid #e5e1df;
  border-radius: var(--radius);
  padding: 13px;
  background: #fff;
}

.plan-item.completed { opacity: .64; background: #f5f4f2; }
.plan-item.completed .plan-title { text-decoration: line-through; }
.plan-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--wine); background: var(--red-soft); font-size: 11px; font-weight: 900; }
.plan-title { display: block; font-size: 13px; font-weight: 760; }
.plan-meta { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.plan-check { width: 28px; height: 28px; border: 1px solid #cec9c6; border-radius: 50%; background: #fff; }
.plan-item.completed .plan-check { border-color: var(--wine); color: #fff; background: var(--wine); }

.focus-panel { display: flex; flex-direction: column; }
.timer-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.timer-wide { grid-column: 1 / -1; }
label span, .question-controls label span, .piece-library label span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

input, select, textarea {
  color: var(--ink);
  outline: 0;
}

.timer-field-grid select, .timer-field-grid input,
.section-toolbar > select, .editor-meta select, .editor-meta input,
.settings-panel input, .settings-panel select, .modal form input, .modal form select,
.question-controls select, .piece-library select, .discursive-grid input, #radar-filter, #progress-period {
  width: 100%;
  min-height: 41px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  background: #fff;
  font-size: 12px;
}

.timer-display { margin: 25px 0 15px; font-family: Georgia, serif; font-size: clamp(42px, 5vw, 56px); text-align: center; letter-spacing: 0; }
.timer-presets { display: flex; justify-content: center; gap: 7px; margin-bottom: 14px; }
.timer-presets button { border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; color: var(--ink-soft); background: #fff; font-size: 10px; }
.timer-presets button.active { border-color: var(--wine); color: #fff; background: var(--wine); }
.timer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.timer-button { width: 100%; border: 0; color: #fff; background: var(--wine); }

.weak-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.weak-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; background: #fbfbfa; }
.weak-item span { display: block; color: var(--ink-soft); font-size: 10px; }
.weak-item strong { display: block; margin: 5px 0 10px; font-size: 13px; }
.micro-progress { height: 5px; overflow: hidden; border-radius: 10px; background: #e4dfdc; }
.micro-progress i { display: block; height: 100%; border-radius: inherit; background: var(--wine); }

.section-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.search-box { min-width: 220px; flex: 1; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 13px; background: var(--paper); }
.search-box input { width: 100%; height: 41px; border: 0; outline: 0; background: transparent; color: var(--ink); }

.notes-layout { display: grid; grid-template-columns: minmax(250px, .42fr) minmax(0, 1fr); gap: 18px; }
.notes-list-panel { padding: 18px; }
.notes-list-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.notes-list-heading strong { font-size: 13px; }
.notes-list-heading span { color: var(--ink-soft); font-size: 11px; }
.notes-list { display: grid; gap: 8px; max-height: calc(100vh - 210px); overflow-y: auto; padding-right: 4px; }
.note-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  text-align: left;
}
.note-row.active { border-color: var(--wine); box-shadow: inset 3px 0 0 var(--wine); }
.note-row strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.note-row span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: 10px; }

.note-editor { min-height: 620px; padding: 20px; }
.empty-state { min-height: 460px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; }
.empty-illustration { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; color: var(--wine); background: var(--red-soft); font-family: Georgia, serif; font-size: 36px; }
.empty-state h3 { margin: 8px 0 0; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.empty-state p { max-width: 420px; margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.editor-topline { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.editor-topline .danger-text { margin-left: auto; }
.title-input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 0 12px; background: transparent; font-family: Georgia, serif; font-size: 30px; letter-spacing: 0; }
.editor-meta { display: grid; grid-template-columns: 220px 1fr; gap: 12px; margin: 14px 0; }
.template-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.template-strip span { color: var(--ink-soft); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.template-strip button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: #fff; color: var(--wine); font-size: 10px; font-weight: 800; }
#note-body {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(#fff 31px, #e8e1df 32px);
  background-size: 100% 32px;
  font-size: 15px;
  line-height: 32px;
}
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 18px; color: var(--ink-soft); font-size: 11px; }
.editor-footer > div { display: flex; gap: 8px; }
.note-reader { border-top: 1px solid var(--line); padding-top: 18px; }
.note-reader-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.note-reader-toolbar h3 { margin: 5px 0 0; font-family: Georgia, serif; font-weight: 500; }
.note-reader-toolbar select { min-height: 39px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: #fff; }
.note-reading-output {
  min-height: 145px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  background: #fbfbfa;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.questions-hero, .piece-hero, .radar-hero, .progress-hero, .cards-summary { margin-bottom: 18px; }
.questions-hero p, .piece-hero p, .radar-hero p, .progress-hero p, .cards-summary p, .method-hero p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.questions-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 18px; }
.question-panel, .question-side { padding: 22px; }
.question-controls { display: grid; grid-template-columns: 1fr 180px; gap: 10px; margin-bottom: 18px; }
.question-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fbfbfa; }
.question-card h3 { margin: 0 0 12px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.question-card p { line-height: 1.65; }
.option-list { display: grid; gap: 8px; margin-top: 16px; }
.option-button {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  text-align: left;
}
.option-button span:first-child { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--muted); font-weight: 850; }
.option-button.correct { border-color: #68a884; background: #eef8f2; }
.option-button.wrong { border-color: #c7747b; background: #fff0f1; }
.question-feedback { margin-top: 16px; border-left: 3px solid var(--wine); padding: 10px 12px; background: #fff; font-size: 12px; line-height: 1.55; }

.discipline-bars { display: grid; gap: 12px; margin-top: 18px; }
.discipline-bar-row { display: grid; grid-template-columns: minmax(115px, .45fr) 1fr 44px; align-items: center; gap: 11px; }
.discipline-bar-row strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.discipline-bar-row span { color: var(--ink-soft); font-size: 10px; text-align: right; }
.discipline-track { height: 8px; overflow: hidden; border-radius: 99px; background: #e7e3e0; }
.discipline-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--wine), var(--gold)); }

.cards-actions { display: flex; gap: 8px; }
.compact { margin-top: 0; }
.mini-stat {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
}
.mini-stat span { color: var(--ink-soft); font-size: 11px; }
.mini-stat strong { display: block; margin-top: 8px; font-family: Georgia, serif; font-size: 26px; font-weight: 500; }
.cards-list { display: grid; gap: 10px; padding: 0 20px 20px; }
.card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px 34px;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: #fff;
}
.card-row strong { display: block; margin-bottom: 5px; font-size: 10px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.card-row p { margin: 0; font-size: 12px; line-height: 1.5; }
.card-status { color: var(--ink-soft); font-size: 10px; }
.delete-card { width: 30px; height: 30px; border: 1px solid #e5c7c8; border-radius: 50%; color: var(--danger); background: #fff8f8; }

.piece-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; }
.piece-library, .piece-workbench { padding: 20px; }
.piece-list { display: grid; gap: 8px; margin-top: 16px; }
.piece-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fff; text-align: left; }
.piece-item.active { border-color: var(--wine); box-shadow: inset 3px 0 0 var(--wine); }
.piece-item strong, .piece-item span { display: block; }
.piece-item strong { font-size: 12px; }
.piece-item span { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }
.piece-topline {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.piece-topline span { color: var(--ink-soft); font-size: 11px; }
.piece-topline strong { overflow: hidden; font-family: Georgia, serif; font-size: 23px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
#piece-timer { justify-self: end; color: var(--wine); font-weight: 850; }
.piece-case { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fbfbfa; font-size: 13px; line-height: 1.65; }
#piece-draft {
  width: 100%;
  min-height: 250px;
  margin-top: 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  line-height: 1.55;
}
.rubric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.rubric-check { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; font-size: 12px; }
.rubric-check input { width: 18px; height: 18px; accent-color: var(--wine); }
.discursive-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.piece-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.piece-footer span { font-family: Georgia, serif; font-size: 26px; color: var(--wine); }
.piece-footer > div { display: flex; gap: 8px; }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; }
.calendar-panel, .day-panel { padding: 20px; }
.calendar-actions { display: flex; gap: 8px; align-items: center; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-weekdays { margin: 18px 0 8px; color: var(--ink-soft); font-size: 10px; font-weight: 850; text-align: center; text-transform: uppercase; }
.calendar-day {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: #fff;
  text-align: left;
}
.calendar-day.muted-day { opacity: .42; }
.calendar-day.selected { border-color: var(--wine); box-shadow: inset 0 0 0 1px var(--wine); }
.calendar-day.today { background: #fff8f8; }
.day-number { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 850; }
.day-badges { display: grid; gap: 4px; margin-top: 7px; }
.day-badge { overflow: hidden; border-radius: var(--radius-sm); padding: 4px 6px; color: var(--wine); background: var(--red-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.day-badge.exam { color: #33210a; background: var(--gold-soft); }
.selected-day-content { display: grid; gap: 8px; margin-top: 18px; }
.day-task {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
}
.day-task button { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; background: #fff; }
.day-task.done { opacity: .64; }
.day-task strong { font-size: 12px; }
.day-task span { color: var(--ink-soft); font-size: 10px; }

.radar-panel { padding: 16px; }
.radar-list { display: grid; gap: 8px; }
.radar-row {
  display: grid;
  grid-template-columns: minmax(150px, .45fr) 1fr 88px 82px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}
.radar-row strong { font-size: 12px; }
.radar-row small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.priority-bar { height: 8px; overflow: hidden; border-radius: 99px; background: #e7e3e0; }
.priority-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--gold)); }
.radar-score { color: var(--ink-soft); font-size: 11px; text-align: right; }
.radar-chip { border-radius: 999px; padding: 6px 9px; color: var(--wine); background: var(--red-soft); font-size: 10px; font-weight: 850; text-align: center; }
.source-note {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}
.source-note strong { font-size: 12px; }
.source-note p { margin: 6px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }

.progress-dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .75fr); gap: 18px; }
.chart-panel { padding: 22px; min-width: 0; }
.span-2 { grid-column: 1 / -1; }
.area-pie-wrap { position: relative; width: min(250px, 100%); margin: 22px auto 10px; }
.area-pie { width: 100%; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--wine) 0deg, var(--wine) 80deg, var(--teal) 80deg, var(--teal) 170deg, var(--gold) 170deg, var(--gold) 250deg, var(--blue) 250deg); }
.area-pie-center { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: 92px; height: 92px; display: grid; place-content: center; border-radius: 50%; background: var(--paper); text-align: center; box-shadow: 0 0 0 1px var(--line); }
.area-pie-center strong { font-family: Georgia, serif; font-size: 27px; font-weight: 500; line-height: 1; }
.area-pie-center span { margin-top: 4px; color: var(--ink-soft); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.area-pie-legend { display: grid; gap: 8px; margin-top: 16px; }
.area-pie-row { display: grid; grid-template-columns: 12px minmax(90px, .8fr) 1fr 42px; align-items: center; gap: 8px; }
.area-pie-row i { width: 11px; height: 11px; border-radius: 50%; }
.area-pie-row strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.area-pie-row .mini-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e5e1df; }
.area-pie-row .mini-track span { display: block; height: 100%; border-radius: inherit; }
.area-pie-row em { color: var(--ink-soft); font-size: 9px; font-style: normal; text-align: right; }
.progress-recommendations { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 18px; }
.progress-recommendation { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fbfbfa; }
.progress-recommendation span { color: var(--wine); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.progress-recommendation strong { display: block; margin: 5px 0; font-size: 12px; }
.progress-recommendation p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; }

.method-hero { max-width: 760px; margin-bottom: 24px; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.method-card { min-height: 172px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--paper); }
.method-card > span { color: var(--gold); font-family: Georgia, serif; font-size: 25px; }
.method-card h3 { margin: 22px 0 8px; font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.method-card p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.settings-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.settings-panel, .evidence-panel, .account-panel { padding: 22px; }
.settings-panel form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.settings-panel form > button { align-self: end; }
.account-panel > p { color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.account-panel .full { margin-top: 9px; }
.account-summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #fbfbfa; }
.account-summary strong, .account-summary span { display: block; }
.account-summary strong { font-size: 12px; }
.account-summary span { margin-top: 3px; color: var(--ink-soft); font-size: 10px; }
.danger-outline { min-height: 42px; border: 1px solid #deb5b5; border-radius: var(--radius); color: var(--danger); background: #fff9f8; font-size: 11px; font-weight: 800; }
.evidence-panel { grid-column: 1 / -1; }
.evidence-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.evidence-list a { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; color: inherit; text-decoration: none; transition: .15s; }
.evidence-list a:hover { border-color: var(--wine); background: #fff8f8; }
.evidence-list strong, .evidence-list span { display: block; }
.evidence-list strong { font-size: 11px; }
.evidence-list span { margin-top: 4px; color: var(--ink-soft); font-size: 9px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(34, 23, 28, .66);
  backdrop-filter: blur(5px);
}

.modal {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border-radius: var(--radius);
  padding: 24px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(0,0,0,.24);
  animation: modal-in .2s ease;
}

@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-header h2 { margin: 5px 0 0; font-family: Georgia, serif; font-weight: 500; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #eff0ef; font-size: 21px; }
.modal form { display: grid; gap: 14px; margin-top: 20px; }
.modal form textarea { width: 100%; min-height: 100px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; outline: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.onboarding-card { width: min(460px, 100%); text-align: center; }
.onboarding-logo { width: 60px; height: 60px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; color: #fff; background: var(--wine); font-family: Georgia, serif; font-size: 32px; }
.onboarding-card h2 { margin: 8px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.onboarding-card form { text-align: left; }
.auth-switch { width: 100%; border: 0; margin-top: 14px; padding: 10px; color: var(--wine); background: transparent; font-size: 11px; font-weight: 800; }

.review-modal { width: min(730px, 100%); color: #fff; background: #2b1a21; }
.review-top { display: grid; grid-template-columns: 34px 1fr 45px; align-items: center; gap: 12px; }
.review-top .modal-close { color: #fff; background: rgba(255,255,255,.1); }
.review-progress { height: 5px; overflow: hidden; border-radius: 20px; background: rgba(255,255,255,.12); }
.review-progress i { display: block; width: 0; height: 100%; background: #f1cc7e; }
.review-top > span { color: #d7c4ca; font-size: 10px; text-align: right; }
.review-topic { margin: 24px 0 8px; color: #d7c4ca; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.review-card { width: 100%; min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius); padding: 38px; color: var(--ink); background: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.16); }
.card-side-label { color: #81777d; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
#review-front, #review-back { max-width: 590px; margin: 24px 0; font-family: Georgia, serif; font-size: 24px; line-height: 1.5; white-space: pre-wrap; }
#review-back { font-family: "Segoe UI", sans-serif; font-size: 17px; }
#review-hint { color: #8a8286; font-size: 10px; }
.rating-area { margin-top: 20px; text-align: center; }
.rating-area > p { color: #d7c4ca; font-size: 11px; }
.rating-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rating-buttons button { border: 1px solid rgba(255,255,255,.13); border-radius: var(--radius); padding: 10px 8px; color: #fff; background: rgba(255,255,255,.08); }
.rating-buttons strong, .rating-buttons small { display: block; }
.rating-buttons strong { font-size: 11px; }
.rating-buttons small { margin-top: 3px; color: #d7c4ca; font-size: 9px; }

.toast-container { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 9px; }
.toast { min-width: 240px; border-radius: var(--radius); padding: 13px 16px; color: #fff; background: var(--wine); box-shadow: var(--shadow); font-size: 11px; animation: toast-in .18s ease; }
.toast.error { background: #933f3f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1140px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .questions-layout, .calendar-layout, .progress-dashboard, .settings-grid { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: 1; }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: auto; padding: 50px 28px; }
  .auth-visual h1 { font-size: 40px; }
  .auth-panel { min-height: 500px; }
  .sidebar {
    width: 248px;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-menu { display: block; }
  .view { padding: 24px 18px 44px; }
  .topbar { min-height: 76px; padding: 12px 18px; }
  .today-hero { padding: 30px; }
  .notes-layout, .piece-layout { grid-template-columns: 1fr; }
  .notes-list { max-height: 260px; }
  .piece-list { max-height: 260px; overflow-y: auto; }
}

@media (max-width: 640px) {
  .profile-copy, .sync-indicator, .install-button { display: none !important; }
  .topbar h1 { font-size: 23px; }
  .today-hero { align-items: flex-start; flex-direction: column; }
  .hero-ring-wrap { align-self: center; }
  .hero-actions, .section-toolbar, .calendar-header, .cards-summary, .questions-hero, .piece-hero, .radar-hero, .progress-hero, .note-reader-toolbar { align-items: stretch; flex-direction: column; }
  .section-toolbar > *, .hero-actions > *, .cards-actions > *, .questions-hero > button, .piece-hero > button { width: 100%; }
  .cards-actions, .piece-footer, .editor-footer, .editor-footer > div { flex-direction: column; align-items: stretch; }
  .stat-grid, .method-grid, .weak-grid, .evidence-list, .settings-panel form, .timer-field-grid, .timer-actions, .question-controls, .rubric-grid, .discursive-grid, .form-grid { grid-template-columns: 1fr; }
  .timer-wide { grid-column: 1; }
  .editor-meta { grid-template-columns: 1fr; }
  .card-row { grid-template-columns: 1fr 34px; }
  .card-row .answer, .card-row .card-status { grid-column: 1; }
  .card-row .delete-card { grid-column: 2; grid-row: 1; }
  .piece-topline { grid-template-columns: 1fr; }
  #piece-timer { justify-self: start; }
  .radar-row { grid-template-columns: 1fr 80px; }
  .radar-row .priority-bar { grid-column: 1 / -1; }
  .calendar-day { min-height: 70px; padding: 5px; }
  .day-badge { padding: 3px; font-size: 0; }
  .day-badge::before { content: "•"; font-size: 12px; }
  .rating-buttons { grid-template-columns: 1fr 1fr; }
  .review-card { min-height: 290px; padding: 24px; }
  #review-front, #review-back { font-size: 20px; }
}
