:root {
  --green-900: #0b4e3b;
  --green-800: #0e654a;
  --green-700: #117755;
  --green-600: #168763;
  --green-100: #dff3e8;
  --green-50: #f2faf6;
  --yellow-500: #ffd20a;
  --yellow-100: #fff4bf;
  --charcoal-950: #1f2428;
  --charcoal-900: #2e3338;
  --charcoal-800: #3c4248;
  --charcoal-700: #596067;
  --charcoal-500: #7a828a;
  --charcoal-300: #b8bec4;
  --charcoal-200: #d9dee2;
  --charcoal-100: #eceff1;
  --charcoal-50: #f6f8f8;
  --white: #ffffff;
  --danger: #c63d3d;
  --danger-soft: #fde8e7;
  --warning: #b87900;
  --warning-soft: #fff4d8;
  --info: #276ea8;
  --info-soft: #e4f0fb;
  --shadow-sm: 0 1px 2px rgba(24, 35, 30, .06), 0 3px 10px rgba(24, 35, 30, .04);
  --shadow-md: 0 14px 36px rgba(24, 35, 30, .12);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-width: 258px;
  --topbar-height: 78px;
  --page-bg: #f2f5f3;
  --surface: #ffffff;
  --surface-alt: #f8faf9;
  --text: #252b2f;
  --text-muted: #697178;
  --border: #e0e5e2;
  --input-bg: #ffffff;
  --table-hover: #f7fbf8;
}

html[data-theme="dark"] {
  --page-bg: #15191c;
  --surface: #202529;
  --surface-alt: #262c30;
  --text: #eff3f1;
  --text-muted: #adb6b1;
  --border: #3a4145;
  --input-bg: #252b2f;
  --table-hover: #28312d;
  --charcoal-50: #242a2e;
  --charcoal-100: #30363a;
  --charcoal-200: #41494f;
  --green-50: #1c3028;
  --green-100: #254839;
  --yellow-100: #4c4116;
  --danger-soft: #442525;
  --warning-soft: #4a3c18;
  --info-soft: #233847;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page-bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
svg { display: block; fill: currentColor; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 5%, rgba(255, 210, 10, .10), transparent 25%),
    linear-gradient(180deg, #30363b 0%, #262b2f 100%);
  box-shadow: 8px 0 28px rgba(14, 22, 18, .12);
}
.brand-block { display: flex; align-items: center; gap: 12px; padding: 8px 8px 22px; }
.brand-logo-wrap {
  width: 54px; height: 54px; flex: 0 0 54px;
  border-radius: 15px; background: #fff; padding: 7px;
  display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.brand-logo { width: 100%; height: 100%; object-fit: contain; }
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy strong { font-size: 16px; letter-spacing: -.2px; white-space: nowrap; }
.brand-copy span { color: #bec6c1; font-size: 12px; }
.nav-list { display: grid; gap: 7px; }
.nav-item, .sidebar-action {
  border: 0; background: transparent; color: #c7cfca;
  min-height: 46px; border-radius: 12px; display: flex; align-items: center; gap: 12px;
  padding: 0 13px; cursor: pointer; text-align: left; transition: .18s ease;
}
.nav-item svg, .sidebar-action svg { width: 20px; height: 20px; flex: 0 0 auto; }
.nav-item:hover, .sidebar-action:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(20,135,99,.95), rgba(20,135,99,.68)); box-shadow: inset 3px 0 0 var(--yellow-500); }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; padding: 14px 4px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.repo-indicator { display: flex; align-items: center; gap: 8px; padding: 9px 10px; color: #bfc8c2; font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #32d78d; box-shadow: 0 0 0 4px rgba(50,215,141,.12); }
.sidebar-action { width: 100%; }

.main-area { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky; top: 0; z-index: 40;
  min-height: var(--topbar-height); padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left h1 { margin: 0; font-size: 23px; letter-spacing: -.4px; line-height: 1.15; }
.eyebrow { margin: 0 0 3px; color: var(--green-700); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.user-chip { margin-left: 4px; display: flex; align-items: center; gap: 10px; min-width: 170px; }
.user-chip > div:last-child { display: grid; min-width: 0; }
.user-chip strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { color: var(--text-muted); font-size: 11px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: linear-gradient(145deg, var(--green-600), var(--green-900)); font-size: 12px; font-weight: 800; }
.mobile-menu { display: inline-grid !important; flex: 0 0 auto; }
.content { padding: 24px; max-width: 1650px; margin: 0 auto; }

.button, .icon-button, .segmented button, .chip-button {
  border: 0; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.button { min-height: 42px; border-radius: 11px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; white-space: nowrap; }
.button svg { width: 18px; height: 18px; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--green-700); box-shadow: 0 7px 16px rgba(17,119,85,.18); }
.button.primary:hover { background: var(--green-800); }
.button.secondary { color: var(--green-800); background: var(--green-50); border: 1px solid color-mix(in srgb, var(--green-700) 18%, var(--border)); }
.button.ghost { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.button.danger { color: #fff; background: var(--danger); }
.button.warning { color: #4b3a00; background: var(--yellow-500); }
.button.compact { min-height: 38px; padding: 0 13px; font-size: 12px; }
.button:disabled { opacity: .55; pointer-events: none; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; background: transparent; }
.icon-button:hover { background: var(--charcoal-100); }
.icon-button svg { width: 21px; height: 21px; }

.page-stack { display: grid; gap: 20px; }
.page-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-intro h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.page-intro p { margin: 4px 0 0; color: var(--text-muted); max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; }
.kpi-card { position: relative; min-height: 132px; overflow: hidden; padding: 18px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.kpi-card::after { content: ""; position: absolute; width: 88px; height: 88px; right: -32px; bottom: -36px; border-radius: 50%; background: var(--accent-soft, var(--green-100)); opacity: .8; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-muted); font-size: 12px; font-weight: 700; }
.kpi-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--accent, var(--green-700)); background: var(--accent-soft, var(--green-100)); }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-value { margin-top: 12px; font-size: 30px; font-weight: 850; letter-spacing: -1px; line-height: 1; }
.kpi-caption { margin-top: 8px; color: var(--text-muted); font-size: 11px; }
.kpi-caption strong { color: var(--text); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(330px,.85fr); gap: 16px; }
.dashboard-grid.equal { grid-template-columns: repeat(2,minmax(0,1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { min-height: 62px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 2px 0 0; color: var(--text-muted); font-size: 11px; }
.card-body { padding: 18px; }
.card-toolbar { display: flex; align-items: center; gap: 8px; }
.text-button { border: 0; background: transparent; color: var(--green-700); font-weight: 750; cursor: pointer; padding: 6px 0; }
.text-button:hover { text-decoration: underline; }

.score-layout { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; }
.score-ring { --value: 0; position: relative; width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-700) calc(var(--value) * 1%), var(--charcoal-100) 0); }
.score-ring::before { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.score-ring-inner { position: relative; z-index: 1; text-align: center; display: grid; gap: 2px; }
.score-ring strong { font-size: 31px; letter-spacing: -1px; }
.score-ring span { font-size: 11px; color: var(--text-muted); }
.score-ring small { color: var(--green-700); font-weight: 800; }
.score-details { display: grid; gap: 12px; }
.score-row { display: grid; grid-template-columns: minmax(90px,1fr) minmax(110px,1.6fr) 64px; gap: 10px; align-items: center; }
.score-label { font-size: 12px; color: var(--text-muted); }
.score-value { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--charcoal-100); }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-800), var(--green-600)); }
.progress-fill.yellow { background: linear-gradient(90deg,#f0b90b,var(--yellow-500)); }
.progress-fill.red { background: var(--danger); }

.status-bars { display: grid; gap: 14px; }
.status-bar-item { display: grid; gap: 6px; }
.status-bar-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.status-bar-head span:last-child { color: var(--text-muted); }
.status-bar-track { height: 10px; border-radius: 999px; background: var(--charcoal-100); overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: inherit; }
.status-bar-fill.complete { background: var(--green-600); }
.status-bar-fill.progress { background: var(--yellow-500); }
.status-bar-fill.pending { background: var(--charcoal-300); }
.status-bar-fill.suspended { background: var(--danger); }

.goal-mini-list { display: grid; gap: 10px; }
.goal-mini { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-alt); }
.goal-mini-code { width: 46px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--green-800); background: var(--green-100); font-size: 10px; font-weight: 850; }
.goal-mini h4 { margin: 0; font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.goal-mini p { margin: 3px 0 0; color: var(--text-muted); font-size: 10px; }
.goal-mini-score { font-size: 14px; font-weight: 850; }

.insight-card { border-left: 4px solid var(--yellow-500); background: linear-gradient(90deg, var(--yellow-100), var(--surface)); }
.insight-layout { display: flex; align-items: flex-start; gap: 14px; }
.insight-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: #5e4b00; background: var(--yellow-500); }
.insight-icon svg { width: 22px; height: 22px; }
.insight-layout h3 { margin: 0 0 4px; font-size: 14px; }
.insight-layout p { margin: 0; color: var(--text-muted); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.search-box { position: relative; flex: 1 1 300px; min-width: 220px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); }
.search-box input { width: 100%; height: 40px; border-radius: 10px; padding: 0 13px 0 39px; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); outline: none; }
.search-box input:focus, select:focus, input:focus, textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(17,119,85,.12); }
.toolbar-select { height: 40px; min-width: 160px; border-radius: 10px; padding: 0 36px 0 12px; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); outline: none; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--charcoal-100); }
.segmented button { min-width: 36px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: transparent; color: var(--text-muted); }
.segmented button.active { color: var(--green-800); background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented svg { width: 18px; height: 18px; }
.results-meta { margin-left: auto; color: var(--text-muted); font-size: 11px; }

.table-card { overflow: auto; }
.data-table { width: 100%; min-width: 1240px; border-collapse: separate; border-spacing: 0; }
.data-table th { position: sticky; top: 0; z-index: 2; padding: 12px 13px; color: #fff; background: var(--charcoal-900); border-bottom: 1px solid var(--charcoal-800); font-size: 10px; letter-spacing: .055em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.data-table th:first-child { border-top-left-radius: 12px; }
.data-table th:last-child { border-top-right-radius: 12px; }
.data-table td { padding: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr { transition: background .14s ease; }
.data-table tbody tr:hover { background: var(--table-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.goal-title-cell { min-width: 330px; }
.goal-title-cell strong { display: block; margin-bottom: 4px; font-size: 12px; line-height: 1.35; }
.goal-title-cell small { color: var(--text-muted); }
.code-badge { display: inline-flex; align-items: center; white-space: nowrap; word-break: keep-all; flex-wrap: nowrap; padding: 5px 8px; border-radius: 8px; color: var(--green-800); background: var(--green-100); font-size: 10px; font-weight: 850; }
.number-cell { font-variant-numeric: tabular-nums; font-weight: 750; }
.weighted-cell { color: var(--green-700); font-size: 14px; font-weight: 850; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-concluida { color: var(--green-800); background: var(--green-100); }
.status-andamento { color: #8a6500; background: var(--yellow-100); }
.status-nao-iniciada { color: var(--text-muted); background: var(--charcoal-100); }
.status-suspensa, .status-cancelada { color: var(--danger); background: var(--danger-soft); }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions .icon-button { width: 33px; height: 33px; }
.row-actions .icon-button svg { width: 17px; height: 17px; }
.row-actions .danger-action { color: var(--danger); }
.table-progress { display: grid; gap: 5px; min-width: 110px; }
.table-progress-line { display: flex; justify-content: space-between; font-size: 10px; }
.table-progress .progress-track { height: 6px; }

.goal-card-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.goal-card { padding: 16px; display: grid; gap: 14px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.goal-card-top { display: flex; justify-content: space-between; gap: 12px; }
.goal-card h3 { margin: 9px 0 0; font-size: 13px; line-height: 1.42; }
.goal-card-menu { display: flex; gap: 3px; }
.goal-card-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.goal-stat { padding: 9px; border-radius: 10px; background: var(--surface-alt); border: 1px solid var(--border); }
.goal-stat span { display: block; color: var(--text-muted); font-size: 9px; text-transform: uppercase; }
.goal-stat strong { display: block; margin-top: 3px; font-size: 13px; }
.goal-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.goal-card-date { color: var(--text-muted); font-size: 10px; }

.empty-state { padding: 50px 20px; text-align: center; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; color: var(--green-700); background: var(--green-100); }
.empty-icon svg { width: 31px; height: 31px; }
.empty-state h3 { margin: 0 0 6px; }
.empty-state p { max-width: 460px; margin: 0 auto 18px; color: var(--text-muted); }

.repository-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.repo-card { padding: 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.repo-card-head { display: flex; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: 11px; font-weight: 750; }
.repo-card-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; color: var(--green-700); background: var(--green-100); }
.repo-card-icon svg { width: 18px; height: 18px; }
.repo-card strong { display: block; margin-top: 14px; font-size: 22px; }
.repo-card small { color: var(--text-muted); }
.repo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.snapshot-list { display: grid; }
.snapshot-item { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.snapshot-item:last-child { border-bottom: 0; }
.snapshot-item h4 { margin: 0; font-size: 12px; }
.snapshot-item p { margin: 3px 0 0; color: var(--text-muted); font-size: 10px; }
.snapshot-actions { display: flex; gap: 5px; }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.storage-note { padding: 12px 14px; border-radius: 11px; color: var(--text-muted); background: var(--info-soft); border-left: 4px solid var(--info); font-size: 11px; }

.history-item { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: start; padding: 15px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.history-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--green-700); background: var(--green-100); font-size: 13px; font-weight: 850; }
.history-item h4 { margin: 0; font-size: 12px; }
.history-item p { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; }
.history-item time { color: var(--text-muted); font-size: 10px; white-space: nowrap; }

.modal {
  width: min(1040px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md);
}
.modal::backdrop { background: rgba(12,18,15,.58); backdrop-filter: blur(3px); }
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 30px); }
.modal-header { min-height: 74px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-tabs { padding: 9px 20px 0; display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.modal-tab { min-height: 39px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; color: var(--text-muted); background: transparent; cursor: pointer; font-weight: 750; }
.modal-tab.active { color: var(--green-700); border-bottom-color: var(--green-700); }
.modal-body { padding: 20px; overflow-y: auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.field input, .field select, .field textarea, .threshold input {
  width: 100%; color: var(--text); background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; outline: none; transition: .15s ease;
}
.field input, .field select { height: 42px; padding: 0 12px; }
.field textarea { padding: 11px 12px; resize: vertical; min-height: 86px; }
.field input::placeholder, .field textarea::placeholder, .threshold input::placeholder { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; } .span-12 { grid-column: span 12; }
.computed-field { height: 42px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; color: var(--green-800); background: var(--green-100); border: 1px solid color-mix(in srgb, var(--green-700) 20%, transparent); font-weight: 850; }
.section-heading { margin: 22px 0 12px; display: flex; justify-content: space-between; }
.section-heading h3 { margin: 0; font-size: 14px; }
.section-heading p { margin: 3px 0 0; color: var(--text-muted); font-size: 11px; }
.threshold-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 9px; }
.threshold { display: grid; gap: 7px; padding: 11px; border-radius: 12px; background: var(--surface-alt); border: 1px solid var(--border); }
.threshold span { font-size: 12px; font-weight: 850; }
.threshold input { height: 38px; padding: 0 9px; font-size: 11px; }
.threshold-0 { border-top: 4px solid #8f969c; }
.threshold-25 { border-top: 4px solid #c2a33b; }
.threshold-50 { border-top: 4px solid #e2b400; }
.threshold-75 { border-top: 4px solid #8fbf74; }
.threshold-100 { border-top: 4px solid var(--green-600); }
.threshold-120 { border-top: 4px solid var(--green-900); }
.modal-footer { min-height: 70px; padding: 13px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border); background: var(--surface-alt); }
.modal-footer-actions { display: flex; gap: 8px; margin-left: auto; }
.weight-warning { color: var(--warning); font-size: 11px; font-weight: 750; }

.confirm-modal { width: min(430px, calc(100vw - 28px)); padding: 28px; text-align: center; }
.confirm-icon { width: 58px; height: 58px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 18px; color: var(--danger); background: var(--danger-soft); font-size: 24px; font-weight: 900; }
.confirm-modal h2 { margin: 0 0 7px; }
.confirm-modal p { margin: 0; color: var(--text-muted); }
.confirm-actions { margin-top: 22px; display: flex; justify-content: center; gap: 9px; }

.toast-stack { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(370px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 12px 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-md); animation: toastIn .22s ease both; }
.toast-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--green-800); background: var(--green-100); font-weight: 900; }
.toast.error .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast.warning .toast-icon { color: var(--warning); background: var(--warning-soft); }
.toast strong { display: block; font-size: 12px; }
.toast p { margin: 2px 0 0; color: var(--text-muted); font-size: 10px; }
.toast-close { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.sidebar-backdrop { display: none; position: fixed; z-index: 45; inset: 0; background: rgba(10,15,12,.5); }

@media (max-width: 1180px) {
  .topbar-actions .button.secondary { display: none; }
  .user-chip { min-width: 130px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .goal-card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .repository-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 248px; }
  .sidebar { transform: translateX(-104%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .main-area { margin-left: 0; }
  .mobile-menu { display: inline-grid !important; }
  .dashboard-grid, .dashboard-grid.equal { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 11px 18px; }
  .topbar-actions .user-chip { display: none; }
  .score-layout { grid-template-columns: 170px 1fr; }
  .threshold-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .span-2, .span-3 { grid-column: span 6; }
}

@media (max-width: 640px) {
  :root { --topbar-height: 70px; }
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar-left h1 { font-size: 18px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .button.ghost { display: none; }
  .topbar-actions .button.primary { width: 39px; min-width: 39px; padding: 0; font-size: 0; }
  .topbar-actions .button.primary svg { width: 20px; height: 20px; }
  .content { padding: 13px; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { min-height: 116px; padding: 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-icon { width: 32px; height: 32px; }
  .score-layout { grid-template-columns: 1fr; justify-items: center; }
  .score-details { width: 100%; }
  .score-row { grid-template-columns: 92px 1fr 58px; }
  .goal-card-grid { grid-template-columns: 1fr; }
  .repository-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .toolbar { gap: 8px; }
  .toolbar-select { flex: 1 1 calc(50% - 6px); min-width: 130px; }
  .segmented { margin-left: auto; }
  .results-meta { width: 100%; margin: 0; }
  .form-grid { gap: 11px; }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 12; }
  .threshold-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .modal-tabs { padding-left: 10px; padding-right: 10px; overflow-x: auto; }
  .modal-tab { padding: 0 10px; white-space: nowrap; }
  .modal-body { padding: 15px; }
  .modal-footer { align-items: stretch; flex-direction: column; }
  .modal-footer-actions { width: 100%; margin: 0; }
  .modal-footer-actions .button { flex: 1; }
  .settings-grid { grid-template-columns: 1fr; }
  .snapshot-item { grid-template-columns: 1fr; }
  .snapshot-actions { justify-content: flex-start; }
  .history-item { grid-template-columns: 38px 1fr; }
  .history-item time { grid-column: 2; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .repository-grid { grid-template-columns: 1fr; }
  .goal-card-stats { grid-template-columns: 1fr 1fr; }
  .goal-card-stats .goal-stat:last-child { grid-column: span 2; }
  .threshold-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .toolbar, .page-actions, .row-actions { display: none !important; }
  .main-area { margin: 0; }
  .content { max-width: none; padding: 0; }
  .card, .kpi-card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}


/* Menu lateral recolhível */
.sidebar, .main-area { transition: width .22s ease, margin-left .22s ease, transform .22s ease; }
@media (min-width: 901px) {
  body.sidebar-collapsed .sidebar { width: 78px; padding-left: 10px; padding-right: 10px; }
  body.sidebar-collapsed .main-area { margin-left: 78px; }
  body.sidebar-collapsed .brand-block { justify-content: center; padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed .brand-logo-wrap { width: 48px; height: 48px; flex-basis: 48px; border-radius: 14px; }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-item span,
  body.sidebar-collapsed .sidebar-action span,
  body.sidebar-collapsed .repo-indicator span:not(.status-dot) { display: none; }
  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .sidebar-action { justify-content: center; padding: 0; }
  body.sidebar-collapsed .nav-item svg,
  body.sidebar-collapsed .sidebar-action svg { width: 22px; height: 22px; }
  body.sidebar-collapsed .sidebar-footer { padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed .repo-indicator { justify-content: center; padding-left: 0; padding-right: 0; }
}

/* Seleção de metas */
.selection-column { width: 46px; min-width: 46px; text-align: center !important; }
.goal-checkbox { width: 17px; height: 17px; accent-color: var(--green-700); cursor: pointer; }
.selected-row { background: color-mix(in srgb, var(--green-100) 45%, var(--surface)); }
.selected-card { border-color: var(--green-600); box-shadow: 0 0 0 2px rgba(17,119,85,.12), var(--shadow-sm); }
.goal-card-select { display: flex; justify-content: flex-end; }
.goal-card-select label { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 10px; cursor: pointer; }
.repository-save-button { color: var(--text-muted); background: var(--surface-alt); border: 1px solid var(--border); }
.repository-save-button.active { color: #fff; background: var(--green-700); border-color: var(--green-700); box-shadow: 0 7px 16px rgba(17,119,85,.16); }
.selection-banner { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid color-mix(in srgb, var(--green-700) 24%, var(--border)); border-radius: 12px; background: var(--green-50); }
.selection-banner strong { color: var(--green-800); white-space: nowrap; }
.selection-banner span { color: var(--text-muted); flex: 1; }
.goal-code-cell { white-space: nowrap; min-width: 96px; }

/* Evidências anexadas */
.attachment-line-button, .goal-evidence-summary {
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--green-800); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; font-weight: 800;
}
.attachment-line-button { min-width: 48px; min-height: 34px; padding: 0 9px; }
.attachment-line-button svg, .goal-evidence-summary svg { width: 17px; height: 17px; }
.attachment-line-button:hover, .goal-evidence-summary:hover { background: var(--green-50); border-color: color-mix(in srgb, var(--green-700) 32%, var(--border)); }
.goal-evidence-summary { width: 100%; min-height: 39px; padding: 0 11px; justify-content: flex-start; color: var(--text-muted); font-size: 11px; }
.attachment-dropzone { min-height: 92px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 14px; border: 1.5px dashed var(--charcoal-300); border-radius: 13px; background: var(--surface-alt); cursor: pointer; outline: none; transition: .16s ease; }
.attachment-dropzone:hover, .attachment-dropzone:focus, .attachment-dropzone.dragging { border-color: var(--green-600); background: var(--green-50); box-shadow: 0 0 0 3px rgba(17,119,85,.09); }
.attachment-dropzone > svg { width: 34px; height: 34px; padding: 7px; border-radius: 10px; color: var(--green-700); background: var(--green-100); }
.attachment-dropzone strong { display: block; font-size: 12px; }
.attachment-dropzone small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.attachment-editor-list, .attachment-consult-list { display: grid; gap: 8px; margin-top: 10px; }
.attachment-editor-item, .attachment-consult-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.attachment-editor-item.removed { opacity: .68; border-style: dashed; background: var(--danger-soft); }
.attachment-file-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--green-800); background: var(--green-100); font-size: 9px; font-weight: 900; letter-spacing: .03em; }
.attachment-file-icon.large { width: 46px; height: 46px; }
.attachment-file-copy { min-width: 0; }
.attachment-file-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-file-copy small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.attachment-item-actions { display: flex; align-items: center; gap: 5px; }
.attachment-empty-inline { padding: 14px; border: 1px dashed var(--border); border-radius: 11px; color: var(--text-muted); text-align: center; font-size: 11px; }
.attachment-modal { width: min(780px, calc(100vw - 28px)); }
.attachment-modal-description { margin: 0 0 16px; color: var(--text-muted); }
.attachment-storage-hint { color: var(--text-muted); font-size: 10px; }
.attachment-empty-state { padding: 36px 16px; text-align: center; }
.attachment-empty-state .attachment-file-icon { margin: 0 auto 12px; }
.attachment-empty-state h3 { margin: 0 0 5px; }
.attachment-empty-state p { margin: 0; color: var(--text-muted); }

/* Repositório individual */
.archive-list { display: grid; }
.archive-item { display: grid; grid-template-columns: 105px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.archive-item:last-child { border-bottom: 0; }
.archive-code { white-space: nowrap; }
.archive-copy { min-width: 0; }
.archive-copy h4 { margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-copy p { margin: 3px 0 0; color: var(--text-muted); font-size: 10px; }
.archive-actions { display: flex; align-items: center; gap: 6px; }
.archive-modal { width: min(820px, calc(100vw - 28px)); }
.archive-detail-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.archive-detail-grid > div { padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-alt); }
.archive-detail-grid .wide { grid-column: span 4; }
.archive-detail-grid span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.archive-detail-grid strong { display: inline-flex; font-size: 12px; }
.archive-detail-grid p { margin: 0; color: var(--text-muted); }

@media (max-width: 900px) {
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
  body.sidebar-collapsed .main-area { margin-left: 0; }
  .archive-item { grid-template-columns: 90px minmax(0,1fr); }
  .archive-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 640px) {
  .selection-banner { align-items: flex-start; flex-wrap: wrap; }
  .selection-banner span { flex-basis: 100%; order: 3; }
  .attachment-dropzone { grid-template-columns: 38px 1fr; }
  .attachment-dropzone .button { grid-column: 1 / -1; width: 100%; }
  .attachment-editor-item, .attachment-consult-item { grid-template-columns: 38px minmax(0,1fr); }
  .attachment-item-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .archive-detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .archive-detail-grid .wide { grid-column: span 2; }
  .archive-item { grid-template-columns: 1fr; }
  .archive-actions { grid-column: auto; justify-content: flex-start; flex-wrap: wrap; }
}
