:root {
  color-scheme: light;
  font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f5f6f2;
  --surface: #fff;
  --ink: #182922;
  --muted: #53655b;
  --line: #dce5dd;
  --edge: #e8ede7;
  --green: #215f49;
  --forest: #14392f;
  --deep: #102a23;
  --mint: #e6f2e9;
  --lime: #d5e89e;
  --radius: 17px;
  --shadow: 0 2px 4px #203d2c08, 0 10px 28px #203d2c07;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.1rem, 4.7vw, 3.55rem); line-height: 1.04; letter-spacing: -.065em; font-weight: 720; }
h2 { font-size: 1.12rem; line-height: 1.25; letter-spacing: -.025em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid #448268; outline-offset: 3px; }
.primary, .secondary, .danger, .close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: .89rem;
  font-weight: 680;
  white-space: nowrap;
}
.primary { background: var(--green); border-color: var(--green); color: white; }
.primary:hover:enabled { background: var(--forest); border-color: var(--forest); }
.secondary:hover, .close-button:hover { background: var(--mint); border-color: #c3d9ca; }
.danger { background: #a43035; border-color: #a43035; color: white; }
.danger:hover { background: #852429; }
.text-button { border: 0; border-radius: 6px; padding: 5px 7px; background: transparent; color: var(--green); font-size: .84rem; font-weight: 680; white-space: nowrap; }
.text-button:hover { background: var(--mint); }
.text-button.danger-text { color: #99353b; }
.text-button.danger-text:hover { background: #faeeee; }
input, textarea, select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #d6e0d7;
  border-radius: 9px;
  padding: 8px 12px;
  background: #fbfcfa;
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #617268; }
input[type="search"], select { font-size: .875rem; }
select { width: auto; }
textarea { display: block; resize: vertical; line-height: 1.65; }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--lime);
  color: var(--deep);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  padding: 0 6px 3px 0;
}
.brand-mark::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: currentColor; right: 8px; bottom: 10px; }
.login-panel {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 15%, #e4efe0, transparent 68%), var(--bg);
}
.auth-loading { display: grid; justify-items: center; gap: 14px; color: var(--muted); }
.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 790px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 25px;
  overflow: hidden;
  box-shadow: 0 25px 90px #173d2924;
}
.login-brand, .overview-head {
  color: #f4f8ee;
  background:
    repeating-radial-gradient(circle at 100% 100%, transparent 0 27px, #dcf0bc21 28px 29px, transparent 30px 44px),
    linear-gradient(115deg, var(--deep), #245d49);
}
.login-brand { display: grid; justify-items: start; align-content: space-between; min-height: 340px; padding: clamp(23px, 5vw, 44px); }
.login-brand h1 { margin-top: 35px; }
.login-content { display: grid; align-content: center; padding: clamp(24px, 5vw, 45px); }
.login-content h2 { font-size: clamp(1.55rem, 3vw, 2rem); }
.login-content p { color: var(--muted); margin: 9px 0 24px; }
.login-content .primary { justify-content: space-between; }
.login-content .feedback { margin: 12px 0 0; }
.feedback:empty { display: none; }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 29px 15px 19px;
  background: var(--deep);
  color: #f3f8ee;
}
.sidebar :focus-visible, .overview-head :focus-visible { outline-color: var(--lime); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; line-height: 1.06; }
.brand strong { display: block; font-size: 1.45rem; letter-spacing: -.07em; }
.brand small { display: block; margin-top: 5px; font-size: .72rem; color: #bdd2c8; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #d2e2d9;
  text-align: left;
  font-size: .87rem;
  font-weight: 580;
  white-space: nowrap;
}
.nav-icon { display: grid; place-items: center; flex: 0 0 20px; height: 20px; color: #a8c4b6; font-size: 1.12rem; line-height: 1; }
.sidebar button:hover { background: #203e34; color: white; }
.sidebar button[aria-current="page"] { border-color: #486656; background: #28483a; color: #f3f8eb; }
.sidebar button[aria-current="page"] .nav-icon { color: var(--lime); }
.sidebar .sign-out { margin-top: auto; border-top-color: #30483e; }
.content { min-width: 0; width: min(100%, 1360px); margin-inline: auto; padding: clamp(24px, 4vw, 54px) clamp(18px, 4vw, 56px) 60px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 24px; }
.page-head p { margin-top: 10px; color: var(--muted); }
.overview-head {
  align-items: end;
  min-height: 170px;
  padding: clamp(22px, 3.4vw, 39px);
  border: 1px solid #2b5444;
  border-radius: 19px;
  box-shadow: var(--shadow);
  background-size: 60% auto, cover;
  background-position: right bottom, center;
  background-repeat: no-repeat;
}
.overview-head p, .overview-head .range { color: #d7e8da; }
.overview-head select { background: #204b3d; color: #f3f8ef; border-color: #608072; }
.range { display: grid; gap: 5px; flex: 0 0 auto; color: var(--muted); font-size: .77rem; font-weight: 650; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric { display: grid; gap: 7px; min-width: 0; padding: clamp(13px, 1.75vw, 22px); }
.metric-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 5px;
  border-radius: 9px;
  background: var(--mint);
  color: var(--green);
  font-size: 1.12rem;
  font-weight: 700;
}
.metric.failed .metric-icon { background: #faeee9; color: #8b4236; }
.metric.timing .metric-icon { background: #eef0e1; color: #536231; }
.metric-label { color: var(--muted); font-size: .85rem; font-weight: 580; }
.metric strong { font-size: clamp(1.55rem, 3.4vw, 2.55rem); letter-spacing: -.065em; font-variant-numeric: tabular-nums; line-height: 1.05; overflow-wrap: anywhere; }
.panel { min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px clamp(14px, 2vw, 22px); border-bottom: 1px solid var(--edge); }
.panel-head input, .panel-head select { max-width: 220px; }
.table-scroll { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.table-scroll:focus-visible { outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { background: #f7f9f5; color: var(--muted); font-size: .76rem; font-weight: 720; letter-spacing: .02em; white-space: nowrap; }
td, th { padding: 13px clamp(14px, 2vw, 22px); border-bottom: 1px solid var(--edge); vertical-align: middle; }
tbody tr:hover { background: #fcfdfa; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { min-width: 155px; overflow-wrap: anywhere; }
.table-title { font-weight: 670; }
.reschedule-history { margin-top: 18px; }
.seat-count { display: block; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
#class-rows summary { min-width: max-content; cursor: pointer; color: var(--green); font-size: .88rem; font-weight: 650; }
#class-rows details ul { margin: 7px 0 0; padding-left: 17px; }
.document-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 3px 5px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 9px; background: #edf0eb; color: #40554a; font-size: .75rem; font-weight: 690; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.ready, .badge.delivered, .badge.read, .badge.received, .badge.resolved { background: var(--mint); color: #205744; }
.badge.failed { background: #f9e9e8; color: #922e34; }
.badge.indexing, .badge.pending, .badge.uploading, .badge.finishing, .badge.archiving, .badge.deleting, .badge.needs_staff { background: #faf1d9; color: #755411; }
.message-grid { display: grid; grid-template-columns: minmax(235px, .82fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
#inbox { max-height: clamp(280px, 56vh, 640px); overflow: auto; }
#inbox, #activity { border-radius: 0 0 var(--radius) var(--radius); }
.message-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 12px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--edge);
  border-inline-start: 3px solid transparent;
  background: var(--surface);
  color: var(--ink);
  padding: 13px clamp(12px, 1.8vw, 20px);
  text-align: left;
}
.message-item::after { content: "›"; grid-area: 1 / 2 / 3 / 3; color: var(--green); font-size: 1.25rem; line-height: 1; }
.message-item:hover, .message-item[aria-current="true"] { background: #eff7ef; border-inline-start-color: #6f9b78; }
.message-item:focus-visible { outline-offset: -3px; }
.message-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.message-item span:first-child { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: .91rem; font-weight: 660; }
.message-item time { font-size: .77rem; color: var(--muted); }
.conversation { min-height: 245px; background: #fafbf8; }
.conversation .panel-head { flex-wrap: wrap; }
.conversation h2 { overflow-wrap: anywhere; }
.conversation .panel-head button { margin-left: auto; }
.conversation > .empty { display: grid; place-items: center; min-height: inherit; text-align: center; }
.bubbles { display: grid; justify-items: start; align-content: start; gap: 15px; padding: clamp(13px, 2vw, 22px); }
.bubble { max-width: min(88%, 560px); padding: 12px 15px; border: 1px solid var(--edge); border-radius: 4px 15px 15px 15px; background: white; overflow-wrap: anywhere; }
.bubble.outbound { justify-self: end; border-radius: 15px 4px 15px 15px; background: #e6f2e8; border-color: #d9e8da; }
.bubble p { white-space: pre-wrap; }
.bubble small { display: block; margin-top: 6px; color: var(--muted); }
.bubble .badge { margin-top: 7px; background: #f6fbf6; }
.bubble .badge.failed { background: #f9e9e8; }
.empty { padding: 25px 20px; color: var(--muted); font-size: .91rem; }
.question-form, .result { padding: clamp(16px, 3.1vw, 29px); max-width: 850px; }
.question-form { display: grid; gap: 11px; }
.question-form label { font-weight: 680; }
.question-form textarea { min-height: 122px; }
.question-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; }
.occupancy { display: grid; gap: 5px; width: min(100%, 8rem); }
.seat-meter { appearance: none; display: block; width: 100%; height: 5px; border: 0; border-radius: 999px; overflow: hidden; background: var(--edge); }
.seat-meter::-webkit-progress-bar { background: var(--edge); }
.seat-meter::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.seat-meter::-moz-progress-bar { background: var(--green); border-radius: 999px; }
.occupancy-full .seat-meter::-webkit-progress-value { background: #a46a22; }
.occupancy-full .seat-meter::-moz-progress-bar { background: #a46a22; }
.occupancy-unavailable .seat-meter::-webkit-progress-value { background: #78877c; }
.occupancy-unavailable .seat-meter::-moz-progress-bar { background: #78877c; }
#class-rows td > .badge { margin-top: 6px; }
.shortcut { font-size: .78rem; color: var(--muted); }
.result { margin-top: 16px; border-inline-start: 3px solid #73a17e; overflow-wrap: anywhere; }
.result h2 { margin-bottom: 10px; }
.result p { white-space: pre-wrap; }
.result ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.result h3 { margin: 16px 0 0; font-size: .87rem; }
.notice { margin-bottom: 17px; border: 1px solid #c0dcce; border-radius: 10px; padding: 10px 14px; background: #eef7ef; }
.notice.error, .result.error { background: #fff6f2; border-color: #edc3bd; color: #7c2827; }
dialog {
  width: min(calc(100% - 28px), 520px);
  max-height: min(85vh, 760px);
  padding: clamp(17px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 22px 85px #102a2350;
}
dialog::backdrop { background: #10251db3; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dialog-head h2, #confirm-text { overflow-wrap: anywhere; }
dialog h2 { font-size: 1.34rem; padding-top: 4px; }
.close-button { min-width: 38px; min-height: 38px; padding: 0; font-size: 1.35rem; line-height: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.file-picker { padding: 16px; border: 1px dashed #a9c5b0; border-radius: 11px; background: #f5faf5; }
.file-picker label { font-weight: 670; }
.file-picker p, .feedback { color: var(--muted); font-size: .85rem; }
.file-picker input { padding: 5px; margin-top: 11px; background: white; }
.file-picker input::file-selector-button { margin-right: 9px; padding: 5px 9px; border: 0; border-radius: 5px; background: var(--mint); color: var(--green); font: inherit; cursor: pointer; }
.feedback, #confirm-text { margin-top: 8px; }
#preview-dialog { width: min(calc(100% - 28px), 760px); }
.preview-text, .preview-entry p { white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-entry { padding: 11px 0; border-bottom: 1px solid var(--edge); }
.preview-entry summary { font-weight: 660; cursor: pointer; }
.preview-entry p { margin: 8px 0; }
@media (max-width: 1030px) {
  .shell { grid-template-columns: 181px minmax(0, 1fr); }
  .sidebar { padding-inline: 11px; }
}
@media (max-width: 850px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .message-grid { grid-template-columns: 1fr; }
  #inbox { max-height: 320px; }
  .conversation { min-height: 155px; scroll-margin-top: 16px; }
  .table-scroll table, .table-scroll tbody { display: block; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .table-scroll tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 12px; padding: 14px; }
  .table-scroll tbody tr + tr { border-top: 1px solid var(--edge); }
  .table-scroll td { min-width: 0; border: 0; padding: 0; overflow-wrap: anywhere; }
  .table-scroll td::before { display: block; content: attr(data-label) / ""; color: var(--muted); font-size: .72rem; font-weight: 660; }
  .table-scroll td:first-child, #document-rows td:last-child, #class-rows td:last-child, #rescheduling-rows td:last-child { grid-column: 1 / -1; }
  .table-scroll td:first-child::before, #document-rows td:last-child::before, #class-rows td:last-child::before { content: none; }
  .table-scroll td:first-child { font-weight: 670; }
  .table-scroll td.empty { font-weight: 400; }
  .row-actions { margin-inline: -5px; }
  .row-actions button { min-height: 36px; }
}
@media (max-width: 650px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: 12px 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .brand { padding: 0 2px; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar .sign-out { margin: 0; border-top-color: transparent; }
  .sidebar nav button { padding-inline: 6px; gap: 4px; font-size: .78rem; white-space: normal; }
  .nav-icon { flex-basis: 15px; font-size: .95rem; }
  .content { padding: 22px 13px 40px; }
  .page-head { align-items: start; flex-wrap: wrap; }
  .overview-head { min-height: 0; background-size: 70% 100%, cover; }
  .metrics { gap: 9px; margin-bottom: 16px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head input { flex: 1 1 130px; }
  .bubble { max-width: 95%; }
}
@media (max-width: 540px) {
  .login-card { grid-template-columns: 1fr; }
  .login-brand { min-height: 170px; }
  .login-brand h1 { margin-top: 22px; }
  .login-brand br { display: none; }
}
