@import url("./fonts/inter.css");
:root {
  /* Same neutral theme anchors and surface ramp as the plugin's desktop host. */
  color-scheme: light;
  --canvas: oklch(1 0 0); --ink: oklch(0.3211 0 0);
  --background: var(--canvas); --foreground: var(--ink); --surface: var(--canvas); --surface-raised: var(--canvas);
  --muted: color-mix(in oklch, var(--ink) 11%, var(--canvas)); --muted-foreground: oklch(0.44 0 0);
  --border: color-mix(in oklch, var(--ink) 14%, var(--canvas));
  --primary: oklch(0.27 0 0); --primary-foreground: oklch(1 0 0);
  --primary-hover: color-mix(in oklab, var(--foreground) 90%, var(--background));
  --state-hover: color-mix(in oklab, var(--ink) 5.9%, transparent);
  --state-active: color-mix(in oklab, var(--ink) 11.8%, transparent);
  --danger: oklch(0.45 0.19 25.8625); --danger-soft: color-mix(in oklab, var(--danger) 8%, var(--canvas));
  --success: var(--foreground); --focus: var(--primary); --shadow: 0 1px 2px #0000000d; --radius: 6px; --radius-lg: 8px;
  font-family: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none; text-rendering: optimizeLegibility; color: var(--foreground); background: var(--background);
}
.dark {
  color-scheme: dark;
  --canvas: oklch(0.195 0 0); --ink: oklch(0.81 0 0);
  --muted: color-mix(in oklch, var(--ink) 16%, var(--canvas)); --muted-foreground: oklch(0.78 0 0);
  --border: color-mix(in oklch, var(--ink) 19.4%, var(--canvas));
  --primary: oklch(0.82 0 0); --primary-foreground: oklch(0.2178 0 0);
  --state-hover: color-mix(in oklab, var(--ink) 13.8%, transparent);
  --state-active: color-mix(in oklab, var(--ink) 22.5%, transparent);
  --danger: oklch(0.65 0.16 22);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  min-width: 320px; background: var(--background); scroll-behavior: smooth;
}
body {
  min-width: 320px; min-height: 100vh; margin: 0; background: var(--background); color: var(--foreground); font-size: 14px; line-height: 1.5;
}
button,
input,
select,
textarea {
  font: inherit; color: inherit;
}
button,
select {
  cursor: pointer;
}
button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed; opacity: .55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 65%, transparent); outline-offset: 2px;
}
input,
select,
textarea {
  min-height: 36px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; background: var(--surface);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted-foreground); opacity: .8;
}
input[type="checkbox"],
input[type="radio"] {
  min-height: 0; accent-color: var(--primary);
}
select {
  padding-right: 30px;
}
[hidden] {
  display: none !important;
}
.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;
}
.app-shell {
  min-height: 100vh; background: var(--background);
}
.topbar {
  position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--border); padding: 10px clamp(16px, 4vw, 48px);
  background: var(--surface);
}
.brand,
.top-actions,
.toolbar,
.tabs,
.table-actions,
.modal-actions {
  display: flex; align-items: center; gap: 10px;
}
.brand {
  min-width: 0; color: var(--foreground); font-size: 16px; font-weight: 600; letter-spacing: -.025em; text-decoration: none;
}
.brand-logo { flex: none; display: block; width: 109px; height: 32px; object-fit: contain; }
.brand-dark, .dark .brand-light { display: none; }
.dark .brand-dark { display: block; }
.brand-divider { width: 1px; height: 20px; background: var(--border); margin-inline: 6px; }
.brand-label { font-size: 13px; font-weight: 500; letter-spacing: normal; }

.top-actions {
  justify-content: flex-end; flex-wrap: wrap;
}
.workspace {
  container-type: inline-size; width: min(100% - 32px, 1160px); margin: 0 auto; padding: 32px 0 48px;
}
.page-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px;
}
.page-heading h1 {
  margin: 2px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -.04em; line-height: 1.18;
}
.eyebrow {
  color: var(--muted-foreground); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
}
.muted,
.metric-label,
.metric-note {
  color: var(--muted-foreground);
}
.toolbar {
  justify-content: space-between; flex-wrap: wrap; margin: 0 0 16px;
}
.tabs {
  width: fit-content; flex-wrap: wrap; gap: 4px; border: 0; border-radius: 8px; padding: 4px; background: var(--muted);
}
.tab {
  display: inline-flex; min-height: 32px; align-items: center; justify-content: center; border: 0; border-radius: 7px; padding: 5px 12px; background: transparent; color: var(--muted-foreground); font-weight: 550;
  white-space: nowrap;
}
.tab:hover {
  background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--foreground);
}
.tab.active,
.tab[aria-selected="true"] {
  background: var(--surface); color: var(--foreground); box-shadow: 0 1px 2px #0002;
}
.button,
.icon-button {
  display: inline-flex; min-height: 32px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 11px; background: var(--surface);
  color: var(--foreground); font-weight: 500; line-height: 1.3; text-decoration: none; transition: background-color .14s ease, border-color .14s ease, transform .14s ease;
}
.button:hover,
.icon-button:hover {
  background: var(--state-hover);
}
.button:active,
.icon-button:active {
  transform: translateY(1px);
}
.button.primary {
  border-color: var(--foreground); background: var(--foreground); color: var(--background);
}
.button.primary:hover {
  border-color: var(--primary-hover); background: var(--primary-hover);
}
.button.danger {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border)); background: var(--danger-soft); color: var(--danger);
}
.icon-button {
  width: 32px; padding: 0;
}
.panel {
  min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; background: var(--surface); box-shadow: var(--shadow);
}
.panel + .panel,
.panel-stack > .panel + .panel {
  margin-top: 16px;
}
.panel-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px;
}
.panel-heading h2,
.panel-heading h3 {
  margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.02em;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.metric {
  min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; background: var(--surface);
}
.metric-label {
  font-size: 12px; font-weight: 550;
}
.metric-value {
  margin-top: 4px; font-size: clamp(20px, 2vw, 26px); font-weight: 600; letter-spacing: -.035em; line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
}
.metric-note {
  margin-top: 6px; font-size: 12px;
}
.two-columns,
.detail-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px;
}
.progress {
  width: 100%; height: 8px; overflow: hidden; border-radius: 999px; background: var(--muted);
}
.progress-fill,
.bar-fill {
  height: 100%; border-radius: inherit; background: var(--primary);
}
.breakdown {
  display: grid; gap: 12px;
}
.breakdown-row {
  display: grid; grid-template-columns: minmax(100px, 1fr) minmax(90px, 2fr) auto; align-items: center; gap: 12px;
}
.bar-track {
  height: 8px; overflow: hidden; border-radius: 999px; background: var(--muted);
}
.bar-fill {
  min-width: 2px;
}
.status-dot {
  display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted-foreground);
}
.status-dot.success,
.status-dot.active {
  background: var(--success);
}
.status-dot.danger,
.status-dot.disabled {
  background: var(--danger);
}
.badge {
  display: inline-flex; min-height: 23px; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; background: var(--muted); color: var(--muted-foreground);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success {
  border-color: var(--border); background: var(--muted); color: var(--foreground);
}
.badge-danger {
  border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); background: var(--danger-soft); color: var(--danger);
}
.badge-muted {
  background: var(--muted); color: var(--muted-foreground);
}
.table-scroll {
  max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
}
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px; text-align: left;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border); padding: 11px 12px; vertical-align: middle;
}
.data-table th {
  color: var(--muted-foreground); font-size: 11px; font-weight: 600; letter-spacing: .045em; text-transform: uppercase; white-space: nowrap;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
}
.user-cell {
  display: flex; min-width: 180px; align-items: center; gap: 10px;
}
.avatar {
  display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: 50%; background: var(--muted); color: var(--primary); font-size: 12px; font-weight: 700;
}
.table-actions {
  flex-wrap: wrap; gap: 6px;
}
.search-field {
  display: flex; min-width: min(100%, 230px); align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 10px; background: var(--surface);
}
.search-field input {
  width: 100%; min-height: 34px; border: 0; padding: 4px 0; outline: 0; background: transparent;
}
.search-field:focus-within {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 1px;
}
.field {
  display: grid; min-width: 0; gap: 6px;
}
.field label,
.field-label {
  color: var(--foreground); font-size: 12px; font-weight: 600;
}
.filters {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 0 0 16px;
}
.empty-state {
  display: grid; min-height: 180px; place-items: center; border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 24px; color: var(--muted-foreground); text-align: center;
}
.alert {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--muted);
}
.alert-error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); color: var(--danger);
}
.footer {
  display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); margin-top: 28px; padding-top: 16px; color: var(--muted-foreground); font-size: 12px;
}
.login-layout {
  display: grid; width: min(100%, 400px); gap: 24px; margin: clamp(32px, 9vh, 96px) auto;
}
.login-story h1 { margin: 8px 0; font-size: 28px; font-weight: 600; letter-spacing: -.04em; line-height: 1.2; }
.login-story p { margin: 0; }
.login-story .eyebrow { margin-bottom: 12px; }
.login-card { display: grid; gap: 20px; padding: 24px; }
.login-card h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.login-card p { margin: 0; }
.login-card .button { min-height: 36px; }
dialog.modal {
  width: min(calc(100% - 32px), 560px); max-height: min(85vh, 760px); overflow: auto; border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--foreground);
  box-shadow: var(--shadow);
}
dialog.modal::backdrop,
.modal-backdrop {
  background: #00000080; backdrop-filter: blur(3px);
}
.modal-backdrop {
  position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 16px;
}
.modal-backdrop > .modal {
  position: relative; width: min(100%, 560px); max-height: 90vh; overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
}
.modal-actions {
  justify-content: flex-end; flex-wrap: wrap; margin-top: 20px;
}
.detail-grid {
  margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chart {
  min-width: 0;
}
.chart-bars {
  display: flex; min-height: 150px; align-items: end; justify-content: space-around; gap: 8px; border-bottom: 1px solid var(--border); padding: 12px 4px 0;
}
.chart-column {
  display: flex; min-width: 0; height: 100%; flex: 1; flex-direction: column; align-items: center; justify-content: end; gap: 6px;
}
.chart-bar {
  width: min(100%, 28px); min-height: 2px; border-radius: 5px 5px 1px 1px; background: var(--primary);
}
.chart-label {
  max-width: 100%; overflow: hidden; color: var(--muted-foreground); font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}
@container (max-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .two-columns,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .workspace {
    width: min(100% - 24px, 1160px); padding-top: 22px;
  }
  .topbar {
    min-height: 56px; padding-inline: 12px;
  }
  .page-heading {
    align-items: flex-start; flex-direction: column; gap: 12px;
  }
  .panel {
    padding: 15px;
  }
}
@media (max-width: 420px) {
  .brand-label, .brand-divider { display: none; }
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolbar,
  .footer {
    align-items: stretch; flex-direction: column;
  }
  .tabs {
    max-width: 100%; overflow-x: auto; flex-wrap: nowrap;
  }
  .breakdown-row {
    grid-template-columns: minmax(75px, 1fr) minmax(60px, 1fr) auto; gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  }
}
/* Keep dynamically generated rows aligned with the compact plugin cards. */
.small { font-size: 12px; }
.text-link { color: var(--primary); text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.tab { text-decoration: none; }
.tabs { margin-bottom: 20px; }
.tab-count { margin-left: 5px; font-size: 11px; }
.two-columns > .panel + .panel { margin-top: 0; }
.detail-grid strong, .user-cell small, .data-table td > small { display: block; }
.panel-divider { border-top: 1px solid var(--border); margin: 20px 0; }
.budget-row + .budget-row { margin-top: 18px; }
.budget-row .panel-heading { margin-bottom: 8px; flex-wrap: wrap; }
.breakdown-row { display: block; }
.breakdown-row .panel-heading { margin-bottom: 6px; overflow-wrap: anywhere; }
.ledger-summary { margin-bottom: 14px; }
.check-field { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
.check-field input { width: 16px; height: 16px; }
dialog.modal { padding: 24px; }
.chart-bars { height: 180px; gap: 4px; }
.chart-column { height: 148px; }
.chart-bar { flex-shrink: 1; }
.chart-label { min-height: 15px; flex-shrink: 0; }

.debug-json { max-height: 32rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem; border: 1px solid var(--border); border-radius: .5rem; font-size: .8rem; }
#brightdata-detail { margin-top: 1rem; }
