/* Prosper Broker Workspace - static internal dashboard */
:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f4f0e9;
  --bg-radial-1: rgba(185, 141, 76, 0.16);
  --bg-radial-2: rgba(63, 70, 73, 0.08);
  --surface: #fffaf2;
  --surface-2: #f0e8dd;
  --surface-3: #e7ded0;
  --glass: rgba(255, 250, 242, 0.78);
  --text: #1e1b17;
  --heading: #11100e;
  --muted: #6e6459;
  --muted-2: #8b8175;
  --line: rgba(64, 51, 34, 0.12);
  --accent: #b88b4d;
  --accent-2: #7d5731;
  --accent-soft: rgba(184, 139, 77, 0.16);
  --success: #2f7355;
  --success-soft: rgba(47, 115, 85, 0.14);
  --warning: #9a681f;
  --warning-soft: rgba(154, 104, 31, 0.14);
  --danger: #b3564e;
  --danger-soft: rgba(179, 86, 78, 0.14);
  --info: #557088;
  --info-soft: rgba(85, 112, 136, 0.14);
  --shadow: 0 22px 60px rgba(38, 28, 16, 0.13);
  --shadow-soft: 0 12px 26px rgba(38, 28, 16, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 286px;
  --sidebar-collapsed: 86px;
  --topbar-height: 74px;
}

body.theme-dark {
  --bg: #0d0f10;
  --bg-radial-1: rgba(184, 139, 77, 0.18);
  --bg-radial-2: rgba(92, 100, 104, 0.16);
  --surface: #17191a;
  --surface-2: #202325;
  --surface-3: #292d30;
  --glass: rgba(23, 25, 26, 0.76);
  --text: #eee8dd;
  --heading: #fffaf2;
  --muted: #ada59a;
  --muted-2: #837b72;
  --line: rgba(255, 244, 229, 0.11);
  --accent: #c99d62;
  --accent-2: #e0bd85;
  --accent-soft: rgba(201, 157, 98, 0.16);
  --success: #81c39c;
  --success-soft: rgba(129, 195, 156, 0.13);
  --warning: #e1b565;
  --warning-soft: rgba(225, 181, 101, 0.14);
  --danger: #e19086;
  --danger-soft: rgba(225, 144, 134, 0.14);
  --info: #9db8d1;
  --info-soft: rgba(157, 184, 209, 0.13);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 18% 4%, var(--bg-radial-1), transparent 28rem),
    radial-gradient(circle at 84% 10%, var(--bg-radial-2), transparent 24rem),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.login-page {
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 9999;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

.login-bg {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  position: relative;
}
.login-bg:before,
.login-bg:after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(20px);
  opacity: .64;
  pointer-events: none;
}
.login-bg:before {
  width: 420px;
  height: 420px;
  top: 8%;
  left: 12%;
  background: linear-gradient(135deg, rgba(184,139,77,.32), transparent 66%);
}
.login-bg:after {
  width: 520px;
  height: 520px;
  right: 5%;
  bottom: 5%;
  background: linear-gradient(135deg, rgba(70,76,80,.22), transparent 64%);
}
.login-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--glass);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}
.login-panel {
  padding: clamp(2rem, 5vw, 4rem);
  background: linear-gradient(145deg, rgba(255,255,255,.06), transparent), var(--glass);
}
.login-panel.brand-panel {
  background:
    linear-gradient(160deg, rgba(184,139,77,.18), transparent 55%),
    linear-gradient(0deg, rgba(255,255,255,.04), transparent),
    var(--surface);
}
.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fffaf2;
  font-weight: 800;
  letter-spacing: -.05em;
  background: linear-gradient(135deg, var(--accent), #6e4b28);
  box-shadow: 0 16px 30px rgba(128, 82, 35, .26);
}
.login-title {
  margin: 1.8rem 0 .75rem;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: .95;
  letter-spacing: -.07em;
  color: var(--heading);
}
.login-subtitle {
  max-width: 39rem;
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.02rem;
}
.feature-stack {
  display: grid;
  gap: .85rem;
  margin-top: 2.2rem;
}
.feature-pill {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .88rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.feature-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
  flex: 0 0 auto;
}
.login-form h2 {
  margin: 0 0 .3rem;
  font-size: 1.55rem;
  letter-spacing: -.035em;
  color: var(--heading);
}
.login-form p { margin: 0 0 1.4rem; color: var(--muted); }
.form-row { display: grid; gap: .45rem; margin-bottom: 1rem; }
label, .label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: .86rem .95rem;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(184,139,77,.7);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
textarea { min-height: 120px; resize: vertical; }
.login-disclaimer {
  margin-top: 1.1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-2);
  font-size: .88rem;
}
.login-error {
  display: none;
  margin: .75rem 0;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(179,86,78,.3);
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
}
.login-error.is-visible { display: block; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--glass), rgba(255,255,255,0)), var(--surface);
  backdrop-filter: blur(18px);
  z-index: 70;
  transition: width .2s ease, transform .2s ease;
  overflow-y: auto;
}
.sidebar-inner { min-height: calc(100vh - 2rem); display: flex; flex-direction: column; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .65rem .55rem 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .8rem;
}
.sidebar-brand .brand-mark { width: 42px; height: 42px; border-radius: 14px; }
.brand-copy strong {
  display: block;
  color: var(--heading);
  letter-spacing: -.035em;
  line-height: 1.1;
}
.brand-copy span { display: block; color: var(--muted); font-size: .76rem; margin-top: .15rem; }
.nav-section-label {
  margin: 1rem .65rem .45rem;
  color: var(--muted-2);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.nav-list { display: grid; gap: .25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 46px;
  padding: .72rem .75rem;
  border-radius: 15px;
  color: var(--muted);
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--heading); transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(255,255,255,.03));
  color: var(--heading);
  box-shadow: inset 0 0 0 1px rgba(184,139,77,.22);
}
.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent-2);
  font-size: .84rem;
  font-weight: 800;
}
.nav-link.active .nav-icon { background: var(--accent); color: #17110a; }
.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  display: grid;
  gap: .7rem;
}
.internal-note {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-2);
  font-size: .78rem;
}
.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .9rem clamp(1rem, 2.4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(18px);
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.page-kicker { margin: 0; color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.page-title { margin: 0; color: var(--heading); font-size: 1.1rem; letter-spacing: -.035em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.search-wrap { position: relative; width: min(480px, 36vw); }
.search-input {
  padding-left: 2.55rem;
  height: 44px;
  border-radius: 999px;
  background: var(--surface);
}
.search-wrap:before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid var(--muted-2);
  border-radius: 999px;
  transform: translateY(-50%);
  z-index: 1;
}
.search-wrap:after {
  content: "";
  position: absolute;
  left: 1.78rem;
  top: 1.65rem;
  width: 8px;
  height: 2px;
  background: var(--muted-2);
  transform: rotate(45deg);
  border-radius: 999px;
}
.search-results {
  position: absolute;
  top: calc(100% + .55rem);
  left: 0;
  right: 0;
  display: none;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  z-index: 90;
  max-height: 360px;
  overflow: auto;
}
.search-results.is-visible { display: block; }
.search-result-item {
  display: block;
  padding: .75rem .85rem;
  border-radius: 12px;
  color: var(--muted);
}
.search-result-item:hover { background: var(--surface-2); color: var(--heading); }
.search-result-item strong { color: var(--heading); display: block; }

.page-content {
  padding: clamp(1rem, 2.4vw, 2rem);
  display: grid;
  gap: 1.15rem;
}
.hero-panel, .card, .summary-card, .metric-card, .tool-card, .table-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.045), transparent), var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.hero-panel {
  padding: clamp(1.35rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr);
  gap: 1.4rem;
  overflow: hidden;
  position: relative;
}
.hero-panel:after {
  content: "";
  position: absolute;
  right: -80px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: var(--accent-soft);
  pointer-events: none;
}
.hero-panel > * { position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .75rem;
  color: var(--accent-2);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.eyebrow:before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}
h1, h2, h3, h4 { color: var(--heading); letter-spacing: -.045em; line-height: 1.12; }
h1 { margin: 0; font-size: clamp(2rem, 4.2vw, 3.45rem); }
h2 { margin: 0; font-size: clamp(1.35rem, 2.3vw, 2rem); }
h3 { margin: 0; font-size: 1.06rem; }
h4 { margin: 0; font-size: .94rem; }
p { margin-top: 0; }
.lead { margin: .8rem 0 0; color: var(--muted); max-width: 62rem; font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.gold { color: var(--accent-2); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-wide { grid-template-columns: minmax(0, 1.4fr) minmax(320px, .85fr); }
.grid-even { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card, .summary-card, .metric-card, .tool-card, .table-card { padding: 1.15rem; }
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.card-header p { margin: .28rem 0 0; color: var(--muted); font-size: .9rem; }
.metric-card { display: grid; gap: .35rem; min-height: 124px; }
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.metric-value { font-size: clamp(1.55rem, 3vw, 2.25rem); color: var(--heading); font-weight: 850; letter-spacing: -.055em; }
.metric-sub { color: var(--muted); font-size: .85rem; }
.summary-card.highlight { border-color: rgba(184,139,77,.38); background: linear-gradient(145deg, var(--accent-soft), transparent 55%), var(--surface); }
.tool-card {
  display: grid;
  min-height: 174px;
  align-content: space-between;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(184,139,77,.42); box-shadow: var(--shadow); }
.tool-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.tool-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 900;
}
.tool-card p { color: var(--muted); margin: .55rem 0 1rem; }
.card-band {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  padding: 1rem;
}
.divider { height: 1px; background: var(--line); margin: 1rem 0; }

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--heading);
  padding: .66rem 1rem;
  font-weight: 800;
  box-shadow: none;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); background: var(--surface-2); }
.btn-primary {
  border-color: rgba(184,139,77,.5);
  color: #17110a;
  background: linear-gradient(135deg, #d0a76f, var(--accent));
}
.btn-primary:hover { background: linear-gradient(135deg, #dfbb84, var(--accent)); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(179,86,78,.3); }
.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--heading);
  font-weight: 900;
}
.mobile-menu-btn { display: none; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.form-row.inline { grid-template-columns: auto 1fr; align-items: center; }
.toggle-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .8rem .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.checkbox-list { display: grid; gap: .55rem; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}
.checkbox-item input { width: 18px; height: 18px; accent-color: var(--accent); }
.checkbox-item span { color: var(--text); }
.segmented {
  display: inline-flex;
  gap: .25rem;
  padding: .25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: .56rem .86rem;
  font-weight: 800;
}
.segmented button.active { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-soft); }

.output-stack { display: grid; gap: .75rem; }
.output-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
}
.output-row:last-child { border-bottom: 0; }
.output-row span { color: var(--muted); }
.output-row strong { color: var(--heading); font-size: 1.05rem; text-align: right; }
.output-row.major strong { font-size: 1.6rem; letter-spacing: -.04em; color: var(--accent-2); }
.result-number {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  color: var(--heading);
  font-weight: 900;
  letter-spacing: -.06em;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .65rem;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 800;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge.success { color: var(--success); background: var(--success-soft); border-color: rgba(47,115,85,.25); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: rgba(154,104,31,.25); }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: rgba(179,86,78,.25); }
.badge.info { color: var(--info); background: var(--info-soft); border-color: rgba(85,112,136,.25); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: .82rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; background: var(--surface-2); }
td { color: var(--text); }
tr:last-child td { border-bottom: 0; }
.text-right { text-align: right; }

.history-list, .saved-list, .recent-list { display: grid; gap: .7rem; }
.history-item, .saved-item, .recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.history-item strong, .saved-item strong, .recent-item strong { color: var(--heading); display: block; }
.history-item span, .saved-item span, .recent-item span { color: var(--muted); font-size: .86rem; }
.empty-state {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-2);
}

.warning-box, .info-box, .success-box, .danger-box {
  padding: .95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.warning-box { color: var(--warning); background: var(--warning-soft); border-color: rgba(154,104,31,.26); }
.info-box { color: var(--info); background: var(--info-soft); border-color: rgba(85,112,136,.26); }
.success-box { color: var(--success); background: var(--success-soft); border-color: rgba(47,115,85,.26); }
.danger-box { color: var(--danger); background: var(--danger-soft); border-color: rgba(179,86,78,.26); }

.profit-bridge {
  display: grid;
  gap: .65rem;
  position: relative;
}
.bridge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: .78rem .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.bridge-row.total { background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); border-color: rgba(184,139,77,.35); }
.bridge-row span { color: var(--muted); }
.bridge-row strong { color: var(--heading); }
.bridge-row.negative strong { color: var(--danger); }

.milestone-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.milestone {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.milestone h4 { margin-bottom: .6rem; }
.priority-high { border-color: rgba(179,86,78,.42); background: linear-gradient(135deg, var(--danger-soft), transparent 62%), var(--surface); }
.priority-medium { border-color: rgba(154,104,31,.42); background: linear-gradient(135deg, var(--warning-soft), transparent 62%), var(--surface); }
.priority-low { border-color: rgba(47,115,85,.36); background: linear-gradient(135deg, var(--success-soft), transparent 62%), var(--surface); }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 999;
  display: none;
  max-width: 360px;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--heading);
  box-shadow: var(--shadow);
}
.toast.is-visible { display: block; animation: toastIn .18s ease; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(0,0,0,.42);
}

body.sidebar-collapsed .app-shell { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .internal-note { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .nav-link { justify-content: center; padding-left: .5rem; padding-right: .5rem; }
body.sidebar-collapsed .sidebar-footer { align-items: center; }
body.sidebar-collapsed #collapseSidebar { transform: rotate(180deg); }

.print-only { display: none; }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-wide { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    transform: translateX(-105%);
    box-shadow: var(--shadow);
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  body.drawer-open .sidebar-overlay { display: block; }
  body.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .sidebar { width: min(320px, 86vw); }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-text,
  body.sidebar-collapsed .internal-note { display: block; }
  body.sidebar-collapsed .nav-link { justify-content: flex-start; }
  .mobile-menu-btn { display: grid; }
  #collapseSidebar { display: none; }
  .search-wrap { width: min(420px, 42vw); }
  .hero-panel { grid-template-columns: 1fr; }
  .grid-3, .grid-2, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-panel.brand-panel { display: none; }
}
@media (max-width: 680px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: .65rem; }
  .search-wrap { display: none; }
  .topbar-actions .btn .btn-label { display: none; }
  .page-title { font-size: 1rem; }
  .grid-4 { grid-template-columns: 1fr; }
  .card, .summary-card, .metric-card, .tool-card, .table-card { padding: 1rem; border-radius: 18px; }
  .page-content { padding: .9rem; }
  .hero-panel { border-radius: 20px; }
  .history-item, .saved-item, .recent-item { grid-template-columns: 1fr; }
  .button-row .btn { flex: 1 1 auto; }
}

@media print {
  .sidebar, .topbar, .sidebar-overlay, .no-print { display: none !important; }
  .app-shell { display: block; }
  body { background: white; color: black; }
  .page-content { padding: 0; }
  .card, .summary-card, .metric-card, .tool-card, .table-card, .hero-panel { box-shadow: none; break-inside: avoid; }
  .print-only { display: block; }
}
