:root {
  --pink-main: #f1dedf;
  --pink-soft: #f5ebea;
  --pink-accent: #e8cbcd;
  --burgundy: #731c39;
  --burgundy-deep: #5f0f2c;
  --burgundy-text: #7a2944;
  --ink: #2e2025;
  --muted: #74666b;
  --cream: #fffaf8;
  --white: #ffffff;
  --green: #47745c;
  --amber: #9a642d;
  --shadow: 0 18px 50px rgba(95, 15, 44, 0.08);
  --line: rgba(115, 28, 57, 0.13);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--pink-soft); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--pink-soft); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(115, 28, 57, 0.35); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; color: var(--white); background: var(--burgundy); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.eyebrow { margin: 0 0 8px; color: var(--burgundy-text); font-size: 0.72rem; font-weight: 760; letter-spacing: 0.16em; text-transform: uppercase; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 18px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.05fr) minmax(420px, 0.95fr); background: var(--cream); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 100vh; padding: clamp(52px, 8vw, 110px); color: var(--burgundy-deep); background: linear-gradient(145deg, var(--pink-main), var(--pink-accent)); }
.login-brand::before, .login-brand::after { content: ""; position: absolute; border: 1px solid rgba(115, 28, 57, 0.18); border-radius: 999px; }
.login-brand::before { width: 560px; height: 560px; left: -170px; top: -200px; }
.login-brand::after { width: 440px; height: 440px; right: -180px; bottom: -160px; }
.sun-disc { position: absolute; width: 190px; height: 190px; right: 12%; top: 15%; border-radius: 50%; background: rgba(255, 250, 248, 0.62); box-shadow: 0 0 80px rgba(255, 250, 248, 0.75); }
.login-brand h1 { position: relative; max-width: 620px; margin: 0 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 6.4vw, 6.8rem); font-weight: 400; letter-spacing: -0.055em; line-height: 0.94; }
.login-brand p:last-child { position: relative; max-width: 520px; margin: 0; font-size: clamp(1rem, 1.7vw, 1.25rem); line-height: 1.65; }
.login-panel { display: flex; flex-direction: column; justify-content: center; gap: 28px; width: min(480px, calc(100% - 64px)); margin: auto; padding: 48px 0; }
.login-logo { width: 145px; height: 190px; object-fit: contain; object-position: center; align-self: center; }
.login-panel h2 { margin: 0 0 10px; color: var(--burgundy-deep); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3.4vw, 3.2rem); font-weight: 400; letter-spacing: -0.035em; }
.login-panel label { display: grid; gap: 8px; color: var(--burgundy-deep); font-size: 0.86rem; font-weight: 700; }
.login-panel input { width: 100%; min-height: 52px; padding: 12px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--white); }
.preview-note { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--burgundy-deep); background: var(--pink-soft); font-size: 0.82rem; }
.preview-note code { color: var(--burgundy); font-weight: 700; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 11px 18px; border: 1px solid transparent; border-radius: 999px; font-weight: 760; transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.62; transform: none; }
.button-primary { color: var(--white); background: var(--burgundy); box-shadow: 0 10px 24px rgba(115, 28, 57, 0.2); }
.button-primary:hover { background: var(--burgundy-deep); }
.button-secondary { color: var(--burgundy); border-color: var(--line); background: var(--white); }
.text-button, .icon-button { padding: 4px; border: 0; color: var(--burgundy); background: transparent; font-weight: 740; }
.icon-button { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; }
.form-error { min-height: 1.1em; margin: 0; color: #9b1c31; font-size: 0.83rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 30px 20px 22px; color: var(--white); background: var(--burgundy-deep); }
.brand-lockup { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.brand-lockup img { width: 44px; height: 42px; object-fit: contain; }
.brand-lockup div { display: grid; gap: 2px; }
.brand-lockup strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.04rem; font-weight: 500; }
.brand-lockup span { color: rgba(255, 255, 255, 0.64); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }
.main-nav { display: grid; gap: 8px; }
.nav-item { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 12px; color: rgba(255, 255, 255, 0.68); text-align: left; background: transparent; }
.nav-item:hover, .nav-item.is-active { color: var(--white); background: rgba(255, 255, 255, 0.11); }
.nav-item > span:first-child { font-size: 1.08rem; text-align: center; }
.nav-count { min-width: 24px; padding: 3px 7px; border-radius: 999px; color: var(--burgundy-deep); background: var(--pink-accent); font-size: 0.7rem; text-align: center; }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; padding: 18px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.sidebar .text-button { width: fit-content; color: rgba(255, 255, 255, 0.72); }
.connection-mini { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, 0.66); font-size: 0.76rem; }
.status-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #73a783; box-shadow: 0 0 0 4px rgba(115, 167, 131, 0.12); }

main { min-width: 0; padding: 0 clamp(24px, 4.4vw, 72px) 72px; background: linear-gradient(180deg, #fffaf8 0%, var(--pink-soft) 100%); }
.topbar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; color: var(--burgundy-deep); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3.1vw, 3.15rem); font-weight: 400; letter-spacing: -0.04em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.mode-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--burgundy-text); background: rgba(255, 255, 255, 0.72); font-size: 0.73rem; font-weight: 750; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--white); background: var(--burgundy); font-size: 0.78rem; font-weight: 800; }
.view { display: none; padding-top: 38px; }
.view.is-active { display: block; }

.hero-card { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(400px, 1.2fr); gap: 42px; align-items: center; padding: clamp(28px, 4vw, 54px); border: 1px solid rgba(115, 28, 57, 0.09); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--pink-main), #f8eeee); box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; right: -80px; top: -120px; width: 300px; height: 300px; border: 1px solid rgba(115, 28, 57, 0.12); border-radius: 50%; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; }
.hero-copy h2, .page-intro h2, .panel h2 { margin: 0; color: var(--burgundy-deep); font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -0.035em; }
.hero-copy h2 { max-width: 520px; font-size: clamp(2.4rem, 4.2vw, 4.6rem); line-height: 0.99; }
.hero-copy > p:last-child { max-width: 500px; margin: 18px 0 0; color: var(--burgundy-text); line-height: 1.65; }
.request-composer { position: relative; z-index: 1; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, 0.86); box-shadow: 0 18px 44px rgba(95, 15, 44, 0.08); backdrop-filter: blur(10px); }
.request-composer textarea { width: 100%; min-height: 148px; resize: vertical; padding: 10px; border: 0; color: var(--ink); background: transparent; font-size: 1rem; line-height: 1.55; }
.request-composer textarea:focus { outline: none; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 4px 0; border-top: 1px solid var(--line); }
.composer-foot > span { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.74rem; }
.request-composer .form-error { padding: 6px 4px 0; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.metric-card { display: grid; gap: 8px; min-height: 138px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.72); }
.metric-card span { color: var(--burgundy-text); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.metric-card strong { color: var(--burgundy-deep); font-family: Georgia, "Times New Roman", serif; font-size: 2.3rem; font-weight: 400; }
.metric-card small { color: var(--muted); }
.home-grid, .settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr); gap: 22px; margin-top: 22px; }
.panel { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.74); box-shadow: 0 10px 34px rgba(95, 15, 44, 0.045); }
.calm-panel { background: var(--burgundy-deep); color: rgba(255, 255, 255, 0.78); }
.calm-panel .eyebrow, .calm-panel h2 { color: var(--white); }
.calm-panel > p { line-height: 1.65; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.section-heading h2, .panel h2 { font-size: 1.7rem; }
.check-list { display: grid; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 26px; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--pink-accent); }

.page-intro { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.page-intro h2 { font-size: clamp(2.4rem, 4vw, 4rem); }
.page-intro p:last-child { margin: 10px 0 0; color: var(--muted); }
.cards-list { display: grid; gap: 14px; }
.work-card, .approval-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.82); }
.work-card-head, .approval-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.work-card h3, .approval-card h3, .library-card h3 { margin: 0; color: var(--burgundy-deep); font-size: 1.05rem; }
.work-card p, .approval-card p { color: var(--muted); line-height: 1.58; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 7px 10px; border-radius: 999px; color: var(--burgundy); background: var(--pink-soft); font-size: 0.72rem; font-weight: 760; }
.status-pill.ready, .status-pill.reviewed, .status-pill.approved { color: var(--green); background: #eaf3ed; }
.status-pill.pending, .status-pill.needs-approval { color: var(--amber); background: #fbf0dc; }
.specialist-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.specialist-chip { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--burgundy-text); font-size: 0.72rem; }
.activity-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.activity-line span { color: var(--muted); font-size: 0.7rem; }
.result-panel { margin-top: 18px; padding: 20px; border-radius: 14px; background: var(--pink-soft); }
.result-panel h4 { margin: 0 0 8px; color: var(--burgundy-deep); }
.result-panel ul { margin: 10px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.55; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.approval-actions .button { min-height: 38px; padding: 8px 14px; font-size: 0.8rem; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.library-card { min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.82); }
.library-card .document-mark { width: 42px; height: 48px; display: grid; place-items: center; margin-bottom: 26px; border: 1px solid var(--line); border-radius: 8px; color: var(--burgundy); background: var(--pink-soft); }
.library-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 0.72rem; }
.connection-list { display: grid; gap: 12px; margin-bottom: 20px; }
.connection-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.connection-item div { display: grid; gap: 4px; }
.connection-item span { color: var(--muted); font-size: 0.78rem; }
.role-list { display: grid; gap: 2px; margin-top: 18px; }
.role-list div { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.role-list span { color: var(--muted); font-size: 0.8rem; }
.scorecard { margin-top: 18px; padding: 18px; border-radius: 14px; background: var(--pink-soft); }
.scorecard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scorecard-grid div { display: grid; gap: 4px; }
.scorecard-grid span { color: var(--muted); font-size: 0.72rem; }
.scorecard-grid strong { color: var(--burgundy-deep); font-size: 1.15rem; }
.empty-state { min-height: 130px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.mobile-nav { display: none; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(380px, calc(100vw - 48px)); padding: 13px 16px; border-radius: 12px; color: var(--white); background: var(--burgundy-deep); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .hero-card { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .home-grid, .settings-grid { grid-template-columns: 1fr; }
  .library-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 280px; justify-content: flex-end; padding: 36px 28px; }
  .login-brand h1 { font-size: 3.1rem; }
  .login-brand p:last-child { display: none; }
  .sun-disc { width: 120px; height: 120px; right: 8%; top: 14%; }
  .login-panel { width: min(100% - 40px, 480px); padding: 36px 0 48px; }
  .login-logo { width: 104px; height: 130px; }
  .app-shell { display: block; padding-bottom: 74px; }
  .sidebar { display: none; }
  main { min-height: 100vh; padding: 0 18px 42px; }
  .topbar { min-height: 92px; }
  .topbar h1 { font-size: 2rem; }
  .mode-pill { display: none; }
  .avatar { width: 38px; height: 38px; }
  .view { padding-top: 24px; }
  .hero-card { gap: 28px; padding: 26px 20px; border-radius: 22px; }
  .hero-copy h2 { font-size: 2.6rem; }
  .request-composer { padding: 12px; }
  .composer-foot { align-items: flex-end; }
  .composer-foot > span { max-width: 115px; }
  .composer-foot .button { padding-inline: 15px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 118px; padding: 17px; }
  .metric-card strong { font-size: 1.9rem; }
  .home-grid { gap: 12px; margin-top: 12px; }
  .panel { padding: 20px; }
  .library-grid { grid-template-columns: 1fr; }
  .work-card-head, .approval-card-head { flex-direction: column; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255, 250, 248, 0.96); backdrop-filter: blur(16px); }
  .mobile-nav button { min-height: 40px; padding: 5px 2px; border: 0; color: var(--muted); background: transparent; font-size: 0.66rem; font-weight: 700; }
  .mobile-nav button.is-active { color: var(--burgundy); }
  .toast { right: 14px; bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
