/* =========================================================================
   Proposta D — visual do B (cartões, cantos 16–24 px, sombra leve, pílulas)
   com a informação do C. Uma densidade só.
   base.css: tokens + componentes reutilizáveis.
   ========================================================================= */

:root {
  /* Azul — escala de referência (primário = 600 = #1F5FA8) */
  --blue-50:  #F1F6FD;
  --blue-100: #E2EDFA;
  --blue-200: #C7DBF3;
  --blue-300: #9DBFE3;
  --blue-400: #6A9FDB;
  --blue-500: #2B6FBF;
  --blue-600: #1F5FA8;
  --blue-700: #174A85;
  --blue-800: #0F2F57;
  --blue-900: #0B2443;

  /* Neutros cinza-azulados */
  --ink-900: #14263D;
  --ink-700: #34465A;
  --ink-600: #45586F;
  --ink-500: #5E6F86;
  --line-300: #C5D3E4;
  --line-200: #DFE7F1;
  --line-100: #EAF0F6;
  --surface-0: #FFFFFF;
  --surface-1: #F8FAFD;
  --surface-2: #EEF3F9;

  /* Estado (sempre com ícone ou texto) */
  --ok-700: #1A7346;   --ok-50: #E3F4EA;   --ok-200: #B9E0C8;
  --warn-700: #8A5300; --warn-50: #FFF2D9; --warn-200: #F1D8A6;
  --err-700: #B42318;  --err-50: #FDEBE9;  --err-200: #F5C2BC;
  --info-700: #0B6680; --info-50: #DFF2F7; --info-200: #B5DEE9;
  --mute-700: #525E6E; --mute-50: #ECEFF3; --mute-200: #D3D9E0;

  /* Papéis */
  --bg: #F3F6FB;
  --panel: var(--surface-0);
  --text: var(--ink-900);
  --text-2: var(--ink-600);
  --text-3: var(--ink-500);
  --border: var(--line-200);
  --border-strong: var(--line-300);
  --primary: var(--blue-600);
  --primary-hover: var(--blue-700);
  --focus: 0 0 0 3px #fff, 0 0 0 6px var(--blue-500);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --pill: 999px;
  --sh-1: 0 1px 2px rgba(15, 47, 87, .06), 0 2px 10px rgba(15, 47, 87, .05);
  --sh-2: 0 2px 4px rgba(15, 47, 87, .06), 0 14px 36px rgba(15, 47, 87, .12);
  --shadow-pop: var(--sh-2);

  /* Medidas fixas (uma densidade, a do B) */
  --fs: 16px;
  --fs-sm: 14px;
  --fs-lg: 19px;
  --fs-xl: 30px;
  --lh: 1.5;
  --ctl-h: 44px;
  --ctl-px: 16px;
  --btn-px: 20px;
  --row-h: 60px;
  --cell-px: 20px;
  --gap: 20px;
  --gap-sm: 10px;
  --card-p: 26px;
  --section-gap: 28px;
  --nav-h: 48px;
  --tab-h: 42px;
  --header-h: 76px;
  --sidebar-w: 272px;
}

/* ---- Reset leve ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: var(--fs); line-height: var(--lh); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
h1 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.mono { font-family: var(--mono); font-size: .9em; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
body.no-scroll { overflow: hidden; }

/* ---- Ícones ----------------------------------------------------------- */
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 28px; height: 28px; }

/* ---- Botões (pílula) -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl-h); padding: 0 var(--btn-px);
  font-weight: 600; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--pill);
  background: var(--panel); color: var(--blue-700);
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--blue-50); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(31, 95, 168, .28); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-soft { background: var(--blue-100); border-color: transparent; color: var(--blue-700); }
.btn-soft:hover { background: var(--blue-200); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--blue-50); color: var(--blue-700); }
.btn-danger { color: var(--err-700); border-color: var(--err-200); }
.btn-danger:hover { background: var(--err-50); }
.btn-danger-solid { background: var(--err-700); border-color: var(--err-700); color: #fff; }
.btn-danger-solid:hover { background: #8f1c13; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-icon { width: var(--ctl-h); padding: 0; border-radius: 50%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: var(--gap-sm); flex-wrap: wrap; align-items: center; }

/* Segmentado (pílulas) */
.seg { display: inline-flex; padding: 4px; border-radius: var(--pill); background: var(--blue-100); gap: 4px; }
.seg button { min-height: 38px; padding: 0 16px; border-radius: var(--pill); border: 0; background: transparent; color: var(--blue-700); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.seg button:hover { color: var(--blue-800); }
.seg button[aria-pressed="true"] { background: var(--panel); box-shadow: var(--sh-1); color: var(--blue-800); }

/* ---- Campos ----------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field-label { font-size: 15px; font-weight: 600; color: var(--ink-700); }
.field .help { font-size: var(--fs-sm); color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 0 var(--ctl-px);
  color: var(--text); background: var(--panel); font-size: 16px;
  border: 1px solid var(--border-strong); border-radius: 14px;
}
.textarea { padding: 12px var(--ctl-px); min-height: 104px; resize: vertical; }
.select { appearance: none; padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-600) 50%), linear-gradient(135deg, var(--ink-600) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--blue-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-100); }
.input[readonly] { background: var(--surface-1); color: var(--text-2); }
.field.has-error .input, .field.has-error .select { border-color: var(--err-700); box-shadow: 0 0 0 4px var(--err-50); }
.field .error-msg { display: none; font-size: var(--fs-sm); color: var(--err-700); font-weight: 600; align-items: center; gap: 6px; }
.field.has-error .error-msg { display: inline-flex; }
.input-group { display: flex; align-items: stretch; }
.input-group .prefix { display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid var(--border-strong); border-right: 0; border-radius: 14px 0 0 14px; background: var(--surface-1); color: var(--text-2); }
.input-group .input { border-radius: 0 14px 14px 0; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--ctl-h); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px 24px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }

/* ---- Badges de estado (ícone + texto) -------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 9px; border-radius: var(--pill);
  font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap;
}
.badge .ic { width: 16px; height: 16px; stroke-width: 2; }
.b-ok   { background: var(--ok-50);   color: var(--ok-700); }
.b-warn { background: var(--warn-50); color: var(--warn-700); }
.b-err  { background: var(--err-50);  color: var(--err-700); }
.b-info { background: var(--blue-100); color: var(--blue-700); }
.b-mute { background: var(--mute-50); color: var(--mute-700); }
.b-blue { background: var(--blue-700); color: #fff; }
.count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 9px; border-radius: var(--pill); font-size: 14px; font-weight: 700; background: var(--blue-100); color: var(--blue-700); }

/* ---- Cartões -------------------------------------------------------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--sh-1); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px var(--card-p) 0; flex-wrap: wrap; }
.card-h h2, .card-h h3 { display: flex; align-items: center; gap: 10px; }
.card-h h2 .ic { color: var(--blue-600); }
.card-b { padding: 18px var(--card-p) var(--card-p); }
.card-f { padding: 18px var(--card-p); border-top: 1px solid var(--line-100); display: flex; gap: var(--gap-sm); justify-content: flex-end; flex-wrap: wrap; }
.card-flush .card-b { padding: 18px 0 0; }
.card-flush .card-b > .table-wrap, .card-flush > .table-wrap { border-top: 1px solid var(--line-100); }
.card-flush .card-b > .empty { padding-bottom: 40px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--sh-1); padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.kpi .k-label { font-size: 15px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.kpi .k-label .ic { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--blue-100); color: var(--blue-600); box-sizing: border-box; }
.kpi .k-value { font-size: 32px; font-weight: 750; color: var(--blue-800); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.kpi .k-foot { font-size: var(--fs-sm); color: var(--text-3); }
.kpi.k-hero { background: linear-gradient(150deg, var(--blue-600), var(--blue-800)); border-color: transparent; color: #fff; }
.kpi.k-hero .k-label, .kpi.k-hero .k-foot { color: #D7E5F7; }
.kpi.k-hero .k-value { color: #fff; }
.kpi.k-hero .k-label .ic { background: rgba(255,255,255,.16); color: #fff; }
.kpi.k-err .k-value { color: var(--err-700); }
.kpi.k-err .k-label .ic { background: var(--err-50); color: var(--err-700); }

/* Lista de definição */
.dl { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 0 var(--gap); margin: 0; }
.dl dt, .dl dd { padding: 11px 0; border-bottom: 1px solid var(--line-100); }
.dl dt { color: var(--text-3); font-size: 15px; }
.dl dd { margin: 0; font-weight: 600; }
.dl dt:nth-last-of-type(1), .dl dd:last-of-type { border-bottom: 0; }

/* ---- Tabela (arejada) ------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { height: var(--row-h); padding: 10px var(--cell-px); text-align: left; border-bottom: 1px solid var(--line-100); vertical-align: middle; }
.table th { height: 48px; font-size: 13px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-1); white-space: nowrap; }
.table tbody tr:hover td { background: var(--blue-50); }
.table tbody tr.row-alert td { background: var(--err-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.right, .table th.right { text-align: right; }
.table tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 700; background: var(--surface-1); border-bottom: 0; }
.cell-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.cell-sub { display: block; font-size: 13.5px; color: var(--text-3); }

/* ---- Abas internas -------------------------------------------------- */
.subtabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--pill); background: var(--blue-100); overflow-x: auto; max-width: 100%; align-self: flex-start; }
.subtabs button { font-weight: 600; color: var(--blue-700); background: none; border: 0; border-radius: var(--pill); padding: 0 18px; min-height: 40px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.subtabs [aria-selected="true"] { background: var(--panel); color: var(--blue-800); box-shadow: var(--sh-1); }

/* ---- Avisos (banners) ----------------------------------------------- */
.alert { display: flex; gap: 16px; align-items: center; padding: 18px 22px; border: 1px solid; border-radius: var(--radius-lg); }
.alert > .ic { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: rgba(255,255,255,.75); box-sizing: border-box; flex: none; }
.alert strong { display: block; font-size: 17px; }
.alert p { color: var(--ink-700); font-size: 15px; }
.alert-err  { background: var(--err-50);  border-color: var(--err-200);  color: var(--err-700); }
.alert-err p { color: #7A1A12; }
.alert-warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.alert-warn p { color: #5C3A00; }
.alert-ok   { background: var(--ok-50);   border-color: var(--ok-200);   color: var(--ok-700); }
.alert-info { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }

/* ---- Estado vazio --------------------------------------------------- */
.empty { text-align: center; padding: 44px 24px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .empty-ic { width: 80px; height: 80px; border-radius: 50%; background: var(--blue-100); display: grid; place-items: center; color: var(--blue-600); margin-bottom: 4px; }
.empty .empty-ic .ic { width: 36px; height: 36px; stroke-width: 1.5; }
.empty h3 { color: var(--text); font-size: 20px; }
.empty p { max-width: 460px; color: var(--text-3); }
.empty .btn, .empty .btn-group { margin-top: 8px; }

/* ---- Modal ---------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 36, 67, .45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal { background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--sh-2); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 26px 28px 0; gap: 12px; }
.modal-h h2 { font-size: 22px; }
.modal-b { padding: 20px 28px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-b .card { box-shadow: none; background: var(--surface-1); }
.modal-f { padding: 0 28px 26px; display: flex; gap: var(--gap-sm); justify-content: flex-end; flex-wrap: wrap; }
.modal.static { box-shadow: var(--sh-1); border: 1px solid var(--border); }

/* ---- Toast ---------------------------------------------------------- */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 12px; align-items: center; background: var(--blue-900); color: #fff; padding: 14px 16px 14px 14px; border-radius: var(--radius); box-shadow: var(--sh-2); min-width: 280px; max-width: 420px; font-size: 15px; animation: surge .2s ease-out; }
.toast .t-ic { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; flex: none; }
.toast .t-sub { font-size: 13.5px; color: #C8D6E8; }
.toast.t-ok .t-ic { color: #8FE3B4; }
.toast.t-err .t-ic { color: #F8A8A0; }
.toast.t-info .t-ic { color: var(--blue-300); }
.toast .t-close { margin-left: auto; background: none; border: 0; color: #C8D6E8; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast .t-close:hover { background: rgba(255,255,255,.1); }
.toast.static { animation: none; }
@keyframes surge { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

kbd { font-family: var(--mono); font-size: 12.5px; padding: 2px 7px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); color: var(--ink-700); }

/* ---- Linha do tempo (etapas) ---------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(6, 1fr); list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding-top: 60px; text-align: center; font-size: 14px; color: var(--text-3); padding-left: 4px; padding-right: 4px; }
.steps li::before { content: ""; position: absolute; top: 22px; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line-200); }
.steps li:first-child::before { left: 50%; }
.steps li:last-child::before { right: 50%; }
.steps .dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line-300); color: var(--ink-500); z-index: 1; }
.steps .dot .ic { width: 20px; height: 20px; stroke-width: 2; }
.steps .s-name { display: block; font-weight: 650; font-size: 15px; color: var(--ink-700); }
.steps .s-date { display: block; font-size: 13.5px; }
.steps li.done::before, .steps li.current::before { background: var(--blue-600); }
.steps li.done .dot { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.steps li.current .dot { border-color: var(--blue-600); color: var(--blue-600); box-shadow: 0 0 0 6px var(--blue-100); }
.steps li.current .s-name { color: var(--blue-700); }
.steps li.current .s-name::after { content: " · agora"; font-weight: 700; }
.steps li.late .dot { border-color: var(--err-700); color: var(--err-700); box-shadow: 0 0 0 6px var(--err-50); }
.steps li.late .s-name { color: var(--err-700); }

/* ---- Foto (placeholder) — cada ângulo tem fundo e recorte próprios ---- */
.ph { position: relative; overflow: hidden; display: grid; place-items: center; color: var(--ph, #1F5FA8); border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #F4F8FD 0%, #D8E3F0 100%); }
.ph::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 28% 16%, rgba(255,255,255,.55), transparent 55%); pointer-events: none; }
.ph > svg { width: 66%; height: 84%; position: relative; z-index: 0; }
.ph[data-a="costas"] { background: linear-gradient(200deg, #EEF3FA 0%, #CBD8E8 100%); }
.ph[data-a="detalhe"] { background: radial-gradient(circle at 70% 80%, #C9D7E8, #EEF3F9 70%); }
.ph[data-a="detalhe"] > svg { width: 100%; height: 100%; }
.ph[data-a="caimento"] { background: linear-gradient(180deg, #F6F8FB 0 72%, #E1E8F1 72% 100%); }
.ph[data-a="lateral"] { background: linear-gradient(115deg, #E4ECF6 0%, #F7F9FC 55%, #DCE5F0 100%); }
.ph[data-a="etiqueta"] { background: repeating-linear-gradient(45deg, #F1F4F8 0 7px, #E7ECF3 7px 14px); }
.ph[data-a="etiqueta"] > svg { width: 78%; }
.ph[data-a="cabide"] { background: linear-gradient(170deg, #EAF0F8 0%, #C9D6E7 100%); }
.ph-thumb { width: 44px; height: 54px; flex: none; }
.ph-thumb > svg { width: 78%; height: 88%; }
.ph-thumb[data-a="detalhe"] > svg { width: 100%; height: 100%; }
.ph-th { width: 100%; aspect-ratio: 4 / 5; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); vertical-align: -2px; flex: none; }
