@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
  color-scheme: light;
  --ink: #17221e;
  --muted: #65706b;
  --surface: #ffffff;
  --canvas: #f4f6f2;
  --line: #dde3dd;
  --brand: #136e58;
  --brand-deep: #0b4f3e;
  --brand-soft: #dff2ea;
  --accent: #ef714f;
  --warning: #a15c00;
  --warning-soft: #fff1d7;
  --danger: #ae3e3e;
  --shadow: 0 16px 42px rgba(20, 48, 38, .08);
  --radius: 22px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); min-width: 320px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent), white 35%); outline-offset: 3px; }
a { color: inherit; }
.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; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand { font-family: "Manrope", sans-serif; }
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 100; padding: 10px 14px; background: var(--ink); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.app-shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; background: var(--ink); color: #eef4f0; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand-deep); font-size: 18px; }
.sidebar-label { margin: 34px 12px 9px; color: #8fa098; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-list { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: #aebbb5; font-weight: 600; font-size: 14px; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.08); }
.nav-icon { width: 20px; text-align: center; }
.sidebar-spacer { flex: 1; }
.sidebar-card { padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.04); }
.sidebar-card strong { display: block; margin-bottom: 5px; font-size: 13px; }
.sidebar-card p { margin: 0; color: #9eada6; font-size: 12px; line-height: 1.45; }
.sidebar-links { display: flex; gap: 8px; margin-top: 12px; }
.sidebar-links a { flex: 1; text-align: center; color: white; font-size: 11px; font-weight: 700; text-decoration: none; padding: 7px; border-radius: 8px; background: rgba(255,255,255,.08); }

.main { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px clamp(20px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(244,246,242,.88); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 8; }
.crumb { color: var(--muted); font-size: 13px; }
.crumb strong { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.status-pill, .badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #27a271; box-shadow: 0 0 0 4px #e0f6ec; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: white; font-weight: 800; font-size: 12px; }
.menu-button { display: none; border: 0; background: var(--surface); border-radius: 10px; padding: 9px 11px; cursor: pointer; }

.content { width: min(1440px, 100%); margin: 0 auto; padding: 38px clamp(20px, 4vw, 54px) 72px; }
.eyebrow { color: var(--brand); font-weight: 800; text-transform: uppercase; letter-spacing: .13em; font-size: 11px; margin-bottom: 10px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.05; letter-spacing: -.045em; margin-bottom: 9px; }
.page-heading p { color: var(--muted); margin: 0; max-width: 660px; line-height: 1.55; }
.synthetic-note { display: inline-flex; gap: 8px; align-items: center; padding: 10px 13px; border-radius: 12px; color: var(--warning); background: var(--warning-soft); font-size: 12px; font-weight: 700; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; margin-bottom: 22px; }
.kpi-card { padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 7px 22px rgba(20,48,38,.04); }
.kpi-top { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-deep); border-radius: 10px; }
.kpi-value { font-family: "Manrope"; font-size: 28px; font-weight: 800; letter-spacing: -.04em; margin: 16px 0 4px; }
.kpi-trend { color: var(--brand); font-size: 12px; font-weight: 700; }

.layout-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.75fr); gap: 20px; align-items: start; }
.layout-grid > *, .vertical-grid > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 20px; }
.card-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 22px 24px 15px; }
.card-header h2 { font-size: 18px; letter-spacing: -.025em; margin-bottom: 5px; }
.card-header p { margin: 0; color: var(--muted); font-size: 13px; }
.card-body { padding: 4px 24px 24px; }
.link-button { border: 0; background: transparent; color: var(--brand); font-weight: 800; font-size: 12px; cursor: pointer; padding: 5px; text-decoration: none; }
.primary-button, .secondary-button { border: 0; border-radius: 12px; padding: 11px 15px; font-weight: 800; cursor: pointer; transition: transform .15s, background .15s; }
.primary-button { background: var(--brand); color: white; }
.primary-button:hover { background: var(--brand-deep); transform: translateY(-1px); }
.secondary-button { background: var(--brand-soft); color: var(--brand-deep); }

.section-block { margin-top: 48px; scroll-margin-top: 100px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 17px; }
.section-heading h2 { margin-bottom: 5px; font-size: 24px; letter-spacing: -.035em; }
.section-heading p { color: var(--muted); margin: 0; font-size: 14px; }

.vertical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.vertical-card { position: relative; min-height: 205px; padding: 23px; color: white; border-radius: 20px; overflow: hidden; text-decoration: none; }
.vertical-card.horeca { background: linear-gradient(145deg, #3f1d14, #a94f36); }
.vertical-card.oficinas { background: linear-gradient(145deg, #102b49, #397db0); }
.vertical-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -55px; bottom: -85px; border: 35px solid rgba(255,255,255,.1); border-radius: 50%; }
.vertical-card .badge { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.16); }
.vertical-card h3 { margin: 32px 0 6px; font-size: 22px; }
.vertical-card p { color: rgba(255,255,255,.7); font-size: 13px; }
.vertical-stats { display: flex; gap: 22px; position: relative; z-index: 1; }
.vertical-stats strong { display: block; font-family: "Manrope"; font-size: 18px; }
.vertical-stats span { color: rgba(255,255,255,.65); font-size: 11px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
tbody tr:last-child td { border-bottom: 0; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; padding: 5px 8px; border-radius: 999px; }
.state.done, .state.healthy { background: var(--brand-soft); color: var(--brand-deep); }
.state.blocked, .state.planned { background: var(--warning-soft); color: var(--warning); }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.progress { width: 100%; height: 7px; border-radius: 999px; overflow: hidden; background: #edf0ed; }
.progress span { height: 100%; display: block; border-radius: inherit; background: var(--brand); }

.activity-list { display: grid; }
.activity { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-size: 13px; }
.activity strong { display: block; font-size: 12px; }
.activity small { color: var(--muted); }

.radar-toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: #e9ede9; }
.segmented button { border: 0; padding: 8px 12px; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 2px 7px rgba(0,0,0,.07); }
.sort-select { border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); padding: 8px 12px; font-size: 12px; }
.opportunity-list { display: grid; gap: 13px; }
.opportunity { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 15px; align-items: center; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.product-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--brand-deep); background: var(--brand-soft); font-size: 21px; }
.opportunity h3 { font-size: 14px; margin: 0 0 5px; }
.opportunity-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 11px; }
.confidence { color: var(--brand-deep); background: var(--brand-soft); border-radius: 999px; padding: 3px 7px; font-weight: 800; }
.saving { text-align: right; }
.saving strong { display: block; color: var(--brand-deep); font-family: "Manrope"; font-size: 18px; }
.saving span { color: var(--muted); font-size: 11px; }
.opportunity-actions { display: flex; gap: 7px; margin-top: 9px; justify-content: flex-end; }
.mini-button { border: 1px solid var(--line); background: white; border-radius: 8px; padding: 6px 8px; cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 700; }
.opportunity.is-interested { border-color: color-mix(in srgb, var(--brand), white 48%); box-shadow: inset 4px 0 0 var(--brand); }

.basket-list { display: grid; gap: 4px; }
.basket-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; }
.basket-item-icon { width: 36px; height: 36px; display: grid; place-items: center; background: var(--canvas); border-radius: 10px; }
.basket-item strong { display: block; font-size: 12px; }
.basket-item small { color: var(--muted); }
.basket-price { text-align: right; font-size: 12px; font-weight: 700; }
.basket-total { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 15px; border-top: 1px solid var(--line); font-weight: 800; }
.field-label { display: block; color: var(--muted); font-size: 11px; font-weight: 800; margin-bottom: 7px; }
.threshold-control { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.threshold-control input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white; }
.privacy-hint { margin: 12px 0 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.empty-state.compact { padding: 17px 10px; margin-top: 12px; font-size: 12px; }

.basket-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(820px, calc(100vh - 32px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: 0 28px 90px rgba(9, 31, 24, .3); }
.basket-dialog::backdrop { background: rgba(9, 24, 19, .58); backdrop-filter: blur(3px); }
.basket-dialog form { display: flex; flex-direction: column; max-height: inherit; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; padding: 25px 26px 17px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-bottom: 5px; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 13px; }
.dialog-close { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--muted); font-size: 22px; cursor: pointer; }
.basket-editor-list { display: grid; gap: 10px; padding: 18px 26px; overflow-y: auto; }
.basket-editor-row { display: grid; grid-template-columns: minmax(150px, 1fr) 1fr; gap: 10px 16px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.basket-editor-row legend { grid-column: 1 / -1; padding: 0 4px; font-weight: 800; font-size: 13px; }
.basket-editor-row label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.basket-editor-row input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
.dialog-actions { display: flex; justify-content: space-between; gap: 12px; padding: 17px 26px 24px; border-top: 1px solid var(--line); }

.saving-hero { position: relative; padding: 26px; color: white; background: linear-gradient(145deg, var(--brand-deep), var(--brand)); border-radius: var(--radius); overflow: hidden; }
.saving-hero::after { content: ""; position: absolute; width: 170px; height: 170px; right: -65px; top: -75px; border-radius: 50%; background: rgba(255,255,255,.09); }
.saving-hero small { color: rgba(255,255,255,.7); }
.saving-hero .big { display: block; font-family: "Manrope"; font-size: 38px; font-weight: 800; letter-spacing: -.05em; margin: 9px 0 4px; }
.spark-bars { height: 72px; display: flex; align-items: end; gap: 6px; margin: 20px 0 3px; }
.spark-bars span { flex: 1; min-height: 7px; border-radius: 5px 5px 2px 2px; background: rgba(255,255,255,.3); }
.spark-bars span:last-child { background: white; }

.timeline { display: grid; gap: 0; }
.timeline-item { display: grid; grid-template-columns: 26px 1fr; gap: 11px; min-height: 58px; }
.timeline-rail { display: flex; flex-direction: column; align-items: center; }
.timeline-dot { width: 10px; height: 10px; border: 3px solid var(--brand); border-radius: 50%; background: white; }
.timeline-line { width: 1px; flex: 1; background: var(--line); }
.timeline-item:last-child .timeline-line { display: none; }
.timeline-copy strong { display: block; font-size: 12px; }
.timeline-copy small { color: var(--muted); }

.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; z-index: 50; padding: 14px 17px; border-radius: 14px; background: var(--ink); color: white; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; font-size: 13px; }
.toast.show { transform: translateY(0); opacity: 1; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }
.footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; display: flex; justify-content: space-between; gap: 20px; }

@media (max-width: 1050px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .layout-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .2s; width: 270px; }
  .app-shell.menu-open .sidebar { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.25); }
  .menu-button { display: block; }
  .topbar { min-height: 66px; padding: 12px 18px; }
  .status-pill { display: none; }
  .content { padding: 28px 18px 60px; }
  .page-heading { display: block; }
  .page-heading .synthetic-note { margin-top: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 23px; }
  .vertical-grid { grid-template-columns: minmax(0, 1fr); }
  .radar-toolbar > * { min-width: 0; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .opportunity { grid-template-columns: 42px 1fr; }
  .saving { grid-column: 2; text-align: left; }
  .opportunity-actions { justify-content: flex-start; }
  .basket-editor-row { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .footer { display: block; }
}
@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .card-header, .card-body { padding-left: 18px; padding-right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
