:root {
  font-family: "DM Sans", system-ui, sans-serif;
  color: #25253e;
  background: #f5f5fb;
  font-size: 14px;
  line-height: 1.5;
  --accent: #6742c6;
  --muted: #61657b;
  --border: #e2e3ee;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f5f5f9;
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .55; cursor: default; }
button, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #8056db; outline-offset: 3px; }
.layout { min-height: 100vh; }
.main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 20px 28px 36px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid #dcdde9; color: var(--muted); font-size: 12px; }
.top strong { color: #565072; font-weight: 700; }
.profile-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-controls label { margin: 0; }
.profile-controls select { min-width: 0; width: auto; max-width: 220px; padding: 8px 30px 8px 10px; }
.profile-controls .secondary { padding: 8px 12px; white-space: nowrap; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 20px; }
.hero h1 { display: flex; align-items: center; font: 800 clamp(28px, 4vw, 36px)/1.15 Manrope, system-ui, sans-serif; letter-spacing: -.05em; margin: 0; color: #30224d; }
.brand-logo { display: block; flex-shrink: 0; width: 42px; height: 42px; margin-right: 12px; border-radius: 14px; }
.primary, .secondary { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; min-height: 42px; font-weight: 700; }
.primary { background: var(--accent); color: #fff; box-shadow: 0 3px 8px #6742c61c; }
.primary:hover { background: #5432ac; }
.secondary { background: #eeedf7; color: #51436f; border-color: #dfdcec; }
.secondary:hover { background: #e3def2; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { position: relative; border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 14px 18px; }
.stathead { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stathead i { font-style: normal; display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; background: #f0eafb; border-radius: 9px; color: #6742b1; font-size: 16px; }
.stat strong { display: block; font: 800 27px/1.25 Manrope, system-ui, sans-serif; color: #25253e; margin-top: 4px; overflow-wrap: anywhere; }
.stat small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.section { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section h2 { font: 800 18px/1.4 Manrope, system-ui, sans-serif; margin: 0 0 2px; letter-spacing: -.025em; }
.section p, .count { margin: 0; font-size: 12px; color: var(--muted); }
.section-controls { display: flex; align-items: center; gap: 12px; }
.view-switch { display: flex; gap: 3px; background: #e9e7f1; padding: 3px; border-radius: 10px; }
.view-switch button { border: 1px solid transparent; border-radius: 7px; background: transparent; color: #626079; min-width: 36px; min-height: 36px; font-size: 17px; }
.view-switch button[aria-pressed="true"] { background: white; color: #643db8; border-color: #ddd4ef; box-shadow: 0 1px 4px #30224d10; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.grid.grid-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { --course: #6742c6; --tint: #f0eafb; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 2px 6px #30224d04; cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.card:hover { border-color: var(--course); box-shadow: 0 4px 16px #30224d0c; }
.cardtop { display: flex; justify-content: space-between; gap: 8px; }
.cardtitle { display: flex; flex: 1; align-items: center; min-width: 0; gap: 10px; }
.cardtitle > div:last-child { min-width: 0; }
.subjecticon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; color: var(--course); background: var(--tint); font: 800 13px Manrope, system-ui, sans-serif; }
.card h3 { font: 800 14px/1.4 Manrope, system-ui, sans-serif; margin: 0 0 2px; overflow-wrap: anywhere; }
.muted { font-size: 12px; color: var(--muted); }
.actions { display: flex; align-items: flex-start; gap: 2px; }
.iconbtn { display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 8px; color: #68657e; font-size: 19px; min-width: 36px; min-height: 36px; padding: 4px; }
.iconbtn:hover { background: #f0edf7; color: #5432ac; }
.iconbtn:last-child:hover { background: #fff0ee; color: #a52d30; }
.points { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 9px; }
.points strong { font: 800 21px Manrope, system-ui, sans-serif; }
.points strong span { font: 500 12px "DM Sans", system-ui, sans-serif; color: var(--muted); }
.badge { background: #f1edf8; color: #615074; border-radius: 7px; padding: 4px 8px; font-size: 11px; font-weight: 700; }
.badge.good { background: #e3f5eb; color: #22633f; }
.badge.warning { background: #fff0db; color: #875019; }
.bar { height: 8px; background: #ececf4; border-radius: 20px; position: relative; margin: 9px 0 5px; }
.bar .fill { height: 100%; background: transparent; border-radius: inherit; }
.bar .fill::before, .subprogress-fill::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, #db4b51, #e6a33e 50%, #2a9b61); clip-path: inset(0 calc(100% - var(--progress)) 0 0 round 20px); }
.bar .marker { position: absolute; top: -3px; width: 3px; height: 14px; border-radius: 2px; background: #36354e; transform: translateX(-50%); }
.barlabels { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); }
.barlabels span:nth-child(2) { color: #49435e; font-weight: 700; }
.subprogress { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.subprogress-item { flex: 1 1 160px; min-width: 0; background: #f6f6fa; border: 1px solid #eeeeF5; border-radius: 8px; padding: 6px 9px; font-size: 11px; color: #5b5c73; }
.subprogress-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; }
.subprogress-track { height: 5px; background: #e1e1ed; border-radius: 5px; margin-top: 6px; position: relative; }
.subprogress-fill { height: 100%; border-radius: inherit; background: transparent; }
.subprogress-mark { position: absolute; top: -3px; width: 2px; height: 11px; background: #454159; }
.cardfoot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.detailbtn { border: 0; background: none; color: var(--course); font-weight: 700; padding: 2px 0; }
.empty { grid-column: 1/-1; text-align: center; background: #fff; border: 1px dashed #cfc2e7; border-radius: 14px; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: #35304d; }
.empty button { margin-top: 10px; }
dialog { color: #25253e; background: #fff; border: 1px solid #e1daee; border-radius: 18px; padding: 0; width: min(540px, calc(100% - 24px)); max-width: calc(100% - 24px); max-height: calc(100dvh - 32px); box-shadow: 0 24px 90px #23143f40; }
dialog::backdrop { background: #211a3b85; backdrop-filter: blur(4px); }
.modal { padding: 24px; width: 100%; min-width: 0; }
.modalhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal h2 { font: 800 20px/1.4 Manrope, system-ui, sans-serif; margin: 0; overflow-wrap: anywhere; }
.close { border: 0; border-radius: 9px; min-width: 40px; min-height: 40px; background: #f2eff8; color: #65547e; font-size: 26px; flex-shrink: 0; }
.close:hover { background: #e6def3; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
label { display: block; color: #51465f; font-weight: 700; font-size: 12px; margin: 16px 0 6px; }
input, select { width: 100%; min-width: 0; max-width: 100%; border: 1px solid #d8d5e5; border-radius: 9px; padding: 10px 11px; color: #35304b; background: #fff; min-height: 42px; accent-color: var(--accent); }
input::placeholder { color: #76748a; }
input[type="checkbox"] { min-height: 20px; height: 20px; flex-shrink: 0; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.modalfooter { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.entry { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid #eae7f1; padding: 12px 0; overflow-wrap: anywhere; }
.entry strong { display: block; }
.entry small { color: var(--muted); }
.entrypoints { font-weight: 700; color: #6342ad; white-space: nowrap; }
.detailtotal { background: #f3effb; border: 1px solid #e3d9f3; padding: 15px; border-radius: 12px; margin: 18px 0; color: #584675; }
.detailtotal strong { font-size: 20px; color: #59389e; }
.entryform { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 5px; }
.tedo-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; }
.tedo-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.tedo-check.complete { color: #22633f; }
/* Colors describe completion, independently for each subject and each part. */
.card.is-complete { --course: #237447; --tint: #dff2e6; background: #f0faf3; border-color: #90c6a3; border-left: 4px solid #237447; }
.card.needs-review { --course: #94600c; --tint: #fff0cf; background: #fffbf2; border-color: #dfbf7e; border-left: 4px solid #ad7417; }
.badge.warning { background: #fff0cf; color: #78500e; }
.subprogress-item.is-complete { background: #e3f4e9; border-color: #9ecbad; color: #245c39; }

.subprogress-item.is-complete .subprogress-track { background: #c4e1ce; }
.tedo-check { padding: 4px 8px; background: #f3f3f8; border: 1px solid #e2e3ee; border-radius: 7px; }
.tedo-check.complete { color: #245c39; background: #e3f4e9; border-color: #9ecbad; font-weight: 700; }
@media (max-width: 650px) {
  .main { padding: 14px 14px 28px; }
  .grid.grid-columns { grid-template-columns: minmax(0, 1fr); }
  .top { gap: 8px; }
  .profile-controls { gap: 6px; }
  .profile-controls select { max-width: 155px; }
  .profile-controls label { display: none; }
  .hero { margin: 20px 0 16px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 11px; margin-right: 8px; }
  .hero .primary { padding: 10px 12px; font-size: 12px; }
  .stats { gap: 7px; }
  .stat { padding: 10px; border-radius: 11px; }
  .stathead { font-size: 11px; line-height: 1.4; min-height: 31px; }
  .stathead i { display: none; }
  .stat strong { font-size: 23px; }
  .stat small { font-size: 10px; }
  .section { margin-top: 22px; gap: 8px; }
  .section-controls { gap: 6px; }
  .count { display: none; }
  .section h2 { font-size: 17px; }
  .section p { font-size: 11px; }
  .card { padding: 12px; }
  .cardtitle { gap: 8px; }
  .card h3 { font-size: 13px; }
  .actions { gap: 0; }
  .subjecticon { width: 32px; height: 32px; }
  .subprogress-item { flex-basis: 140px; }
  .modal { padding: 18px; }
  input, select { font-size: 16px; }
  .profile-controls select { font-size: 14px; }
}
@media (max-width: 360px) {
  .main { padding-inline: 10px; }
  .hero { flex-wrap: wrap; }
  .hero .primary { flex: 1; }
  .profile-controls select { max-width: 125px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* A wide display can show a full semester without making the cards narrower. */
@media (min-width: 1400px) {
  .main { max-width: 1500px; }
  .grid.grid-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.absence-btn { border: 1px solid #e2dcef; border-radius: 8px; background: #f6f3fb; color: #5d5177; font: inherit; font-size: 11px; font-weight: 700; white-space: nowrap; padding: 8px; min-height: 36px; }
.absence-btn:hover { background: #eae3f8; color: #5432ac; }

.absence-btn.limit { background: #fff0db; border-color: #edc793; color: #875019; }
.absence-btn.over { background: #ffebe9; border-color: #e9aaa6; color: #a12b2f; }

.hero-actions,.schedule-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.schedule-toolbar input{width:auto;flex:1 1 180px}.schedule-row{display:grid;grid-template-columns:minmax(85px,1fr) minmax(90px,1fr) minmax(90px,1fr) minmax(140px,2fr) minmax(105px,1fr) auto;gap:7px;align-items:end;padding:10px 0;border-bottom:1px solid #eee}.schedule-row label{margin:0 0 4px}.schedule-row input,.schedule-row select{padding:7px;min-height:38px}.schedule-note{grid-column:1/-1}.schedule-note input{width:100%}#scheduleDialog{width:min(1000px,calc(100% - 24px))}@media(max-width:650px){.schedule-row{grid-template-columns:1fr 1fr}.schedule-row .schedule-subject,.schedule-note{grid-column:1/-1}}

.schedule-import { margin: 14px 0; padding: 12px; border: 1px solid #e2dcef; border-radius: 10px; background: #f9f8fc; }
.schedule-import summary { cursor: pointer; font-weight: 700; color: #5432ac; }
.schedule-import ol { padding-left: 20px; line-height: 1.6; }
.schedule-import textarea { display:block; width:100%; max-width:100%; min-width:0; border:1px solid #d8d5e5; border-radius:8px; padding:8px; font:12px/1.4 monospace; resize:vertical; }
.schedule-import button { margin-top:8px; }

.schedule-empty { padding: 22px; text-align: center; background: #f7f6fb; border-radius: 10px; color: #68657e; }
.schedule-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 15px 0 10px; font-size: 12px; color: #646179; }
.schedule-legend span { display: inline-flex; align-items: center; gap: 5px; }
.schedule-legend i { width: 9px; height: 9px; border-radius: 3px; background: #8c85aa; }
.schedule-legend i.lecture { background: #cd6c58; }
.schedule-legend i.practice { background: #6b70c9; }
.schedule-scroll { overflow-x: auto; border: 1px solid #e3e0ed; border-radius: 10px; }
.schedule-week { display: grid; grid-template-columns: 50px repeat(var(--day-count), minmax(150px, 1fr)); min-width: max(800px, calc(50px + var(--day-count) * 150px)); }
.schedule-day-name { display: block; height: 36px; padding: 10px 6px; text-align: center; font-size: 12px; background: #f7f6fb; border-bottom: 1px solid #e3e0ed; }
.schedule-day-track, .schedule-hour-track { position: relative; background: repeating-linear-gradient(to bottom, transparent 0, transparent 53px, #eeecf4 53px, #eeecf4 54px); }
.schedule-day-track { border-left: 1px solid #e9e7f0; }
.schedule-hour-track span { position: absolute; right: 5px; transform: translateY(-50%); color: #77758a; font-size: 10px; }
.schedule-hour-track span:first-child { transform: none; }
.schedule-event { position: absolute; overflow: auto; padding: 5px 6px; border: 1px solid #d9d3e8; border-left: 3px solid #8c85aa; border-radius: 6px; background: #f1eff7; color: #39334f; font-size: 11px; line-height: 1.25; }
.schedule-event.lecture { border-color: #ecc9bd; border-left-color: #cd6c58; background: #fff1ed; }
.schedule-event.practice { border-color: #d1d1ed; border-left-color: #6b70c9; background: #f0efff; }
.schedule-event strong, .schedule-event span, .schedule-event small { display: block; overflow-wrap: anywhere; }
.schedule-event strong { font-size: 12px; }
.schedule-event small { margin-top: 3px; color: #686179; }
.calendar-settings { margin: 12px 0; padding: 12px; background: #f7f6fb; border: 1px solid #e4e0ef; border-radius: 10px; }
.calendar-inputs { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.calendar-inputs label { flex: 1 1 130px; margin: 8px 0 0; }
.calendar-inputs button { min-height: 42px; }
.calendar-event { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #e9e7f0; padding: 4px 0; font-size: 12px; }
.lesson-counts { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; font-size: 11px; color: #625d77; }

.lesson-groups { display: grid; gap: 4px; margin-top: 8px; }
.lesson-group { padding: 6px 8px; border: 1px solid #eeedf4; border-radius: 7px; background: #f9f8fc; }
.lesson-group .lesson-counts { margin-top: 0; }
.lesson-progress { display: block; width: 100%; height: 6px; margin-top: 6px; border: 0; border-radius: 6px; overflow: hidden; appearance: none; background: #e4e3ec; color: #8c85aa; }
.lesson-progress.lecture { color: #cd6c58; }
.lesson-progress.practice { color: #6b70c9; }
.lesson-progress::-webkit-progress-bar { background: #e4e3ec; border-radius: 6px; }
.lesson-progress::-webkit-progress-value { background: currentColor; border-radius: 6px; }
.lesson-progress::-moz-progress-bar { background: currentColor; border-radius: 6px; }
.lesson-no-progress { display: block; margin-top: 4px; font-size: 10px; color: #77758a; }
.schedule-week-heading { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; color: #4e4268; font-size: 13px; }
.schedule-week-heading span { color: #77758a; }
.schedule-day-name span { font-weight: 400; color: #77758a; }
.schedule-day.is-today .schedule-day-name { background: #eae4f9; color: #4f2ba8; }
.schedule-day.is-today .schedule-day-track { background-color: #fbfaff; }
.schedule-event.is-inactive { opacity: .55; border-style: dashed; }
.schedule-event.is-current { outline: 2px solid #328754; outline-offset: -2px; box-shadow: 0 0 0 2px #fff; }
.schedule-event .schedule-event-status { font-weight: 700; color: #514765; }
.schedule-now { position: absolute; z-index: 2; left: 0; right: 0; height: 2px; background: #c84550; pointer-events: none; }
.schedule-week-events { display: grid; gap: 4px; padding: 10px 2px 0; font-size: 12px; color: #625d77; }
.schedule-week-navigation { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.schedule-week-navigation .secondary { padding: 7px 10px; }
.schedule-week-arrow { min-width: 34px; font-size: 18px; line-height: 1; }
.schedule-week-navigation button:disabled { opacity: .55; cursor: default; }
.schedule-week-heading { align-items: center; flex-wrap: wrap; }
[hidden] { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(100%, 390px); background: white; border: 1px solid #e3e0ed; border-radius: 16px; padding: 28px; box-shadow: 0 8px 32px #2d204312; }
.auth-card > img { border-radius: 10px; }
.auth-card h1 { margin: 12px 0 4px; font: 800 28px Manrope, sans-serif; }
.auth-card form .primary, .auth-card > .secondary { width: 100%; margin-top: 12px; }

/* Kompaktní hlavička a souhrn ponechávají prostor pro předměty. */
.main { padding-top: 14px; }
.hero { margin: 0 0 12px; gap: 12px; }
.hero h1 { font-size: 26px; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; margin-right: 9px; }
.hero-actions { justify-content: flex-end; }
.hero-actions .primary, .hero-actions .secondary { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.profile-controls { padding-left: 8px; margin-left: 2px; border-left: 1px solid #dedbe9; font-size: 12px; }
.stats { gap: 8px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 9px 14px; }
.stathead { min-height: 0; line-height: 1.3; }
.stat strong { flex-shrink: 0; margin: 0; font-size: 21px; }
.section { margin: 16px 0 10px; }
@media (max-width: 650px) {
  .hero { margin: 0 0 10px; flex-wrap: wrap; }
  .hero h1 { font-size: 23px; }
  .hero-actions { gap: 6px; }
  .profile-controls { padding-left: 6px; }
  .stats { gap: 6px; }
  .stat { padding: 8px; align-items: flex-start; flex-direction: column; gap: 3px; }
  .stathead { min-height: 0; font-size: 10px; }
  .stat strong { font-size: 18px; }
  .section { margin-top: 16px; }
}

@media (max-width: 650px) {
  /* A two-column view collapses to one column here, so the switch has no effect. */
  .view-switch { display: none; }
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand profile" "schedule add";
    gap: 8px;
    align-items: center;
  }
  .hero h1 { grid-area: brand; min-width: 0; }
  .hero-actions { display: contents; }
  .hero-actions > button:first-child { grid-area: schedule; }
  .hero-actions > button:nth-child(2) { grid-area: add; }
  .profile-controls {
    grid-area: profile;
    justify-self: end;
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
    max-width: 100%;
  }
  .profile-controls strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero-actions .primary, .hero-actions .secondary { min-height: 38px; }
  .cardtop:has(.absence-btn) { flex-wrap: wrap; gap: 4px; }
  .cardtop:has(.absence-btn) .cardtitle { flex: 1 1 100%; }
  .cardtop:has(.absence-btn) .actions { width: 100%; justify-content: flex-end; }
  .card h3 { overflow-wrap: normal; }
  .points { gap: 6px; flex-wrap: wrap; }
}

.admin-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:8px 12px; margin-bottom:10px; border:1px solid #d9d2ea; background:#f6f3fb; border-radius:10px; font-size:12px; }
.admin-controls label { margin:0; font-weight:700; }
.admin-controls select { width:auto; min-height:34px; padding:5px 28px 5px 8px; }
#adminViewStatus { font-weight:700; color:#704b19; }
body[data-readonly="true"] .card .actions,
body[data-readonly="true"] .hero-actions > .primary,
body[data-readonly="true"] #subjects .empty button,
body[data-readonly="true"] #detailDialog .entry .iconbtn,
body[data-readonly="true"] #detailDialog #entryForm,
body[data-readonly="true"] #calendarEventForm,
body[data-readonly="true"] #calendarSaveSettings,
body[data-readonly="true"] #calendarEvents button,
body[data-readonly="true"] #scheduleEditor { display:none !important; }
