:root {
  --ink: #12231f;
  --muted: #677671;
  --line: #dce5e1;
  --paper: #f4f7f5;
  --white: #ffffff;
  --green: #0d684f;
  --green-dark: #084938;
  --green-soft: #dff2e9;
  --mint: #a8e2cd;
  --orange: #f09a64;
  --red: #b94a48;
  --shadow: 0 18px 45px rgba(27, 59, 49, .09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
h2 { font-size: clamp(1.35rem, 2.2vw, 2rem); margin-bottom: .6rem; }
h3 { font-size: 1.12rem; margin-bottom: 1rem; }
.eyebrow { margin-bottom: .55rem; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.muted { color: var(--muted); }
.lead { font-size: 1.08rem; line-height: 1.7; color: #d4e5de; max-width: 580px; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr); }
.login-copy { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 8vw, 120px); color: white; background: linear-gradient(140deg, #062f25 0%, #0a5a46 58%, #14765c 100%); }
.login-copy::before, .login-copy::after { content: ""; position: absolute; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); }
.login-copy::before { width: 620px; height: 620px; right: -280px; top: -230px; box-shadow: 0 0 0 90px rgba(255,255,255,.025), 0 0 0 180px rgba(255,255,255,.018); }
.login-copy::after { width: 300px; height: 300px; left: -150px; bottom: -130px; }
.login-copy .brand-mark { position: absolute; top: 42px; left: clamp(40px, 8vw, 120px); }
.login-copy .eyebrow { color: var(--mint); }
.login-copy h1 { position: relative; font-size: clamp(3rem, 6vw, 6.6rem); line-height: .94; margin-bottom: 2rem; max-width: 850px; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; background: var(--mint); color: var(--green-dark); font-size: .85rem; font-weight: 900; letter-spacing: -.03em; }
.login-features { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; }
.login-features span { padding: .6rem .85rem; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: #e3f1ec; font-size: .82rem; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: clamp(34px, 6vw, 82px); background: var(--white); }
.login-card h2 { font-size: 2.3rem; }
.login-card form { margin-top: 1.4rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px; color: #d9ebe5; background: #082f26; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 0 8px 25px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand div { display: grid; gap: 2px; }
.brand strong { color: white; }
.brand small { color: #90aea4; }
.sidebar nav { display: grid; gap: .35rem; padding: 24px 0; }
.nav-link { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .85rem .9rem; border: 0; border-radius: 10px; color: #a9c1b9; background: transparent; text-align: left; transition: .18s ease; }
.nav-link span { color: #6c9084; font-size: .68rem; letter-spacing: .08em; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(168,226,205,.12); }
.nav-link.active span { color: var(--mint); }
.sidebar-note { display: grid; gap: .4rem; padding: 1rem; margin-top: auto; border: 1px solid rgba(168,226,205,.16); border-radius: 12px; background: rgba(168,226,205,.07); }
.sidebar-note strong { color: var(--mint); font-size: .8rem; }
.sidebar-note span { color: #9db8af; font-size: .72rem; line-height: 1.5; }
.logout-button { margin-top: 12px; padding: .75rem; border: 0; color: #a9c1b9; background: transparent; }

.workspace { min-width: 0; padding: 0 clamp(20px, 4vw, 62px) 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 112px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.4rem); }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.user-chip div { display: grid; gap: 1px; }
.user-chip strong { font-size: .8rem; }
.user-chip small { color: var(--muted); font-size: .7rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #2fbe83; box-shadow: 0 0 0 4px #e2f6ee; }
.page { padding-top: 34px; animation: page-in .22s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.hero-card { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: end; min-height: 230px; padding: clamp(28px, 5vw, 58px); border-radius: 20px; color: white; background: linear-gradient(120deg, #0b503e, #0d7355); box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; width: 370px; height: 370px; right: -150px; top: -210px; border: 65px solid rgba(255,255,255,.06); border-radius: 50%; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .eyebrow { color: var(--mint); }
.hero-card h2 { font-size: clamp(2rem, 4vw, 3.8rem); margin-bottom: .75rem; }
.hero-card p:not(.eyebrow) { max-width: 590px; margin-bottom: 0; color: #cbe2da; }
.light-button { padding: .85rem 1.1rem; border: 0; border-radius: 10px; color: var(--green-dark); background: var(--mint); font-weight: 800; white-space: nowrap; }
.light-button span { margin-left: .5rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.stats article { display: grid; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.stats span { color: var(--muted); font-size: .78rem; }
.stats strong { margin: .35rem 0; font-size: 2rem; }
.stats small { color: #94a09c; font-size: .7rem; }
.two-column { display: grid; grid-template-columns: 1.3fr .7fr; gap: 18px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 5px 18px rgba(24,55,46,.035); }
.panel-heading, .section-toolbar, .record-title, .dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.section-toolbar { align-items: end; margin-bottom: 20px; }
.section-toolbar h2 { margin-bottom: 0; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: .35rem .55rem; border-radius: 999px; color: #67593e; background: #f5eddd; font-size: .67rem; font-weight: 800; white-space: nowrap; }
.pill.success { color: var(--green-dark); background: var(--green-soft); }
.rule-list { display: grid; gap: .6rem; margin-top: 1.2rem; }
.rule-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; padding: .85rem; border-radius: 11px; background: #f6f9f7; }
.rule-row div { display: grid; gap: .18rem; }
.rule-row small, .rule-row > span:last-child { color: var(--muted); font-size: .72rem; }
.trip-badge { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; color: white; background: var(--green); font-size: .78rem; font-weight: 900; }
.priority-panel { background: #ecf5f1; }
.priority-list { list-style: none; display: grid; gap: 1.05rem; padding: 0; margin: 1.4rem 0 0; }
.priority-list li { display: flex; gap: .85rem; }
.priority-list li > span { width: 29px; height: 29px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #b8d7cb; border-radius: 50%; color: var(--green); background: white; font-size: .72rem; font-weight: 900; }
.priority-list div { display: grid; gap: .2rem; }
.priority-list small { color: var(--muted); line-height: 1.4; }

label { display: grid; gap: .4rem; color: #3f514b; font-size: .75rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: .72rem .8rem; border: 1px solid #ccd8d3; border-radius: 9px; outline: none; color: var(--ink); background: white; transition: border .15s, box-shadow .15s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #4b9b80; box-shadow: 0 0 0 3px rgba(75,155,128,.12); }
label small { color: #899690; font-weight: 400; line-height: 1.4; }
button[type="submit"], .suggestion-list button { padding: .78rem 1rem; border: 0; border-radius: 9px; color: white; background: var(--green); font-weight: 800; }
button:disabled { opacity: .55; cursor: wait; }
.form-stack { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.compact > button, .form-grid.compact > .button-row { align-self: end; }
.button-row { display: flex; gap: .65rem; flex-wrap: wrap; }
.secondary { padding: .72rem .9rem; border: 1px solid #cbd8d3; border-radius: 9px; color: var(--green-dark); background: white; font-weight: 800; }
.secondary.small, .danger-text.small { padding: .45rem .6rem; font-size: .7rem; }
.danger-text, .text-button { padding: .3rem; border: 0; color: var(--red); background: transparent; font-size: .73rem; font-weight: 700; }
.text-button { color: var(--green); }
.form-error { min-height: 1.1rem; margin: 0; color: #b63737; font-size: .8rem; }
.compact-field { min-width: 190px; }

.capacity-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.capacity-strip article { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.capacity-strip article > div:first-child { display: flex; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .73rem; }
.capacity-strip strong { color: var(--ink); }
.meter { height: 5px; margin-top: .7rem; overflow: hidden; border-radius: 99px; background: #e9efec; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.schedule-boards { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 14px; align-items: start; }
.schedule-board { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.schedule-board > header { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--line); background: #f9fbfa; }
.schedule-board > header div { display: flex; align-items: center; gap: .6rem; }
.schedule-board h3 { margin: 0; font-size: .95rem; }
.schedule-board header small { color: var(--muted); }
.schedule-slot { min-height: 142px; padding: 12px; border-bottom: 1px solid #e8eeeb; transition: .15s; }
.schedule-slot:last-child { border-bottom: 0; }
.schedule-slot.group-slot { background: #f0f8f4; }
.schedule-slot.drop-ready { outline: 2px dashed #31a47c; outline-offset: -5px; background: #e4f6ee; }
.slot-heading { display: flex; justify-content: space-between; margin-bottom: 9px; }
.slot-heading strong { font-size: .78rem; }
.slot-heading span { color: #8a9792; font-size: .63rem; }
.slot-lessons { display: grid; gap: .55rem; }
.slot-empty { display: grid; place-items: center; min-height: 78px; border: 1px dashed #d5dfdb; border-radius: 9px; color: #9ba7a2; font-size: .7rem; }
.lesson-card { display: grid; gap: .35rem; padding: .72rem; border-left: 4px solid #2b8a6a; border-radius: 9px; background: #eef7f3; box-shadow: 0 4px 10px rgba(28,69,55,.06); cursor: grab; }
.lesson-card.group { border-left-color: var(--orange); background: #fff3ea; }
.lesson-card.dragging { opacity: .45; }
.lesson-card > strong { font-size: .8rem; }
.lesson-card > small { color: var(--muted); font-size: .65rem; }
.lesson-card-top, .lesson-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.lesson-card-top span { color: var(--green); font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.lesson-card.group .lesson-card-top span { color: #a35425; }
.lesson-card-top small, .lesson-card-bottom span { color: #7d8b86; font-size: .58rem; }
.lesson-card-bottom button { padding: 0; border: 0; color: var(--red); background: transparent; font-size: .62rem; }
.drag-note { color: var(--muted); font-size: .7rem; text-align: center; margin: 11px 0 20px; }
.schedule-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.accent-panel { border-color: #b9d9cd; background: #f0f8f4; }
.candidate-preview { display: grid; gap: .45rem; margin-top: 1rem; }
.candidate-preview div, .candidate-preview > strong, .candidate-preview > span { display: grid; gap: .2rem; padding: .65rem; border-radius: 8px; background: rgba(255,255,255,.75); font-size: .73rem; }
.candidate-preview span { color: var(--muted); font-weight: 400; line-height: 1.4; }

.management-layout { display: grid; grid-template-columns: minmax(310px, .72fr) minmax(0, 1.28fr); gap: 18px; align-items: start; }
.form-panel { position: sticky; top: 18px; }
fieldset { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 .4rem; color: #3f514b; font-size: .75rem; font-weight: 800; }
.availability-actions { display: flex; gap: .6rem; justify-content: end; margin-bottom: .55rem; }
.availability-grid { display: grid; grid-template-columns: 34px repeat(8, minmax(25px, 1fr)); gap: 4px; align-items: center; }
.availability-grid > strong { color: var(--muted); font-size: .61rem; text-align: center; }
.availability-grid label { display: block; }
.availability-grid input { position: absolute; opacity: 0; pointer-events: none; }
.availability-grid label span { display: block; aspect-ratio: 1; border: 1px solid #d5dfdb; border-radius: 5px; background: white; cursor: pointer; }
.availability-grid input:checked + span { border-color: var(--green); background: var(--green); box-shadow: inset 0 0 0 3px white; }
.record-list { display: grid; gap: .7rem; }
.record-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: white; }
.record-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: .75rem; font-weight: 900; }
.record-icon.student { color: #8a4b25; background: #ffebdd; }
.record-title { align-items: center; justify-content: start; }
.record-title h3 { margin: 0; font-size: .92rem; }
.record-body > p { margin: .3rem 0; color: var(--muted); font-size: .74rem; line-height: 1.4; }
.record-body > small { color: #8a9792; font-size: .67rem; }
.record-actions { display: flex; gap: .2rem; }
.empty-state { padding: 2.5rem 1rem; border: 1px dashed #cad7d1; border-radius: 12px; color: var(--muted); text-align: center; background: rgba(255,255,255,.5); }
.empty-state.compact { padding: 1rem; font-size: .75rem; }

.service-top { display: grid; grid-template-columns: .65fr 1.35fr; gap: 18px; align-items: start; }
.service-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.mini-list { display: grid; gap: .5rem; margin-top: 1.2rem; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .65rem; border-radius: 8px; background: #f5f8f6; }
.mini-row div { display: grid; gap: .15rem; }
.mini-row strong { font-size: .77rem; }
.mini-row small { color: var(--muted); font-size: .65rem; }
.service-block-forms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.service-block-form { display: grid; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 11px; background: #f8faf9; }
.service-block-title { display: flex; align-items: center; gap: .6rem; }
.service-block-title div { display: grid; gap: .15rem; }
.service-block-title small { color: var(--muted); font-size: .62rem; }
.inline-form { display: grid; grid-template-columns: 1fr .7fr auto; gap: .7rem; align-items: end; }
.assignment-list, .assignment-group { display: grid; gap: .5rem; }
.assignment-group { padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.assignment-group:last-child { border: 0; padding-bottom: 0; }
.assignment-group > strong { display: flex; justify-content: space-between; font-size: .78rem; }
.assignment-group > strong span { color: var(--muted); font-size: .67rem; }
.assignment-group > div { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-radius: 7px; background: #f6f9f7; font-size: .72rem; }
.assignment-group small { color: var(--muted); font-size: .65rem; }

dialog { width: min(700px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 17px; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.26); }
dialog::backdrop { background: rgba(5,31,24,.68); backdrop-filter: blur(3px); }
.icon-button { width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: white; font-size: 1.4rem; }
.suggestion-list { display: grid; gap: .6rem; margin-top: 1.2rem; }
.suggestion-list article { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; padding: .8rem; border: 1px solid var(--line); border-radius: 11px; }
.suggestion-list article > div { display: grid; gap: .2rem; }
.suggestion-list small, .suggestion-list p { margin: 0; color: var(--muted); font-size: .68rem; }
.rank { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: .7rem; font-weight: 900; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: min(420px, calc(100vw - 44px)); padding: .85rem 1rem; border-radius: 10px; color: white; background: var(--green-dark); box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; font-size: .8rem; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #9b3d3a; }

@media (max-width: 1180px) {
  .service-block-forms { grid-template-columns: 1fr; }
  .schedule-boards { overflow-x: auto; grid-template-columns: repeat(3, minmax(285px, 1fr)); padding-bottom: .5rem; }
  .service-top { grid-template-columns: .8fr 1.2fr; }
}
@media (max-width: 900px) {
  .app-shell { width: 100%; grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
  .sidebar { position: static; width: 100%; min-width: 0; height: auto; padding: 14px; }
  .brand { padding-bottom: 14px; }
  .sidebar nav { width: 100%; min-width: 0; max-width: calc(100vw - 28px); grid-template-columns: repeat(5, minmax(110px, 1fr)); overflow-x: auto; padding: 12px 0; }
  .nav-link { justify-content: center; white-space: nowrap; }
  .sidebar-note, .logout-button { display: none; }
  .workspace { padding-inline: 18px; }
  .topbar { min-height: 90px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-column, .management-layout, .schedule-actions, .service-top, .service-bottom { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}
@media (max-width: 680px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-copy { min-height: 48vh; padding: 90px 26px 38px; }
  .login-copy .brand-mark { top: 28px; left: 26px; }
  .login-copy h1 { font-size: 3rem; }
  .login-card { padding: 36px 26px; }
  .hero-card { display: grid; gap: 1.5rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .section-toolbar { align-items: start; flex-direction: column; }
  .compact-field { width: 100%; }
  .capacity-strip { grid-template-columns: 1fr; }
  .form-grid, .form-grid.compact, .inline-form { grid-template-columns: 1fr; }
  .record-card { grid-template-columns: auto 1fr; }
  .record-actions { grid-column: 1 / -1; justify-content: end; }
  .topbar .eyebrow, .user-chip small { display: none; }
  .user-chip strong { max-width: 125px; overflow: hidden; text-overflow: ellipsis; }
  .rule-row { grid-template-columns: auto 1fr; }
  .rule-row > span:last-child { grid-column: 2; }
}
