:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --text: #172019;
  --muted: #687169;
  --line: #dfe5dd;
  --green: #2d8d46;
  --green-dark: #1f6534;
  --green-soft: #eaf5ec;
  --orange: #e28a2b;
  --warning: #8a5a15;
  --shadow: 0 18px 54px rgba(31, 54, 36, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font, inherit); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(45, 141, 70, .35); outline-offset: 3px; }

.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: white; background: linear-gradient(145deg, var(--green), var(--green-dark)); box-shadow: 0 8px 20px rgba(45, 141, 70, .22); flex: 0 0 auto; }
.brand-mark span { font-size: 13px; font-weight: 850; letter-spacing: -.04em; }
.brand-lockup { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-lockup > span:last-child { display: grid; line-height: 1.15; }
.brand-lockup strong { font-size: 18px; letter-spacing: -.03em; }
.brand-lockup small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .15em; }

.state-screen { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; color: var(--muted); }
.loading-line { width: 170px; height: 3px; overflow: hidden; border-radius: 999px; background: #dfe5dd; }
.loading-line span { display: block; width: 45%; height: 100%; border-radius: inherit; background: var(--green); animation: loading 1.15s ease-in-out infinite alternate; }
@keyframes loading { from { transform: translateX(-20%); } to { transform: translateX(145%); } }
@media (prefers-reduced-motion: reduce) { .loading-line span { animation: none; width: 100%; } }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(430px, .92fr); }
.login-context { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 72px); overflow: hidden; color: #f7fbf7; background: linear-gradient(145deg, #173b26 0%, #215d34 58%, #2b7d43 100%); }
.login-context::before { content: ""; position: absolute; width: 520px; height: 520px; right: -210px; bottom: -180px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 80px rgba(255,255,255,.025), 0 0 0 160px rgba(255,255,255,.018); }
.login-context .brand-lockup, .login-copy, .environment-note { position: relative; z-index: 1; }
.login-context .brand-mark { color: var(--green-dark); background: white; box-shadow: none; }
.login-context .brand-lockup small, .login-context .eyebrow { color: rgba(255,255,255,.68); }
.login-copy { max-width: 660px; }
.login-copy h1 { margin: 0; max-width: 650px; font-size: clamp(42px, 5vw, 74px); line-height: .98; letter-spacing: -.058em; }
.login-copy > p:last-child { max-width: 570px; margin: 28px 0 0; color: rgba(255,255,255,.73); font-size: 17px; }
.environment-note { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.72); font-size: 12px; }
.environment-note span, .environment-chip span { width: 8px; height: 8px; border-radius: 50%; background: #8ee69f; box-shadow: 0 0 0 4px rgba(142, 230, 159, .15); }
.login-panel { display: grid; place-items: center; padding: 32px; background: var(--surface-soft); }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.login-card-heading { display: flex; align-items: center; gap: 14px; }
.login-card-heading .eyebrow { margin-bottom: 4px; }
.login-card h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.secure-badge { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 18px; font-weight: 800; }
.login-help { margin: 22px 0 26px; color: var(--muted); }
.login-card label { display: block; margin: 16px 0 7px; font-weight: 700; }
.login-card input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #ccd5ca; border-radius: 10px; color: var(--text); background: #fff; }
.login-card input:focus { border-color: var(--green); outline: 3px solid rgba(45, 141, 70, .13); }
.primary-button, .primary-action { width: 100%; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; margin-top: 22px; border: 0; border-radius: 10px; color: white; background: var(--green); font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button:hover, .primary-action:hover { background: var(--green-dark); }
.primary-button:disabled { opacity: .65; cursor: wait; }
.text-button { width: 100%; margin-top: 12px; border: 0; color: var(--green-dark); background: transparent; font-weight: 750; cursor: pointer; }
.auth-message { margin: 16px 0 0; padding: 11px 12px; border: 1px solid #eccfcf; border-radius: 9px; color: #8a3030; background: #fff5f5; }
.privacy-note { margin: 22px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.platform-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; border-right: 1px solid var(--line); background: var(--surface); z-index: 10; }
.sidebar-brand { padding: 0 8px 25px; border-bottom: 1px solid var(--line); }
.navigation { flex: 1; overflow-y: auto; padding: 18px 0; }
.nav-section + .nav-section { margin-top: 22px; }
.nav-section-label { margin: 0 12px 8px; color: #8a928b; font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: 9px; color: #4e5750; text-decoration: none; font-weight: 650; }
.nav-link:hover { background: var(--surface-soft); }
.nav-link.is-active { color: var(--green-dark); background: var(--green-soft); }
.nav-icon { width: 22px; text-align: center; font-size: 16px; }
.sidebar-footer { display: grid; gap: 9px; padding: 18px 8px 0; border-top: 1px solid var(--line); color: var(--muted); }
.environment-chip { display: flex; align-items: center; gap: 9px; color: var(--green-dark); font-size: 10px; font-weight: 850; letter-spacing: .14em; }
.sidebar-footer small { font-size: 10px; }
.shell-body { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); }
.company-context, .identity-block, .identity-block > span:nth-child(2) { display: flex; align-items: center; }
.company-context { flex-direction: column; align-items: flex-start; line-height: 1.25; }
.context-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.company-context strong { margin-top: 3px; font-size: 13px; }
.identity-block { gap: 10px; }
.identity-block > span:nth-child(2) { flex-direction: column; align-items: flex-start; min-width: 130px; line-height: 1.25; }
.identity-block small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); }
.logout-button, .mobile-menu { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; cursor: pointer; }
.mobile-menu { display: none; }
.content { width: min(1220px, 100%); margin: 0 auto; padding: clamp(28px, 5vw, 64px); }
.page-heading { max-width: 780px; }
.page-heading h1, .module-page h1 { margin: 0; font-size: clamp(36px, 4vw, 58px); line-height: 1; letter-spacing: -.055em; }
.page-copy { max-width: 720px; margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 34px 0 42px; }
.status-card { min-height: 128px; display: grid; align-content: center; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.status-card strong { margin: 8px 0 4px; font-size: 18px; letter-spacing: -.025em; }
.status-card small, .status-label { color: var(--muted); font-size: 11px; }
.status-label { text-transform: uppercase; letter-spacing: .1em; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading div { font-size: 18px; font-weight: 800; }
.section-heading span { color: var(--muted); font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-card { min-height: 230px; display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: inherit; background: var(--surface); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
a.module-card:hover { transform: translateY(-2px); border-color: #b9c8b8; }
.module-card.is-disabled { color: #747b75; background: #f0f2ef; }
.module-card-head { display: flex; align-items: center; justify-content: space-between; }
.module-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: var(--green-dark); background: var(--green-soft); font-size: 20px; }
.is-disabled .module-icon { color: #7f8780; background: #e3e6e2; }
.module-state { padding: 5px 8px; border-radius: 999px; color: #747b75; background: #e7e9e6; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.module-state.is-ready { color: var(--green-dark); background: var(--green-soft); }
.module-card h3 { margin: 28px 0 8px; font-size: 20px; letter-spacing: -.03em; }
.module-card p { margin: 0; color: var(--muted); font-size: 12px; }
.module-action { margin-top: auto; padding-top: 18px; color: var(--green-dark); font-size: 12px; font-weight: 800; }
.module-page { max-width: 760px; margin-top: clamp(20px, 6vh, 80px); padding: clamp(28px, 5vw, 54px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.module-page-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 28px; border-radius: 15px; color: var(--green-dark); background: var(--green-soft); font-size: 26px; }
.legacy-note { margin-top: 30px; padding: 18px; border-left: 3px solid var(--orange); border-radius: 0 10px 10px 0; background: #fff8ef; }
.legacy-note p { margin: 5px 0 0; color: #735a3b; font-size: 12px; }
.primary-action { width: auto; padding: 0 22px; }
.secondary-action { display: inline-flex; margin-top: 24px; color: var(--green-dark); font-weight: 800; }
.unavailable-page { box-shadow: none; }

@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-context { min-height: 42vh; padding: 34px; }
  .login-copy { margin: 60px 0; }
  .login-copy h1 { font-size: clamp(38px, 10vw, 60px); }
  .login-panel { padding: 24px; }
  .platform-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 250px; transition: transform .18s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; align-items: center; }
  .status-grid, .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .login-context { min-height: 36vh; }
  .login-copy { margin: 44px 0; }
  .login-card { padding: 28px 22px; }
  .topbar { padding: 10px 14px; }
  .company-context { display: none; }
  .identity-block > span:nth-child(2) { min-width: 0; }
  .identity-block small { display: none; }
  .content { padding: 28px 16px; }
  .status-grid, .module-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}
