:root {
  --ink: #172033;
  --muted: #697386;
  --line: #e7eaf0;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --navy: #111827;
  --blue: #4c6fff;
  --teal: #0ea5a4;
  --orange: #f97316;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 10px 30px rgba(22, 31, 51, .07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: .04em; font-weight: 700; text-transform: uppercase; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: linear-gradient(135deg, #f7f8fb 0%, #eef2ff 55%, #e9f9f7 100%); }
.login-card { width: min(440px, 100%); background: var(--surface); border: 1px solid rgba(255,255,255,.8); box-shadow: 0 24px 70px rgba(31,42,68,.15); padding: 42px; border-radius: 18px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: white; background: var(--navy); font-weight: 800; letter-spacing: -.08em; }
.brand-row { display: flex; gap: 14px; align-items: center; margin-bottom: 30px; }
.brand-row h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.brand-row p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.login-card h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 700; color: #3d475a; }
.field input, .field select, .field textarea, .search-input { border: 1px solid #dfe3eb; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; transition: border .2s, box-shadow .2s; }
.field textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76,111,255,.12); }
.primary-btn, .secondary-btn, .danger-btn, .icon-btn { border: 0; border-radius: 8px; padding: 10px 15px; font-weight: 700; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-btn { color: white; background: var(--blue); box-shadow: 0 5px 12px rgba(76,111,255,.2); }
.primary-btn:hover { background: #3b5be3; transform: translateY(-1px); }
.secondary-btn { color: #364052; background: #f0f2f6; }
.secondary-btn:hover { background: #e5e8ef; }
.secondary-btn:disabled, .primary-btn:disabled { cursor: wait; opacity: .6; }
.danger-btn { color: white; background: var(--red); }
.icon-btn { padding: 8px; color: #59657a; background: transparent; font-size: 17px; line-height: 1; }
.icon-btn:hover { color: var(--ink); background: #f0f2f6; }
.login-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; }
.demo-accounts { margin-top: 18px; padding: 12px 14px; border-radius: 9px; background: #f7f8fb; color: var(--muted); font-size: 12px; line-height: 1.6; }

.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; padding: 24px 15px 18px; color: #d4d9e4; background: var(--navy); }
.sidebar .brand-row { padding: 0 10px; margin-bottom: 34px; }
.sidebar .brand-mark { background: #2d3b62; }
.sidebar .brand-row h1 { color: white; }
.sidebar .brand-row p { color: #96a0b6; }
.nav-label { padding: 0 11px; margin: 0 0 8px; color: #77839a; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav-button { display: flex; align-items: center; gap: 10px; border: 0; border-radius: 8px; padding: 11px; color: #aeb8ca; background: transparent; text-align: left; font-weight: 650; }
.nav-button:hover { color: white; background: #1f293d; }
.nav-button.active { color: white; background: #273352; box-shadow: inset 3px 0 0 var(--blue); }
.nav-icon { width: 18px; text-align: center; color: #8ea2ff; font-size: 15px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 15px; }
.user-mini { display: flex; align-items: center; gap: 10px; border-top: 1px solid #293449; padding: 17px 9px 0; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: #25345a; background: #c8d4ff; font-size: 13px; font-weight: 800; }
.user-mini strong { display: block; color: #f1f4fa; font-size: 13px; }
.user-mini span { color: #8c98ad; font-size: 11px; }
.logout { width: 100%; border: 1px solid #354057; padding: 9px; border-radius: 8px; color: #b8c0d1; background: transparent; }
.logout:hover { color: white; background: #1f293d; }

.main { min-width: 0; }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.topbar .subline { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.content { max-width: 1520px; margin: 0 auto; padding: 30px 34px 50px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.page-head h1 { margin: 5px 0 0; font-size: 28px; letter-spacing: -.05em; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric { min-height: 126px; border: 1px solid var(--line); border-radius: 13px; padding: 19px; background: var(--surface); box-shadow: var(--shadow); }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #eef1ff; color: var(--blue); }
.metric strong { display: block; margin-top: 15px; font-size: 27px; letter-spacing: -.05em; }
.metric small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 20px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.panel-head a, .text-button { border: 0; color: var(--blue); background: none; font-size: 12px; font-weight: 700; }
.panel-body { padding: 20px; }
.pipeline-list { display: grid; gap: 17px; }
.pipeline-row { display: grid; grid-template-columns: 90px minmax(0,1fr) 90px; align-items: center; gap: 12px; font-size: 12px; }
.pipeline-row > span:first-child { color: #4a5568; }
.bar { height: 8px; border-radius: 99px; background: #edf0f5; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; min-width: 4px; }
.pipeline-value { color: #4c566b; text-align: right; font-variant-numeric: tabular-nums; }
.todo-list, .recent-list { display: grid; }
.todo-item, .recent-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #eef0f4; }
.todo-item:last-child, .recent-item:last-child { border-bottom: 0; }
.todo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px #fff3eb; flex: 0 0 auto; }
.todo-main, .recent-main { min-width: 0; flex: 1; }
.todo-main strong, .recent-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.todo-main span, .recent-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.todo-date { color: var(--orange); font-size: 11px; font-weight: 700; }
.status-pill, .tag { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 9px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-pill { color: #3d475a; background: #eef1f5; }
.tag { margin: 2px 3px 2px 0; color: #57647a; background: #f0f2f6; }
.empty { padding: 32px 10px; color: var(--muted); text-align: center; font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search-wrap { position: relative; flex: 1 1 260px; }
.search-icon { position: absolute; top: 11px; left: 12px; color: #9aa4b7; font-size: 14px; }
.search-input { width: 100%; padding-left: 34px; }
.filter-select { min-width: 130px; border: 1px solid #dfe3eb; padding: 10px 12px; border-radius: 8px; color: #48536a; background: white; }
.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 890px; }
th, td { padding: 15px 20px; border-bottom: 1px solid #eef0f4; text-align: left; font-size: 12px; vertical-align: middle; }
th { color: #7b8495; background: #fbfbfc; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #fafbff; }
td strong { display: block; font-size: 13px; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.owner-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mini-avatar { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: #314273; background: #e4e9ff; font-size: 10px; font-weight: 800; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.date-overdue { color: var(--red); font-weight: 700; }
.row-actions { display: flex; gap: 2px; }

.class-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.class-card { padding: 20px; }
.class-card-top { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.class-card h3 { margin: 6px 0 0; font-size: 16px; }
.class-progress { margin-top: 22px; }
.class-progress > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.class-progress strong { color: var(--ink); }
.progress { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: #edf0f5; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.class-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.class-meta span { color: var(--muted); font-size: 11px; }
.class-meta strong { display: block; margin-top: 4px; color: var(--ink); font-size: 12px; font-weight: 650; }
.schedule-board { display: grid; gap: 16px; }
.schedule-list { display: grid; }
.schedule-item { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid #eef0f4; }
.schedule-item:last-child { border-bottom: 0; }
.schedule-date, .time-block { width: 52px; flex: 0 0 auto; text-align: center; color: var(--muted); }
.schedule-date strong, .time-block strong { display: block; color: var(--ink); font-size: 17px; }
.schedule-date span, .time-block span { display: block; margin-top: 2px; font-size: 10px; }
.schedule-main { min-width: 0; flex: 1; }
.schedule-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.schedule-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.score { font-variant-numeric: tabular-nums; }
.score.good { color: #16803c; }
.score.normal { color: #a65d00; }
.score.warning { color: #c0362c; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(16, 24, 40, .45); }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 14px; background: white; box-shadow: 0 24px 70px rgba(16,24,40,.22); }
.modal.small { width: min(500px, 100%); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 22px 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding-top: 22px; }
.detail-head { display: flex; align-items: start; gap: 15px; }
.detail-avatar { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; color: #293863; background: #e8edff; font-size: 20px; font-weight: 800; }
.detail-head h2 { margin: 3px 0 0; }
.detail-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.detail-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 20px; }
.detail-meta div { padding: 12px; border-radius: 9px; background: #f7f8fb; }
.detail-meta span { display: block; color: var(--muted); font-size: 11px; }
.detail-meta strong { display: block; margin-top: 5px; font-size: 13px; }
.activity-title { margin: 25px 0 9px; font-size: 13px; }
.activity { display: flex; gap: 10px; padding: 13px 0; border-top: 1px solid #eef0f4; }
.activity-line { width: 2px; min-height: 35px; background: #d9e0ff; }
.activity strong { display: block; font-size: 12px; }
.activity p { margin: 4px 0 0; color: #566174; font-size: 12px; line-height: 1.5; }
.activity time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 360px; padding: 12px 16px; border-radius: 9px; color: white; background: #172033; box-shadow: 0 10px 30px rgba(23,32,51,.25); font-size: 13px; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { min-height: auto; padding: 13px 14px; }
  .sidebar .brand-row { margin: 0; padding: 0; }
  .sidebar .nav-label, .sidebar-bottom { display: none; }
  .nav { display: flex; overflow-x: auto; margin-top: 12px; }
  .nav-button { flex: 0 0 auto; padding: 8px 10px; font-size: 12px; }
  .topbar { height: auto; padding: 16px 18px; }
  .topbar .top-actions { display: none; }
  .content { padding: 22px 16px 40px; }
  .page-head { display: block; }
  .page-actions { margin-top: 16px; }
  .metrics { gap: 10px; }
  .metric { min-height: 110px; padding: 14px; }
  .metric strong { margin-top: 12px; font-size: 22px; }
  .panel-head, .panel-body { padding: 16px; }
  .form-grid, .detail-meta { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .class-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px; }
}
