:root {
  --ink: #1d2925;
  --muted: #66736d;
  --line: #e5e9e4;
  --paper: #ffffff;
  --canvas: #f5f7f3;
  --lime: #c9f36b;
  --green: #174f3b;
  --green-2: #236c50;
  --orange: #ff8b5c;
  --blue: #5f82e8;
  --red: #d94f4f;
  --shadow: 0 12px 34px rgba(26, 55, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: #123d30; color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: var(--green); background: var(--lime); font-weight: 900; }
.nav { display: grid; gap: 6px; }
.nav button { border: 0; background: transparent; color: #bed0c8; padding: 12px 14px; border-radius: 12px; text-align: left; display: flex; align-items: center; gap: 10px; }
.nav button:hover, .nav button.active { background: rgba(255,255,255,.11); color: #fff; }
.nav-icon { width: 23px; opacity: .9; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 16px 10px 0; font-size: 12px; color: #9fb7ad; }
.main { min-width: 0; }
.topbar { height: 76px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; background: rgba(245,247,243,.9); backdrop-filter: blur(15px); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid rgba(218,225,218,.7); }
.top-title { font-size: 20px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.role-switch { border: 1px solid var(--line); background: #fff; padding: 9px 12px; border-radius: 11px; color: var(--ink); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #d8e6de; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.content { padding: 26px 30px 40px; max-width: 1500px; margin: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; margin: 0 0 5px; letter-spacing: -.03em; }
.page-head p { color: var(--muted); margin: 0; font-size: 14px; }
.btn { border: 0; border-radius: 11px; padding: 10px 15px; font-weight: 700; background: var(--green); color: white; box-shadow: 0 6px 16px rgba(23,79,59,.16); }
.btn:hover { background: var(--green-2); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: #fff2ef; color: #a7362d; box-shadow: none; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 19px; box-shadow: var(--shadow); }
.stat-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 14px; font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.stat-note { margin-top: 7px; font-size: 12px; color: var(--muted); }
.trend { color: #287757; font-weight: 700; }
.dashboard-grid { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 16px; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 9px; background: #edf3ee; color: #426052; font-size: 12px; white-space: nowrap; }
.pill.green { background: #e6f5ea; color: #277448; }
.pill.orange { background: #fff0e9; color: #a64d28; }
.pill.blue { background: #edf1ff; color: #4862b5; }
.pill.red { background: #fff0f0; color: #b63d3d; }
.schedule-list { display: grid; gap: 10px; }
.schedule-row { display: grid; grid-template-columns: 86px 6px minmax(140px, 1fr) minmax(130px, .7fr) auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid #edf0ec; border-radius: 13px; }
.schedule-row:hover { border-color: #cbd8cf; background: #fafbf9; }
.time { font-size: 13px; font-weight: 800; }
.time small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.subject-bar { align-self: stretch; border-radius: 4px; background: var(--orange); }
.schedule-row:nth-child(2) .subject-bar { background: var(--blue); }
.schedule-row:nth-child(3) .subject-bar { background: #61b58e; }
.course-name { font-weight: 750; font-size: 14px; }
.course-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.util-list { display: grid; gap: 16px; }
.util-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 7px; }
.progress { height: 7px; border-radius: 99px; background: #edf0ec; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
.alert { border-radius: 12px; background: #fff6f1; color: #7e3e27; padding: 12px; font-size: 13px; line-height: 1.6; margin-top: 16px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.input, .select { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0 12px; color: var(--ink); outline: none; }
.input:focus, .select:focus { border-color: #7ca791; box-shadow: 0 0 0 3px #e4eee8; }
.input { min-width: 210px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 650; padding: 12px 16px; background: #fafbf9; border-bottom: 1px solid var(--line); }
td { padding: 15px 16px; border-bottom: 1px solid #edf0ec; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.person { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.mini-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #eef3e6; color: var(--green); }
.link-btn { border: 0; padding: 0; background: transparent; color: var(--green-2); font-weight: 700; }

.room-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.room-card { padding: 18px; }
.room-title { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.room-title h3 { margin: 0 0 5px; font-size: 16px; }
.room-title p { margin: 0; color: var(--muted); font-size: 12px; }
.equipment { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.equipment span { background: #f1f4f1; padding: 5px 8px; border-radius: 8px; font-size: 11px; color: #56645d; }
.room-stats { border-top: 1px solid var(--line); padding-top: 13px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.calendar { overflow-x: auto; }
.calendar-grid { min-width: 900px; display: grid; grid-template-columns: 70px repeat(5, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-cell { min-height: 90px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; position: relative; }
.cal-head { min-height: auto; background: #fafbf9; text-align: center; font-weight: 700; }
.cal-time { color: var(--muted); background: #fafbf9; }
.cal-event { border-radius: 9px; padding: 8px; background: #eaf2ec; color: #245640; border-left: 3px solid #4f9874; line-height: 1.4; }
.cal-event.blue { background: #eef1fc; color: #40568e; border-color: #7890d6; }
.cal-event.orange { background: #fff0e7; color: #8e4e2e; border-color: #e78b59; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(12,28,22,.48); display: grid; place-items: center; z-index: 20; padding: 18px; }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; background: white; border-radius: 20px; box-shadow: 0 25px 80px rgba(0,0,0,.22); }
.modal-head { padding: 20px 22px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.close { border: 0; background: #f0f2ef; width: 32px; height: 32px; border-radius: 50%; }
.form { padding: 20px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; font-size: 13px; font-weight: 650; }
.field.full { grid-column: 1 / -1; }
.field input, .field select { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; }
.conflicts { grid-column: 1 / -1; display: grid; gap: 7px; }
.conflict { background: #fff0f0; color: #9d3333; border-radius: 10px; padding: 9px 11px; font-size: 12px; }
.success { background: #eaf7ee; color: #26734a; border-radius: 10px; padding: 10px 11px; font-size: 12px; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding-top: 5px; }
.toast { position: fixed; right: 25px; bottom: 25px; padding: 12px 16px; background: #183c30; color: white; border-radius: 11px; z-index: 30; box-shadow: var(--shadow); font-size: 13px; animation: in .18s ease-out; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

.mobile-shell { min-height: 100vh; max-width: 520px; margin: auto; background: #f7f8f4; box-shadow: 0 0 50px rgba(24,56,43,.08); padding-bottom: 82px; }
.mobile-head { padding: 22px 20px 15px; background: var(--green); color: white; border-radius: 0 0 26px 26px; }
.mobile-head-row { display: flex; justify-content: space-between; align-items: center; }
.mobile-head h1 { font-size: 22px; margin: 17px 0 6px; }
.mobile-head p { margin: 0; color: #c9dbd3; font-size: 13px; }
.mobile-content { padding: 16px; }
.mobile-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 16px; margin-bottom: 12px; box-shadow: 0 8px 22px rgba(26,55,42,.05); }
.mobile-card h2 { margin: 0 0 13px; font-size: 16px; }
.next-class { background: var(--lime); color: #173e2f; border: 0; }
.next-tag { display: inline-block; background: rgba(23,79,59,.12); padding: 4px 8px; border-radius: 999px; font-size: 11px; }
.next-class h2 { margin: 14px 0 5px; font-size: 20px; }
.next-meta { font-size: 13px; line-height: 1.8; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 14px 0; }
.quick { border: 0; background: white; border-radius: 14px; padding: 12px 5px; color: var(--ink); font-size: 11px; display: grid; gap: 7px; place-items: center; }
.quick i { width: 33px; height: 33px; border-radius: 11px; display: grid; place-items: center; background: #eef4ec; font-style: normal; font-size: 16px; }
.mobile-list { display: grid; gap: 10px; }
.mobile-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid #edf0ec; padding-top: 12px; }
.mobile-row:first-child { border-top: 0; padding-top: 0; }
.mobile-row strong { display: block; font-size: 14px; margin-bottom: 4px; }
.mobile-row small { color: var(--muted); line-height: 1.5; }
.mobile-nav { position: fixed; z-index: 8; bottom: 0; left: 50%; transform: translateX(-50%); width: min(520px, 100%); height: 70px; background: rgba(255,255,255,.96); backdrop-filter: blur(15px); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px; }
.mobile-nav button { border: 0; background: transparent; color: #7b8781; border-radius: 11px; font-size: 10px; display: grid; place-items: center; gap: 2px; }
.mobile-nav button span { font-size: 18px; }
.mobile-nav button.active { color: var(--green); background: #eef4ef; }
.attendance-actions { display: flex; gap: 6px; }
.att-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 9px; font-size: 11px; color: var(--muted); }
.att-btn.active.present { background: #e7f5eb; color: #28764c; border-color: #b9ddc5; }
.att-btn.active.leave { background: #fff0e8; color: #9a4c2d; border-color: #efc3ad; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .room-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 16px; height: 64px; }
  .content { padding: 18px 14px 30px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 23px; }
  .room-grid { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 70px 5px 1fr; }
  .schedule-row > :nth-child(4), .schedule-row > :nth-child(5) { display: none; }
  .page-head { align-items: flex-start; }
  .form { grid-template-columns: 1fr; }
  .field.full, .modal-actions, .conflicts { grid-column: auto; }
}
