:root {
  color-scheme: light;
  --ink: #252522;
  --muted: #85837e;
  --line: #e9e6df;
  --paper: #fbfaf7;
  --white: #fff;
  --rose: #b86e68;
  --rose-dark: #995a55;
  --rose-soft: #f7eae7;
  --green: #52745e;
  --green-soft: #e9f0e9;
  --amber-soft: #fbf2dd;
  --shadow: 0 22px 60px rgba(48, 40, 33, .08);
  font-family: 'DM Sans', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(184,110,104,.25); outline-offset: 2px; }
.serif { font-family: 'Playfair Display', Georgia, serif; }
.hidden { display: none !important; }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 34px; height: 54px; flex: 0 0 auto; object-fit: contain; mix-blend-mode: multiply; }
.brand-name { font: 600 16px 'Playfair Display', Georgia, serif; letter-spacing: .01em; white-space: nowrap; }
.brand-sub { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr); background: #f7f5f1; }
.login-panel { display: flex; flex-direction: column; justify-content: space-between; padding: 38px clamp(32px, 6vw, 92px); }
.login-panel-top { display: flex; align-items: center; justify-content: space-between; }
.login-body { width: min(420px, 100%); margin: auto; padding: 64px 0 76px; }
.eyebrow { color: var(--rose-dark); font-size: 10px; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }
.login-body h1 { margin: 15px 0 10px; font: 500 clamp(34px, 4vw, 46px)/1.14 'Playfair Display', Georgia, serif; letter-spacing: -.025em; }
.login-intro { margin: 0 0 34px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid #e5e1da; border-radius: 8px; background: #fff; color: var(--ink); font-size: 13px; }
.field textarea { min-height: 90px; padding: 12px; resize: vertical; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 72px; }
.text-button { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); border: 0; background: none; color: var(--rose-dark); font-size: 11px; font-weight: 700; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin: 5px 0 22px; color: var(--muted); font-size: 11px; }
.remember { display: flex; align-items: center; gap: 7px; }
.remember input { accent-color: var(--rose); }
.login-row a { color: var(--rose-dark); text-decoration: none; }
.btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 700; transition: .18s ease; }
.btn-primary { color: #fff; background: var(--rose); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-full { width: 100%; min-height: 47px; }
.btn-quiet { color: #4e4b46; border-color: var(--line); background: #fff; }
.btn-quiet:hover { border-color: #d7b7b2; color: var(--rose-dark); }
.btn-small { min-height: 35px; padding: 0 12px; }
.login-safety { display: flex; gap: 9px; margin-top: 22px; padding: 12px 13px; border: 1px solid #eadfd4; border-radius: 7px; background: #faf6f0; color: #766b61; font-size: 10px; line-height: 1.55; }
.login-safety svg { flex: 0 0 auto; margin-top: 1px; }
.login-foot { color: #aaa69f; font-size: 10px; }
.login-art { position: relative; min-height: 720px; overflow: hidden; display: flex; align-items: flex-end; padding: clamp(36px, 6vw, 80px); background: #6e4945; }
.login-art::before, .login-art::after { position: absolute; content: ''; pointer-events: none; }
.login-art::before { inset: 0; background: linear-gradient(180deg, rgba(41,30,28,.06) 15%, rgba(38,28,27,.76) 100%), radial-gradient(ellipse at 55% 33%, #c2978b 0, #9b7168 34%, #674945 75%); }
.art-shape { position: absolute; top: 7%; left: 17%; width: 67%; height: 81%; border: 1px solid rgba(255,255,255,.3); border-radius: 48% 48% 2% 2%; transform: rotate(-6deg); }
.art-shape::before { position: absolute; inset: 10% 8% 0; content: ''; border: 1px solid rgba(255,255,255,.2); border-radius: 48% 48% 1% 1%; }
.art-swatch { position: absolute; right: 20%; top: 13%; width: 25%; height: 52%; background: linear-gradient(135deg,#e2c1ae,#bc8f83); clip-path: polygon(25% 0,74% 0,100% 100%,0 100%); opacity: .86; transform: rotate(7deg); }
.art-swatch::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 17px, rgba(255,255,255,.16) 18px 19px); }
.art-seal { position: absolute; top: 17%; left: 28%; width: 120px; height: 120px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; color: rgba(255,255,255,.84); font: 45px 'Playfair Display', Georgia, serif; }
.art-copy { position: relative; z-index: 1; max-width: 450px; color: white; }
.art-copy .eyebrow { color: #f0d2c8; }
.art-copy h2 { margin: 15px 0 12px; font: 500 clamp(34px, 4vw, 48px)/1.14 'Playfair Display', Georgia, serif; }
.art-copy p { max-width: 370px; margin: 0; color: rgba(255,255,255,.74); font-size: 13px; line-height: 1.7; }
.art-credit { position: absolute; z-index: 1; right: 28px; bottom: 25px; color: rgba(255,255,255,.58); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }

/* App layout */
.portal { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 17px 19px; border-right: 1px solid var(--line); background: #fff; }
.sidebar .brand { padding: 0 8px 28px; }
.nav-label { margin: 6px 10px 10px; color: #aaa69f; font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }
.sidebar .nav-list { min-height: 0; flex: 1; overflow-y: auto; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 7px; background: transparent; color: #77746f; text-align: left; font-size: 12px; font-weight: 500; }
.nav-item.active { background: #f8efed; color: var(--rose-dark); font-weight: 700; }
.nav-item svg { width: 17px; height: 17px; }
.nav-count { margin-left: auto; padding: 3px 7px; border-radius: 20px; background: #fff; color: var(--rose-dark); font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.demo-card { margin: 12px 3px 17px; padding: 13px; border: 1px solid #eee6da; border-radius: 8px; background: #fcfaf5; }
.demo-card strong { display: block; margin-bottom: 5px; font-size: 10px; }
.demo-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.profile-mini { display: flex; align-items: center; gap: 10px; padding: 15px 5px 0; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #f2dfdc; color: #925e58; font: 600 12px 'Playfair Display', Georgia, serif; }
.profile-name { font-size: 11px; font-weight: 700; }
.profile-role { margin-top: 3px; color: var(--muted); font-size: 10px; }
.main { min-width: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.76); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: #a09c96; font-size: 11px; }
.breadcrumb strong { color: #46433f; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 17px; }
.top-date { color: var(--muted); font-size: 10px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #6f6c67; }
.icon-button svg { width: 15px; height: 15px; }
.content { max-width: 1440px; margin: 0 auto; padding: 32px 38px 55px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.page-heading h1 { margin: 7px 0 5px; font: 500 30px 'Playfair Display', Georgia, serif; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.heading-actions { display: flex; gap: 9px; }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { min-height: 108px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: #f8efed; color: var(--rose); }
.stat-icon svg { width: 14px; height: 14px; }
.stat-number { margin-top: 13px; font: 500 26px 'Playfair Display', Georgia, serif; }
.stat-note { margin-left: 7px; color: var(--green); font: 600 9px 'DM Sans', sans-serif; }
.table-card { border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.table-head h2 { margin: 0; font: 500 18px 'Playfair Display', Georgia, serif; }
.table-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.list-controls { display: flex; gap: 8px; }
.search-box { position: relative; width: 235px; }
.search-box svg { position: absolute; top: 50%; left: 11px; width: 14px; transform: translateY(-50%); color: #aaa69f; }
.search-box input, .filter-select { height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #55524d; font-size: 10px; }
.search-box input { width: 100%; padding: 0 10px 0 33px; }
.filter-select { padding: 0 28px 0 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
thead { background: #fcfbf9; }
th { height: 39px; padding: 0 16px; color: #9a9690; font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
td { height: 61px; padding: 8px 16px; border-top: 1px solid #f1efeb; color: #55524e; font-size: 10px; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #fdfaf8; }
.student-cell { display: flex; align-items: center; gap: 10px; }
.student-cell .avatar { width: 31px; height: 31px; }
.student-cell strong { display: block; color: #383632; font-size: 10px; font-weight: 700; }
.student-cell small { display: block; margin-top: 4px; color: #a09c96; font-size: 9px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; font-size: 9px; font-weight: 600; }
.status::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ''; }
.status-active { background: var(--green-soft); color: var(--green); }
.status-inactive { background: #f2f0ed; color: #858078; }
.row-menu { border: 0; background: none; color: #aaa69f; font-size: 19px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; padding: 13px 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.pagination { display: flex; gap: 5px; }
.page-btn { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: #77746f; font-size: 10px; }
.page-btn.current { border-color: var(--rose); background: var(--rose); color: #fff; }
.empty-state { padding: 42px; color: var(--muted); text-align: center; font-size: 12px; }
.subpage { display: grid; grid-template-columns: minmax(260px,.74fr) minmax(420px,1.5fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.profile-card { padding: 23px; text-align: center; }
.profile-card .avatar { width: 64px; height: 64px; margin: 0 auto 13px; font-size: 22px; }
.profile-card h2 { margin: 0; font: 500 21px 'Playfair Display', Georgia, serif; }
.profile-card p { margin: 5px 0 16px; color: var(--muted); font-size: 10px; }
.profile-card .status { margin-bottom: 17px; }
.profile-meta { display: grid; gap: 13px; padding-top: 17px; border-top: 1px solid var(--line); text-align: left; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 10px; }
.meta-row strong { color: #4d4a46; font-weight: 600; text-align: right; }
.form-panel { padding: 21px; }
.form-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.form-panel-head h2 { margin: 0; font: 500 18px 'Playfair Display', Georgia, serif; }
.form-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.form-grid .field { margin-bottom: 15px; }
.form-grid .field label { color: #625f5a; font-size: 10px; }
.form-grid .field input, .form-grid .field select { min-height: 39px; font-size: 11px; }
.form-grid .field textarea { min-height: 78px; font-size: 11px; }
.field-wide { grid-column: 1 / -1; }
.form-section-title { margin: 8px 0 13px; padding-top: 17px; border-top: 1px solid var(--line); color: #504c47; font: 500 15px 'Playfair Display', Georgia, serif; }
.form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.optional-section { color: #77736c; }
.additional-details { margin: 4px 0 17px; padding: 13px 0 0; border-top: 1px solid var(--line); }
.additional-details summary { color: #6c6862; cursor: pointer; font-size: 11px; font-weight: 600; }
.additional-details[open] summary { margin-bottom: 14px; }
.additional-details .form-grid { margin-top: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.announcement { margin: 0 0 18px; padding: 10px 13px; border: 1px solid #ecdfc2; border-radius: 7px; background: #fdf8ec; color: #806943; font-size: 10px; line-height: 1.5; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; padding: 12px 16px; border-radius: 7px; background: #34332f; box-shadow: var(--shadow); color: #fff; font-size: 11px; animation: toast-in .18s ease; }
.portal-switch { margin-top: 19px; color: var(--muted); font-size: 11px; text-align: center; }
.portal-switch a { margin-left: 4px; color: var(--rose-dark); font-weight: 700; text-decoration: none; }
.record-dialog { width: min(640px, calc(100% - 30px)); max-height: min(85vh, 780px); padding: 22px; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.record-dialog::backdrop { background: rgba(35,32,28,.36); backdrop-filter: blur(2px); }
.record-dialog form { margin: 0; }
.record-dialog .form-panel-head { margin-bottom: 15px; }
.dialog-close { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #6f6c67; font-size: 18px; }
.error-notice { border-color: #e9c8c4; background: #fbefed; color: #8e4e49; }
.record-dialog .field textarea { min-height: 74px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.mobile-menu { display: none; }

@media(max-width: 1000px) {
  .login-page { grid-template-columns: minmax(340px,.9fr) minmax(350px,1.1fr); }
  .portal { grid-template-columns: 210px 1fr; }
  .topbar { padding: 0 24px; }
  .content { padding: 27px 24px 44px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .subpage { grid-template-columns: minmax(220px,.7fr) minmax(350px,1.3fr); }
}
@media(max-width: 740px) {
  .login-page { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 23px 25px; }
  .login-art { display: none; }
  .login-body { padding: 55px 0; }
  .login-foot { padding-top: 22px; }
  .portal { display: block; }
  .sidebar { position: fixed; z-index: 5; left: 0; width: 248px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .topbar { height: 60px; padding: 0 16px; }
  .top-actions { gap: 9px; }
  .top-date { display: none; }
  .content { padding: 23px 15px 36px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 26px; }
  .heading-actions { flex-direction: column; }
  .stat-card { min-height: 98px; padding: 13px; }
  .stat-number { font-size: 23px; }
  .table-head { align-items: flex-start; flex-direction: column; padding: 16px; }
  .list-controls { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .filter-select { max-width: 125px; }
  .subpage { grid-template-columns: 1fr; }
  .profile-card { display: none; }
}
@media(max-width: 430px) {
  .brand-name { font-size: 14px; }
  .brand-logo { width: 30px; height: 48px; }
  .login-panel { padding: 20px; }
  .page-heading { flex-direction: column; }
  .heading-actions { width: 100%; flex-direction: row; }
  .heading-actions .btn { flex: 1; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 11px; }
  .stat-top { font-size: 9px; }
  .table-foot { align-items: flex-start; flex-direction: column; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
}
