:root {
  --navy-950: #071521;
  --navy-900: #0b1f30;
  --navy-800: #143149;
  --slate-900: #17212b;
  --slate-700: #425466;
  --slate-500: #718096;
  --slate-300: #cbd5df;
  --slate-200: #e3e9ef;
  --slate-100: #f2f5f8;
  --white: #ffffff;
  --teal-700: #0a6e68;
  --teal-600: #087f76;
  --teal-100: #dff5f1;
  --blue-100: #e4efff;
  --blue-700: #215ea8;
  --amber-100: #fff2d5;
  --amber-700: #9a5c00;
  --red-100: #fde8e7;
  --red-700: #a8322d;
  --green-100: #ddf5e8;
  --green-700: #176b45;
  --shadow-sm: 0 1px 2px rgba(7, 21, 33, .06), 0 4px 14px rgba(7, 21, 33, .04);
  --shadow-lg: 0 24px 70px rgba(7, 21, 33, .16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--slate-900); background: var(--slate-100); }
body { margin: 0; min-width: 320px; font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #4fc3ba; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; transform: translateY(-150%); padding: 10px 14px; border-radius: var(--radius-sm); color: var(--white); background: var(--teal-700); }
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 24px 18px; color: #dce8ef; background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; color: var(--white); }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-size: 17px; letter-spacing: -.01em; }
.brand small { margin-top: 4px; color: #92abbc; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; color: #b9fff4; border: 1px solid rgba(134, 239, 224, .3); border-radius: 12px; background: rgba(8, 127, 118, .22); }
.brand-mark.large { width: 50px; height: 50px; color: var(--white); background: rgba(255,255,255,.12); }
.nav-list { display: grid; gap: 7px; margin-top: 42px; }
.nav-link { min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; color: #afc1cd; text-decoration: none; border-radius: 10px; transition: background-color .18s ease, color .18s ease; }
.nav-link:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav-link.active { color: var(--white); background: var(--teal-600); box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.nav-link svg { width: 20px; height: 20px; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 14px; color: #93a9b7; font-size: 13px; border-top: 1px solid rgba(255,255,255,.08); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #53d5a1; box-shadow: 0 0 0 4px rgba(83, 213, 161, .12); }
.content-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { height: 84px; display: flex; align-items: center; gap: 18px; padding: 0 34px; border-bottom: 1px solid var(--slate-200); background: rgba(255,255,255,.95); }
.page-heading { margin-right: auto; }
.page-heading p { margin: 0 0 2px; color: var(--slate-500); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.account-menu { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; color: var(--teal-700); font-weight: 800; border-radius: 50%; background: var(--teal-100); }
.account-copy { display: flex; flex-direction: column; min-width: 0; }
.account-copy strong { font-size: 14px; }
.account-copy small { max-width: 220px; overflow: hidden; color: var(--slate-500); font-size: 12px; text-overflow: ellipsis; }
.text-button { min-height: 44px; padding: 0 10px; color: var(--slate-700); font-weight: 700; border: 0; background: transparent; cursor: pointer; }
.text-button:hover { color: var(--teal-700); }
.main-content { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 56px; }
.mobile-menu, .sidebar-scrim { display: none; }

.eyebrow { display: block; margin-bottom: 8px; color: var(--teal-700); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.welcome-panel, .page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.welcome-panel { padding: 28px 30px; color: var(--white); border-radius: var(--radius-lg); background: linear-gradient(120deg, var(--navy-900), #144f58); box-shadow: var(--shadow-sm); }
.welcome-panel .eyebrow { color: #92eadc; }
.welcome-panel h2, .page-toolbar h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.035em; }
.welcome-panel p { max-width: 640px; margin: 8px 0 0; color: #c4d5df; }
.page-toolbar p { margin: 7px 0 0; color: var(--slate-500); }
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; font-weight: 750; text-decoration: none; border-radius: 10px; cursor: pointer; transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease; }
.primary-button { color: var(--white); border: 1px solid var(--teal-700); background: var(--teal-700); box-shadow: 0 8px 20px rgba(10, 110, 104, .18); }
.primary-button:hover { background: #075f5a; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .72; transform: none; box-shadow: none; }
.welcome-panel .primary-button { color: var(--navy-900); border-color: var(--white); background: var(--white); box-shadow: none; }
.secondary-button { color: var(--slate-900); border: 1px solid var(--slate-300); background: var(--white); }
.secondary-button:hover { border-color: var(--teal-600); color: var(--teal-700); }
.secondary-button.compact { min-height: 40px; padding: 0 14px; }
.primary-button svg { width: 19px; height: 19px; }
.full-width { width: 100%; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.metric-card { min-height: 148px; display: flex; align-items: center; gap: 18px; padding: 24px; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: var(--white); box-shadow: var(--shadow-sm); }
.metric-icon { width: 48px; height: 48px; display: grid; flex: 0 0 48px; place-items: center; border-radius: 13px; }
.metric-icon.teal { color: var(--teal-700); background: var(--teal-100); }
.metric-icon.amber { color: var(--amber-700); background: var(--amber-100); }
.metric-icon.blue { color: var(--blue-700); background: var(--blue-100); }
.metric-card p { margin: 0; color: var(--slate-500); font-size: 13px; font-weight: 700; }
.metric-card strong { display: block; margin: 2px 0; font-size: 30px; line-height: 1.2; letter-spacing: -.04em; }
.metric-card strong.metric-date { font-size: 23px; }
.metric-card small { color: var(--slate-500); }
.content-card { border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: var(--white); box-shadow: var(--shadow-sm); }
.next-step-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 26px; }
.next-step-card h2 { margin: 0; font-size: 21px; }
.next-step-card p { margin: 6px 0 0; color: var(--slate-500); }
.alert { margin-bottom: 18px; padding: 13px 15px; border: 1px solid; border-radius: 10px; font-weight: 650; }
.alert.error { color: var(--red-700); border-color: #f5b9b5; background: var(--red-100); }
.alert.success { color: var(--green-700); border-color: #a8dfc2; background: var(--green-100); }
.mailbox-card { overflow: hidden; }
.mail-table-wrap { overflow-x: auto; }
.mail-table { width: 100%; border-collapse: collapse; text-align: left; }
.mail-table th { padding: 13px 18px; color: var(--slate-500); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: #f8fafb; border-bottom: 1px solid var(--slate-200); }
.mail-table td { padding: 15px 18px; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
.mail-table tr:last-child td { border-bottom: 0; }
.mail-table tbody tr:hover { background: #f9fbfc; }
.mail-table tr.unread { background: #f4faf9; }
.mail-table tr.unread .subject-line, .mail-table tr.unread .sender-name { font-weight: 800; }
.mail-table td:first-child { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.sender-avatar { width: 34px; height: 34px; display: grid; flex: 0 0 34px; place-items: center; color: var(--teal-700); font-size: 13px; font-weight: 800; border-radius: 9px; background: var(--teal-100); }
.sender-name, .subject-line { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-table time { color: var(--slate-500); font-size: 13px; white-space: nowrap; }
.row-link { min-height: 40px; display: inline-flex; align-items: center; color: var(--teal-700); font-weight: 800; text-decoration: none; }
.attachment-label { display: inline-block; margin-top: 5px; padding: 2px 7px; color: var(--slate-700); font-size: 11px; border-radius: 999px; background: var(--slate-100); }
.pagination { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px 18px; color: var(--slate-500); border-top: 1px solid var(--slate-200); }
.pagination > :last-child { justify-self: end; }
.empty-state { display: grid; justify-items: center; padding: 70px 24px; text-align: center; }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; color: var(--teal-700); border-radius: 18px; background: var(--teal-100); }
.empty-icon svg { width: 29px; height: 29px; }
.empty-state h3 { margin: 18px 0 6px; font-size: 20px; }
.empty-state p { max-width: 450px; margin: 0; color: var(--slate-500); }
.detail-back { margin-bottom: 16px; }
.detail-back a { color: var(--teal-700); font-weight: 750; text-decoration: none; }
.email-detail { overflow: hidden; }
.email-header { padding: 30px; border-bottom: 1px solid var(--slate-200); }
.email-header h2 { margin: 0 0 24px; font-size: clamp(23px, 3vw, 31px); letter-spacing: -.03em; }
.email-metadata { display: grid; gap: 10px; margin: 0; }
.email-metadata div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 14px; }
.email-metadata dt { color: var(--slate-500); font-weight: 700; }
.email-metadata dd { margin: 0; overflow-wrap: anywhere; }
.email-body { min-height: 260px; padding: 32px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }

.login-body { min-height: 100vh; background: var(--white); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr); }
.login-story { display: flex; flex-direction: column; padding: clamp(30px, 5vw, 70px); color: var(--white); background: radial-gradient(circle at 20% 20%, rgba(25, 160, 146, .33), transparent 36%), linear-gradient(145deg, var(--navy-950), #103b47); }
.login-brand { font-size: 17px; font-weight: 800; }
.story-copy { max-width: 590px; margin: auto 0; padding: 80px 0; }
.story-copy .eyebrow { color: #84e1d5; }
.story-copy h1 { margin: 0; font-size: clamp(38px, 5.5vw, 68px); line-height: 1.03; letter-spacing: -.055em; }
.story-copy p { max-width: 520px; margin: 24px 0 0; color: #c5d6de; font-size: 18px; line-height: 1.7; }
.login-footnote { margin: 0; color: #89a4b3; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #f7f9fa; }
.login-card { width: min(440px, 100%); padding: clamp(28px, 5vw, 42px); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-lg); }
.login-card-header { margin-bottom: 28px; }
.secure-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 18px; padding: 5px 9px; color: var(--teal-700); font-size: 12px; font-weight: 800; border-radius: 999px; background: var(--teal-100); }
.secure-badge svg { width: 15px; height: 15px; }
.login-card h2 { margin: 0; font-size: 31px; letter-spacing: -.04em; }
.login-card-header p { margin: 8px 0 0; color: var(--slate-500); }
.login-form { display: grid; gap: 19px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 14px; font-weight: 750; }
.field input { width: 100%; min-height: 50px; padding: 0 14px; color: var(--slate-900); border: 1px solid var(--slate-300); border-radius: 9px; background: var(--white); }
.field input:hover { border-color: #90a4b5; }
.field input:focus { border-color: var(--teal-600); outline: 3px solid rgba(8,127,118,.16); }
.privacy-note { margin: 20px 0 0; color: var(--slate-500); font-size: 12px; text-align: center; }
.error-page { width: min(560px, calc(100% - 40px)); margin: 18vh auto; padding: 42px; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-lg); }
.error-page h1 { margin: 0; font-size: 34px; }
.error-page p { margin: 10px 0 24px; color: var(--slate-500); }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .menu-open .sidebar { transform: translateX(0); }
  .content-shell { margin-left: 0; }
  .mobile-menu { display: grid; place-items: center; }
  .icon-button { width: 44px; height: 44px; padding: 0; color: var(--slate-700); border: 1px solid var(--slate-200); border-radius: 10px; background: var(--white); }
  .sidebar-scrim { position: fixed; z-index: 20; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(7,21,33,.48); }
  .menu-open .sidebar-scrim { display: block; }
  .metric-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 310px; }
  .story-copy { padding: 60px 0 30px; }
  .story-copy h1 { font-size: clamp(35px, 8vw, 54px); }
}

@media (max-width: 640px) {
  .topbar { height: 74px; padding: 0 16px; }
  .account-copy { display: none; }
  .account-menu .avatar { display: none; }
  .main-content { width: min(100% - 28px, 1180px); padding-top: 24px; }
  .welcome-panel, .page-toolbar, .next-step-card { align-items: stretch; flex-direction: column; }
  .welcome-panel { padding: 24px; }
  .metric-card { min-height: 126px; }
  .page-toolbar form, .page-toolbar button { width: 100%; }
  .mail-table th:nth-child(1), .mail-table td:nth-child(1) { display: none; }
  .mail-table th, .mail-table td { padding: 13px; }
  .sender-name, .subject-line { max-width: 190px; }
  .email-header, .email-body { padding: 22px; }
  .email-metadata div { grid-template-columns: 1fr; gap: 1px; }
  .login-panel { padding: 22px 16px 40px; }
  .login-story { padding: 25px; }
  .login-card { padding: 27px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
