:root {
  --bg: #f2f1eb;
  --panel: rgba(255, 255, 255, 0.84);
  --ink: #182126;
  --muted: #65707a;
  --line: rgba(24, 33, 38, 0.1);
  --primary: #0e4bef;
  --primary-deep: #082b83;
  --accent: #eb6d34;
  --success: #0b8f62;
  --shadow: 0 20px 60px rgba(8, 22, 51, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(235, 109, 52, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(14, 75, 239, 0.16), transparent 30%),
    linear-gradient(180deg, #f6f3ed 0%, #ece8df 100%);
}
a { color: inherit; }

.login-shell,
.app-shell {
  margin-top: 24px;
  margin-bottom: 24px;
}

.login-shell {
  width: min(1600px, calc(100vw - 32px));
  margin-left: auto;
  margin-right: auto;
}

.app-shell {
  width: auto;
  max-width: none;
  margin-left: 24px;
  margin-right: 24px;
}

.login-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.login-poster,
.login-panel,
.filter-panel,
.results-panel,
.stat-card {
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--shadow);
}

.login-poster {
  border-radius: 32px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(14, 75, 239, 0.1), rgba(8, 43, 131, 0.02)),
    var(--panel);
}

.poster-kicker,
.hero-kicker,
.panel-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--primary-deep);
  font-weight: 700;
}

.login-poster h1,
.app-header h1 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.95;
  margin: 18px 0;
}

.login-poster h1 {
  max-width: 10ch;
}

.login-poster p,
.app-header p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.login-poster p {
  max-width: 56ch;
}

.app-header p {
  max-width: 72ch;
}

.poster-list {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.poster-list li,
.user-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(8, 43, 131, 0.08);
  font-size: 13px;
}

.login-panel {
  border-radius: 28px;
  padding: 36px;
  align-self: center;
}

.panel-head h2,
.results-head h2 {
  margin: 10px 0 0;
  font-size: 28px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.login-form,
.panel-grid,
.toggle-row,
.action-row {
  display: grid;
  gap: 16px;
}

.login-form {
  margin-top: 24px;
}

.login-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(180, 35, 24, 0.08);
  color: #8f1d16;
  font-size: 14px;
  font-weight: 600;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  font: inherit;
  color: var(--ink);
}

.region-combobox {
  position: relative;
}

.region-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(24, 33, 38, 0.1);
  box-shadow: 0 18px 36px rgba(8, 22, 51, 0.14);
}

.region-suggestions[hidden] {
  display: none !important;
}

.region-option {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.region-option:hover {
  background: rgba(14, 75, 239, 0.08);
}

input:focus,
select:focus {
  outline: 2px solid rgba(14, 75, 239, 0.24);
  border-color: rgba(14, 75, 239, 0.4);
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: white;
}

.ghost-btn {
  background: rgba(8, 43, 131, 0.08);
  color: var(--primary-deep);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn:hover,
.ghost-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled,
.ghost-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  border-radius: 22px;
  padding: 18px 20px;
}

.stat-card span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.filter-panel,
.results-panel {
  border-radius: 28px;
  padding: 24px;
}

.sidebar-column,
.results-column {
  min-width: 0;
}

.panel-sticky {
  position: sticky;
  top: 20px;
}

.filter-intro {
  margin-bottom: 20px;
}

.filter-intro h2 {
  margin: 8px 0 10px;
  font-size: 28px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.filter-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel-grid {
  grid-template-columns: 1fr;
}

.field-hint,
.field-error {
  grid-column: 1 / -1;
  margin-top: -8px;
  font-size: 13px;
  line-height: 1.4;
}

.field-hint {
  color: var(--muted);
}

.field-error {
  color: #b42318;
  min-height: 18px;
}

select:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.toggle-row {
  margin-top: 18px;
  grid-template-columns: 1fr;
}

.action-row {
  margin-top: 18px;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.run-state,
.summary-box,
.warning-box,
.estimate-box {
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  color: var(--muted);
}

.run-state {
  padding: 14px 16px;
}

.estimate-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(14, 75, 239, 0.06);
  border-color: rgba(14, 75, 239, 0.18);
  color: #17366f;
}

.warning-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(235, 109, 52, 0.09);
  border-color: rgba(235, 109, 52, 0.22);
  color: #7a4321;
}

.scroll-top-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(8, 43, 131, 0.24);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.download-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.tech-downloads {
  border-radius: 999px;
  background: rgba(8, 43, 131, 0.05);
  padding: 4px;
}

.tech-downloads summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tech-downloads summary::-webkit-details-marker {
  display: none;
}

.tech-download-links {
  display: flex;
  gap: 8px;
  padding: 4px;
  flex-wrap: wrap;
}

.summary-box {
  margin: 20px 0 16px;
  padding: 16px 18px;
}

.results-panel {
  min-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
}

.table-wrap {
  flex: 1;
  min-height: 420px;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.62);
}

.checkbox-col {
  width: 44px;
  text-align: center;
}

.checkbox-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.settings-card {
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 24px;
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.settings-card h2 {
  margin: 10px 0 18px;
  font-size: 28px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-state {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  color: var(--muted);
}

.users-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  background: rgba(255,255,255,0.78);
}

th, td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: rgba(246, 243, 237, 0.96);
  backdrop-filter: blur(10px);
  z-index: 1;
}

tbody tr:hover td { background: rgba(14, 75, 239, 0.04); }
.empty-cell { text-align: center; color: var(--muted); padding: 48px 16px; }

@media (max-width: 1080px) {
  .login-shell,
  .stats-strip,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel-sticky {
    position: static;
  }

  .app-header,
  .results-head {
    flex-direction: column;
  }

  .header-actions {
    align-items: flex-start;
  }

  .results-panel {
    min-height: auto;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .login-shell,
  .app-shell {
    width: min(100vw, calc(100vw - 16px));
    max-width: none;
    margin: 8px auto;
  }

  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-actions {
    justify-content: flex-start;
  }

  .scroll-top-btn {
    right: 12px;
    bottom: 12px;
  }
}
