:root {
  --ink: #1c2430;
  --muted: #667085;
  --line: #d9e0e7;
  --panel: #ffffff;
  --paper: #f5f7f9;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --signal: #d9463e;
  --blue: #2f6fed;
  --amber: #b7791f;
  --shadow: 0 20px 50px rgba(28, 36, 48, 0.08);
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/inter-latin-700-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/fonts/inter-latin-800-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/fonts/inter-latin-900-normal.woff2") format("woff2");
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}
.login-panel h1 { margin: 10px 0 0; }

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 220ms ease;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #10201f;
  color: #f6fbfa;
  transition: padding 220ms ease, transform 240ms ease, box-shadow 240ms ease;
}
.mobile-shell-bar,
.sidebar-backdrop {
  display: none;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #34d399;
  color: #082f2b;
  font-weight: 900;
}
.brand strong, .brand span { display: block; }
.brand span { color: #a7c7c2; font-size: 0.85rem; }
.brand-text,
.nav-label {
  max-width: 160px;
  overflow: hidden;
  opacity: 1;
  white-space: nowrap;
  transition: max-width 180ms ease, opacity 160ms ease;
}
.collapse-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: white;
  cursor: pointer;
}
.nav-list { display: grid; gap: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #d8e6e3;
  text-decoration: none;
}
.nav-item span[aria-hidden="true"],
.secondary-button span[aria-hidden="true"] {
  display: inline-grid;
  min-width: 20px;
  place-items: center;
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 18px 14px;
}
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-label {
  max-width: 0;
  opacity: 0;
}
.sidebar-collapsed .sidebar-top,
.sidebar-collapsed .nav-item,
.sidebar-collapsed .secondary-button {
  justify-content: center;
}
.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.sidebar-collapsed .brand {
  justify-content: center;
  width: 52px;
  gap: 0;
}
.sidebar-collapsed .brand-mark,
.sidebar-collapsed .nav-item,
.sidebar-collapsed .secondary-button {
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
}
.sidebar-collapsed .nav-item,
.sidebar-collapsed .secondary-button {
  gap: 0;
}
.sidebar-collapsed .collapse-button {
  width: 52px;
  height: 52px;
  line-height: 1;
}
.sidebar-collapsed .nav-list {
  width: 52px;
  justify-items: center;
}
.sidebar-collapsed .collapse-button {
  position: static;
}
.nav-item.active, .nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
  padding: 28px;
}
.topbar, .section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.topbar > div:first-child,
.section-heading > div:first-child {
  min-width: 0;
}
.topbar h1, .section-heading h2 { margin: 0; letter-spacing: 0; }
.topbar h1 {
  max-width: 720px;
  font-size: clamp(1.45rem, 2.2vw, 2.2rem);
  line-height: 1.08;
}
.section-heading h2 { font-size: 1.2rem; }
.eyebrow {
  display: none;
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-button, .secondary-button, .segmented-control button, .open-link, .small-button {
  border: 0;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
}
.primary-button:hover { background: var(--accent-strong); }
.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}
.primary-button.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
.secondary-button {
  margin-top: auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #10201f;
  background: #d8f5ed;
}
.scan-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: min(360px, 100%);
}
.site-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 46px;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 0.92rem;
}
.site-alert p {
  margin: 0;
}
.site-alert button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.site-alert button:hover {
  background: rgba(0, 0, 0, 0.06);
}
.site-alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}
.site-alert[data-type="running"],
.site-alert[data-type="info"] {
  border-color: #b7e4dc;
  background: #ecfdf8;
  color: var(--accent-strong);
}
.site-alert[data-type="success"] {
  border-color: #c7e8d2;
  background: #f0fdf4;
  color: #027a48;
}
.site-alert[data-type="error"] {
  border-color: #ffd3ce;
  background: #fff1f0;
  color: var(--signal);
}
.site-alert[data-type="running"] .site-alert-dot,
.site-alert[data-type="info"] .site-alert-dot {
  background: var(--accent-strong);
}
.site-alert[data-type="success"] .site-alert-dot {
  background: #027a48;
}
.site-alert[data-type="error"] .site-alert-dot {
  background: var(--signal);
}
.wide { width: 100%; }
.metrics, .workspace { display: grid; gap: 16px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.metric { padding: 18px; }
.metric span { display: block; color: var(--muted); font-size: 0.88rem; }
.metric strong { display: block; margin-top: 8px; font-size: 1.6rem; }
.workspace { grid-template-columns: minmax(280px, 390px) minmax(0, 1fr); align-items: start; }
.panel { padding: 20px; }
.filter-summary-panel {
  padding: 14px 16px;
  margin-bottom: 6px;
}
.filter-summary-panel .section-heading {
  align-items: center;
  gap: 12px;
}
.filter-summary-panel .section-heading h2 {
  font-size: 1rem;
}
.detail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}
.detail-grid span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.detail-grid strong {
  color: var(--ink);
  font-size: 0.8rem;
}
.filter-form { display: grid; gap: 16px; margin-top: 18px; }
.filter-form.narrow { max-width: 520px; }
.user-form { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; }
label, fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  color: #344054;
  font-size: 0.9rem;
  font-weight: 750;
}
fieldset { border: 0; padding: 0; }
legend { padding: 0; margin-bottom: 8px; }
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}
.source-pill input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 160px;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f5;
}
.segmented-control button { background: transparent; color: var(--muted); }
.segmented-control button.active { background: white; color: var(--ink); }
.match-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.match-toolbar label {
  min-width: 180px;
  max-width: 240px;
  gap: 5px;
  font-size: 0.78rem;
}
.match-toolbar select {
  min-height: 34px;
  font-size: 0.9rem;
}
.match-list, .table-list { display: grid; gap: 8px; margin-top: 14px; }
.compact-list {
  gap: 8px;
}
.match-card, .row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.match-card.is-new {
  border-color: #b7e4dc;
  background: #f4fffb;
}
.compact-list .row-card {
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
}
.row-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}
.row-copy {
  min-width: 0;
}
.match-topline { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.82rem; }
.source-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  font-weight: 850;
  font-size: 0.78rem;
}
.source-badge { background: #e7f7f3; color: var(--accent-strong); }
.new-badge,
.new-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 999px;
  background: #ecfdf8;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
}
.new-badge {
  padding: 0 8px;
}
.new-count-badge {
  margin-left: 8px;
  padding: 0 7px;
  vertical-align: middle;
}
.source-badge.source-guloggratis {
  background: #fff2b8;
  color: #7a4d00;
}
.source-badge.source-dba {
  background: #dbeafe;
  color: #1d4ed8;
}
.source-badge.source-hardwareonline {
  background: #ffe4e0;
  color: #b42318;
}
.status-badge { background: #eef4ff; color: var(--blue); }
.status-badge.disabled { background: #f2f4f7; color: var(--muted); }
.match-card h3, .row-card h3 { margin: 7px 0 4px; font-size: 0.98rem; }
.compact-list .row-card h3 {
  margin: 0;
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-card p, .row-card p { margin: 0; color: var(--muted); }
.compact-list .row-card p {
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-side, .row-actions { display: grid; justify-items: end; gap: 6px; min-width: 102px; }
.match-side {
  align-content: center;
}
.compact-list .row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.match-price { font-size: 1.04rem; }
.row-actions input {
  min-width: 170px;
  min-height: 34px;
}
.open-link, .small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  background: #e9eef5;
  color: var(--ink);
  text-decoration: none;
}
.compact-list .small-button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.compact-list .small-button:hover {
  background: #eef3f5;
  color: var(--ink);
}
.compact-list .danger-button {
  border-color: #ffd3ce;
  background: transparent;
  color: var(--signal);
}
.compact-list .danger-button:hover {
  background: #fff1f0;
}
.danger-button { background: #ffe8e6; color: var(--signal); }
.form-message { display: none; min-height: 20px; margin: 0; color: var(--muted); }
.form-message.error { color: var(--signal); }
.notification-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.notification-panel h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}
.notification-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.secondary-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.secondary-action:hover {
  background: #eef3f5;
}
.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}
.disabled-filters {
  margin: 0;
}
.disabled-filters summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  list-style: none;
}
.disabled-filters summary::-webkit-details-marker {
  display: none;
}
.disabled-filters summary::before {
  content: "›";
  margin-right: 8px;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}
.disabled-filters[open] summary::before {
  transform: rotate(90deg);
}
.disabled-filters summary span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 999px;
  background: #eef3f5;
  color: var(--ink);
  font-size: 0.78rem;
}

@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace, .user-form { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    display: block;
    min-height: 100vh;
  }
  .mobile-shell-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(16, 32, 31, 0.1);
    background: rgba(245, 247, 249, 0.94);
    backdrop-filter: blur(12px);
  }
  .mobile-shell-bar .brand-text {
    max-width: 180px;
    opacity: 1;
  }
  .mobile-menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
  }
  .mobile-menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #10201f;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    border: 0;
    background: rgba(12, 21, 20, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 50;
    width: min(320px, 86vw);
    height: 100dvh;
    padding: 18px;
    transform: translateX(104%);
    box-shadow: -24px 0 60px rgba(16, 32, 31, 0);
  }
  .app-shell.mobile-sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: -24px 0 60px rgba(16, 32, 31, 0.26);
  }
  .app-shell.mobile-sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-top { align-items: center; }
  .sidebar .collapse-button { display: none; }
  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .nav-label {
    max-width: 160px;
    opacity: 1;
  }
  .sidebar-collapsed .sidebar-top {
    flex-direction: row;
    justify-content: space-between;
  }
  .sidebar-collapsed .brand {
    justify-content: flex-start;
  }
  .sidebar-collapsed .nav-item,
  .sidebar-collapsed .secondary-button {
    justify-content: flex-start;
  }
  .nav-list { grid-template-columns: 1fr; }
  .nav-item {
    justify-content: flex-start;
    padding: 0 12px;
    min-height: 46px;
    text-align: left;
  }
  .secondary-button {
    margin-top: 0;
    width: 100%;
  }
  .main { padding: 18px; }
  .topbar, .section-heading { flex-direction: column; align-items: stretch; }
  .notification-panel { flex-direction: column; align-items: stretch; }
  .match-toolbar label { max-width: none; }
  .scan-actions { align-items: stretch; }
  .metrics, .form-grid, .match-card, .row-card { grid-template-columns: 1fr; }
  .metrics { gap: 10px; }
  .metric { padding: 14px; }
  .row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .compact-list .row-card {
    align-items: stretch;
  }
  .compact-list .row-main {
    align-items: flex-start;
  }
  .compact-list .row-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }
  .compact-list .row-card h3,
  .compact-list .row-card p {
    white-space: normal;
  }
  .row-actions .small-button {
    width: 100%;
  }
  .segmented-control { width: 100%; }
  .match-side, .row-actions { justify-items: start; min-width: 0; }
}

@media (max-width: 440px) {
  .mobile-shell-bar .brand-text span { display: none; }
  .main { padding: 12px; }
  .panel { padding: 16px; }
  .topbar h1 { font-size: 2rem; }
  .row-actions { grid-template-columns: 1fr; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
