:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #111;
  --line: #2d2d2d;
  --muted: #929292;
  --text: #f5f4f0;
  --gold: #f4b400;
  --danger: #e7847b;
  font-family: Inter, "Plus Jakarta Sans", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); }
a { color: var(--gold); text-decoration: none; }
a:hover { color: #ffd968; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 35px 22px;
  background: radial-gradient(ellipse at 50% 4%, #151515 0, #090909 39%, #060606 76%);
}
.auth-card { width: min(100%, 380px); }
.auth-brand { display: grid; justify-items: center; margin-bottom: 58px; text-align: center; }
.auth-logo { display: block; width: 160px; height: 92px; margin: 0 auto 11px; object-fit: contain; }
.auth-divider { width: 60px; height: 1px; margin: 0 auto 20px; background: var(--gold); }
.auth-caption, .auth-title > span, .auth-footer {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.auth-title { margin: 0 0 22px; }
.auth-title > span { font-size: 9px; }
.auth-title h1 { margin: 11px 0 0; font-size: 22px; font-weight: 500; letter-spacing: .11em; text-transform: uppercase; }
.stack { display: grid; gap: 24px; }
label { display: grid; gap: 10px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: #0c0c0c;
  color: var(--text);
  padding: 12px;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
}
input:focus, textarea:focus, select:focus, .editor:focus { border-color: var(--gold); box-shadow: 0 0 0 1px #f4b40030; }
.auth-card .stack { gap: 24px; }
.auth-card label { gap: 10px; }
.auth-card input {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 13px;
  background: transparent;
}
.auth-card input:focus { border-bottom-color: var(--gold); box-shadow: none; }
.auth-submit {
  margin-top: 17px;
  border: 0;
  border-bottom: 1px solid var(--gold);
  padding: 16px 0;
  background: transparent;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.auth-submit:hover:not(:disabled) { color: #ffda68; }
.auth-submit:disabled { opacity: .45; cursor: not-allowed; }
.auth-footer { margin-top: 65px; text-align: center; font-size: 9px; letter-spacing: .2em; }
.setup-link { margin: 24px 0 0; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 12px; text-align: center; }
.notice { margin: 0 0 18px; border: 1px solid #594a20; border-left: 2px solid var(--gold); padding: 12px 14px; background: #f4b4000b; color: #ead8ad; font-size: 13px; line-height: 1.5; }
.notice.error { border-color: #67413e; border-left-color: var(--danger); background: #e18c850c; color: #ffb8b0; }
.notice.success { border-left-color: #91bb91; }

.top { position: sticky; z-index: 5; top: 0; border-bottom: 1px solid var(--line); background: #090909f5; }
.top-inner {
  display: flex;
  width: min(100%, 1560px);
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 42px);
}
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 13px; color: var(--text); }
.brand-logo { display: block; width: 94px; height: 48px; object-fit: contain; }
.brand-caption { border-left: 1px solid var(--gold); padding-left: 13px; color: var(--muted); font-size: 9px; letter-spacing: .19em; text-transform: uppercase; }
.top-nav { display: flex; align-items: center; gap: clamp(12px, 1.65vw, 26px); }
.top-nav a {
  border-bottom: 1px solid transparent;
  padding: 8px 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.top-nav a:hover, .top-nav a.active { border-bottom-color: var(--gold); color: var(--text); }
.user-menu { display: flex; flex: 0 0 auto; align-items: center; gap: 19px; }
.user-identity { display: grid; gap: 4px; text-align: right; }
.user-identity b { max-width: 160px; overflow: hidden; color: var(--text); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.user-identity small { color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.user-menu form { margin: 0; }
.link-button { border: 0; border-bottom: 1px solid var(--gold); padding: 6px 0; background: transparent; color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; }
.link-button:hover { color: var(--gold); }
.content { width: min(100%, 1500px); min-height: calc(100vh - 130px); margin: 0 auto; padding: clamp(37px, 5vw, 76px) clamp(20px, 4vw, 64px) 80px; }
.page-heading { margin-bottom: 24px; border-bottom: 1px solid var(--line); padding-bottom: 28px; }
.page-heading h1 { margin: 13px 0 0; color: var(--text); font-size: clamp(30px, 4.1vw, 49px); font-weight: 500; letter-spacing: -.025em; line-height: 1.08; text-transform: uppercase; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .25em; text-transform: uppercase; }
.lead { max-width: 760px; margin: 0 0 44px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 42px; border: 1px solid var(--gold); border-radius: 0; padding: 10px 16px; background: transparent; color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; transition: background .18s ease, color .18s ease; }
.button:hover { background: var(--gold); color: #100e08; }
.button.primary { background: var(--gold); color: #101010; }
.button.primary:hover { background: #ffd04a; }
.button.secondary { border-color: #464646; color: #d4d1ca; }
.button.secondary:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.button.danger { border-color: #754641; color: #ffaaa0; }
.button.small { min-height: 31px; padding: 6px 9px; font-size: 9px; letter-spacing: .08em; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.panel { margin: 28px 0; border: 0; border-top: 1px solid var(--line); padding: 24px 0; background: transparent; }
.panel h2 { margin: 0 0 18px; font-size: 14px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.panel p { color: #b8b8b8; line-height: 1.8; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: clamp(22px, 4vw, 54px); margin: 4px 0 64px; }
.stat { display: grid; align-content: start; gap: 15px; border: 0; border-top: 1px solid var(--line); padding: 22px 0 0; background: transparent; }
.stat > span { color: var(--muted); font-size: 9px; font-weight: 500; letter-spacing: .21em; text-transform: uppercase; }
.stat strong { color: var(--text); font-size: 39px; font-weight: 500; letter-spacing: -.02em; line-height: 1; }
.stat a { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .11em; text-transform: uppercase; }
.stat a:hover { color: var(--gold); }
.dashboard-actions { display: flex; align-items: center; justify-content: space-between; gap: 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 29px 0; }
.dashboard-actions h2, .section-heading h2 { margin: 10px 0; font-size: 19px; font-weight: 500; letter-spacing: -.01em; }
.dashboard-actions p { max-width: 670px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.dashboard-actions .button { flex: 0 0 auto; }
.recent-section { margin-top: 57px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading > a { color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.section-heading > a:hover { color: var(--gold); }
.empty-row { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 12px; }
.department-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 28px; }
.department-card { display: grid; gap: 11px; border-top: 1px solid var(--line); padding: 18px 0; color: var(--text); }
.department-card:hover { border-top-color: var(--gold); }
.department-card strong { font-size: 20px; font-weight: 500; }
.department-card small, .department-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.department-card h3 { margin: 0; font-size: 15px; font-weight: 500; }
.inline-field { display: flex; align-items: center; gap: 10px; }
.inline-field select { min-width: 150px; }
.department-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; border: 1px solid var(--line); padding: 16px; }
.department-checks legend { padding: 0 8px; color: var(--muted); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.department-checks label { display: flex; align-items: center; gap: 9px; letter-spacing: .06em; text-transform: none; }
.department-checks input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }
.lead-card { border-top-color: #383838; }
.lead-card > p { max-width: 1000px; white-space: normal; }
.lead-card .section-heading { align-items: flex-start; }
.lead-card .section-heading h2 { margin-top: 9px; text-transform: none; letter-spacing: 0; }
.lead-contact a { color: var(--muted); font-size: 11px; }
.lead-contact a:hover { color: var(--gold); }
.lead-followup { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.lead-list { display: grid; gap: 12px; }
.lead-card .panel { padding-top: 16px; }
.recent-list { border-top: 1px solid var(--line); }
.recent-letter { display: grid; grid-template-columns: minmax(0, 1fr) auto 115px 15px; align-items: center; gap: 20px; border-bottom: 1px solid #242424; padding: 17px 0; color: var(--text); }
.recent-letter:hover { color: var(--gold); }
.recent-title { display: grid; gap: 5px; font-size: 12px; }
.recent-title small { color: var(--muted); font-size: 10px; }
.recent-letter time { color: var(--muted); font-size: 10px; text-align: right; }
.portal-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid #202020; padding: 18px clamp(20px, 4vw, 64px); color: #717171; font-size: 8px; letter-spacing: .19em; text-transform: uppercase; }

.notice { margin: 0 0 20px; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compact { gap: 7px; }
.page-actions { justify-content: space-between; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { border-bottom: 1px solid #292929; padding: 13px 11px; text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
td { color: #e0ddd5; }
.badge { display: inline-block; border: 1px solid #454545; padding: 4px 8px; color: #dbd4c4; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.badge.sent { border-color: #385a40; color: #9ed3a8; }
.badge.draft { border-color: #665126; color: #e6c36f; }
.letter-form { display: grid; gap: 20px; }
.editor-label { margin-bottom: -13px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 5px; border: 1px solid var(--line); border-bottom: 0; padding: 8px; background: #0b0c10; }
.toolbar button { min-width: 34px; min-height: 31px; border: 1px solid #36383e; background: var(--panel); color: #e8e4da; }
.toolbar button:hover { border-color: var(--gold); color: var(--gold); }
.editor { min-height: 330px; border: 1px solid var(--line); outline: 0; padding: 18px; background: #0c0d11; color: #f2efe9; font-size: 14px; line-height: 1.8; }
.editor:empty::before { color: #777; content: "Write your letter..."; }
.editor.readonly { white-space: normal; }
.editor.readonly p { color: var(--text); }
.letter-body-size { margin: -14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.letter-body-size.over-limit { color: var(--danger); }
.sender-name-preview { margin: -10px 0 0; color: var(--muted); font-size: 12px; }
.sender-name-preview strong { color: var(--text); font-weight: 500; }
.signature-preview { display: block; width: 150px; height: 56px; border: 1px solid var(--line); padding: 5px; background: #fff; object-fit: contain; }
.closing-label { max-width: 420px; }
.letter-actions { border-top: 1px solid var(--line); padding-top: 18px; }
.letter-actions .button.primary { margin-left: auto; }
.editor ul, .editor ol { padding-left: 24px; }
.attendance-clock { display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.attendance-clock h2 { margin: 10px 0; font-size: 20px; font-weight: 500; }
.attendance-clock p, .attendance-filters + .muted { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.attendance-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0; }
.attendance-filters label { min-width: 170px; }
.attendance-review-form { min-width: 210px; gap: 10px; }

@media (max-width: 1120px) {
  .top-inner { flex-wrap: wrap; justify-content: center; padding-top: 9px; padding-bottom: 10px; }
  .brand { margin-right: auto; }
  .user-menu { margin-left: auto; }
  .top-nav { order: 3; width: 100%; justify-content: center; gap: clamp(14px, 3vw, 28px); }
}
@media (max-width: 700px) {
  .top-inner { justify-content: space-between; gap: 10px; }
  .brand { margin: 0; }
  .brand-logo { width: 77px; height: 42px; }
  .brand-caption { padding-left: 8px; font-size: 8px; }
  .user-menu { gap: 12px; margin: 0; }
  .user-identity b { max-width: 100px; }
  .top-nav { justify-content: flex-start; overflow-x: auto; gap: 20px; padding: 0 0 2px; }
  .top-nav a { font-size: 8px; }
  .content { padding: 36px 20px 60px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 23px; margin-bottom: 42px; }
  .stat { padding-top: 16px; }
  .stat strong { font-size: 34px; }
  .dashboard-actions { align-items: flex-start; flex-direction: column; }
  .dashboard-actions .button { width: 100%; }
  .attendance-clock { align-items: flex-start; flex-direction: column; }
  .attendance-clock form, .attendance-clock .button { width: 100%; }
  .attendance-filters { align-items: stretch; flex-direction: column; }
  .attendance-filters label, .attendance-filters .button { width: 100%; }
  .recent-letter { grid-template-columns: minmax(0, 1fr) auto 12px; gap: 11px; }
  .recent-letter time { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .page-actions { align-items: flex-start; flex-direction: column; }
  .inline-field { align-items: flex-start; flex-direction: column; }
  .letter-actions .button.primary { margin-left: 0; }
  .portal-footer { flex-direction: column; gap: 8px; }
}
@media (max-width: 440px) {
  .user-identity { display: none; }
  .auth-card { max-width: 100%; }
  .auth-brand { margin-bottom: 46px; }
  .auth-footer { margin-top: 50px; }
}
