:root {
  --ink: #0d2430;
  --muted: #637985;
  --muted-2: #8ea0a8;
  --line: #dce6e9;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f4f8f8;
  --navy: #071a24;
  --navy-2: #0d2a37;
  --teal: #08a88a;
  --teal-dark: #087b69;
  --mint: #dff7ee;
  --cyan: #7be4d1;
  --warning: #d99720;
  --danger: #c74646;
  --shadow: 0 18px 45px rgba(26, 55, 66, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #eef4f4;
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 2%, rgba(59, 211, 182, 0.12), transparent 25rem),
    linear-gradient(180deg, #f8fbfb 0, #eef4f4 34rem, #edf3f3 100%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
.mode-option:has(input:focus-visible) {
  outline: 3px solid rgba(8, 168, 138, 0.24);
  outline-offset: 2px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
}

.ambient-one {
  right: -14rem;
  top: 10rem;
  background: rgba(8, 168, 138, 0.07);
}

.ambient-two {
  left: -18rem;
  top: 55rem;
  background: rgba(75, 168, 206, 0.07);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(214, 227, 230, 0.82);
  background: rgba(248, 251, 251, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  flex: 0 0 46px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand strong {
  letter-spacing: 0.08em;
  font-size: 13px;
}

.brand small {
  margin-top: 4px;
  color: var(--teal-dark);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.topbar-actions,
.log-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-time {
  color: var(--muted-2);
  font-size: 12px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.85);
}

.icon-button:hover {
  color: var(--teal-dark);
  border-color: #b7d8d1;
}

.icon-button svg {
  width: 17px;
}

.status-pill,
.run-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.status-pill {
  padding: 8px 13px;
  color: #08715f;
  background: #dff7ee;
}

.status-dot,
.run-badge > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(8, 168, 138, 0.12);
}

.status-running .status-dot,
.run-badge.running > span {
  animation: pulse 1.7s infinite;
}

.status-paused,
.run-badge.paused {
  color: #876317;
  background: #fff2d7;
}

.status-paused .status-dot,
.run-badge.paused > span {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(217, 151, 32, 0.12);
}

.status-error,
.run-badge.error {
  color: #a33b3b;
  background: #fde6e6;
}

.status-error .status-dot,
.run-badge.error > span {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(199, 70, 70, 0.12);
}

.status-complete,
.run-badge.complete {
  color: #08715f;
  background: #dff7ee;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
    transform: scale(0.8);
  }
}

.shell {
  width: min(1480px, 92vw);
  margin: 0 auto;
  padding: 64px 0 70px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 35px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.hero h1 span {
  color: var(--teal-dark);
}

.hero-copy {
  max-width: 650px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.hero-date {
  display: flex;
  min-width: 180px;
  flex-direction: column;
  align-items: flex-end;
  padding-bottom: 6px;
}

.hero-date span {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hero-date strong {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 650;
}

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

.stat-card {
  display: flex;
  min-height: 126px;
  align-items: center;
  gap: 16px;
  padding: 23px;
  border: 1px solid rgba(214, 227, 230, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 20px rgba(26, 55, 66, 0.035);
}

.stat-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border-radius: 14px;
  color: var(--teal-dark);
  background: var(--mint);
}

.stat-icon svg {
  width: 23px;
}

.stat-card > div:last-child {
  min-width: 0;
}

.stat-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card strong {
  display: block;
  margin: 4px 0 2px;
  color: var(--navy);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.stat-card small {
  color: var(--muted-2);
  font-size: 11px;
}

.stat-card small span {
  display: inline;
  color: inherit;
  font-size: inherit;
}

.stat-card.alert .stat-icon {
  color: var(--danger);
  background: #fdeaea;
}

.stat-card.alert strong {
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 0.75fr);
  gap: 20px;
}

.main-column,
.side-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(214, 227, 230, 0.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 27px 0;
}

.panel-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.run-badge {
  padding: 7px 11px;
  color: #08715f;
  background: var(--mint);
}

.progress-layout {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  align-items: center;
  gap: 30px;
  padding: 25px 30px 32px;
}

.progress-ring {
  position: relative;
  display: grid;
  width: 166px;
  height: 166px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--progress) * 1%), #e6eeee 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.progress-ring::before {
  position: absolute;
  width: 133px;
  height: 133px;
  content: "";
  border-radius: 50%;
  background: white;
  box-shadow: inset 0 0 0 1px #edf2f3;
}

.progress-ring > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.progress-ring strong {
  display: block;
  color: var(--navy);
  font-size: 31px;
  letter-spacing: -0.04em;
}

.progress-ring span {
  color: var(--muted-2);
  font-size: 11px;
}

.progress-numbers {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 12px;
}

.progress-numbers strong {
  color: var(--ink);
}

.progress-numbers > span {
  color: var(--muted);
}

.linear-progress,
.health-bar {
  overflow: hidden;
  width: 100%;
  height: 8px;
  margin: 11px 0 15px;
  border-radius: 99px;
  background: #e8eff0;
}

.linear-progress > span,
.health-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal-dark), var(--cyan));
  transition: width 0.5s ease;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 17px;
  color: var(--muted);
  font-size: 11px;
}

.progress-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.progress-meta svg {
  width: 14px;
  color: var(--teal-dark);
}

.progress-meta strong {
  color: var(--ink);
  font-weight: 650;
}

.current-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 19px;
  padding: 13px 15px;
  border: 1px solid #deebea;
  border-radius: 13px;
  background: #f5faf9;
}

.current-pulse {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(8, 168, 138, 0.1);
  animation: pulse 1.6s infinite;
}

.current-item small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.current-item strong {
  display: block;
  overflow: hidden;
  max-width: 530px;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-panel .panel-heading,
.outputs-panel .panel-heading {
  align-items: center;
  padding-bottom: 20px;
}

.search-log {
  display: flex;
  width: 165px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.search-log svg {
  width: 14px;
  color: var(--muted-2);
}

.search-log input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
}

.small-button,
.secondary-button,
.text-button,
.primary-button,
.danger-button {
  cursor: pointer;
  border: 0;
  font-weight: 650;
}

.small-button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: white;
  font-size: 11px;
}

.terminal {
  overflow: auto;
  height: 286px;
  padding: 19px 22px;
  color: #b8d8d0;
  background: #071a24;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.75;
  scrollbar-color: #31505a #071a24;
}

.terminal-line {
  display: grid;
  grid-template-columns: 70px 52px minmax(0, 1fr);
  gap: 8px;
}

.terminal-line .time {
  color: #5f8c89;
}

.terminal-line .level {
  color: #77dbc5;
  font-weight: 700;
}

.terminal-line.error .level,
.terminal-line.error .message {
  color: #f39b9b;
}

.terminal-line.warning .level {
  color: #e5bf71;
}

.terminal-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: #597782;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #bdd9d4;
  border-radius: 10px;
  color: var(--teal-dark);
  background: #eff9f7;
  font-size: 11px;
}

.secondary-button:hover {
  background: #e4f5f1;
}

.secondary-button svg {
  width: 15px;
}

.output-list {
  border-top: 1px solid #e7edef;
}

.output-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 17px 27px;
  border-bottom: 1px solid #edf1f2;
}

.output-row:last-child {
  border-bottom: 0;
}

.file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--teal-dark);
  background: var(--mint);
}

.file-icon svg {
  width: 20px;
}

.file-icon.csv {
  color: #2e6f63;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.output-row strong,
.output-row span {
  display: block;
}

.output-row strong {
  margin-bottom: 3px;
  font-size: 12px;
}

.output-row > div span {
  color: var(--muted-2);
  font-size: 10px;
}

.text-button {
  padding: 7px 0;
  color: var(--teal-dark);
  background: transparent;
  font-size: 10px;
}

.control-panel {
  padding-bottom: 24px;
}

.control-copy {
  margin: 13px 27px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0 20px;
}

.mode-option {
  position: relative;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 75px;
  padding: 12px 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.mode-option:hover {
  border-color: #b9d8d2;
}

.mode-option.selected {
  border-color: #70cbb9;
  background: #f3fbf9;
  box-shadow: 0 0 0 3px rgba(8, 168, 138, 0.08);
}

.mode-option input {
  position: absolute;
  opacity: 0;
}

.mode-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: var(--teal-dark);
  background: var(--mint);
}

.mode-icon svg {
  width: 18px;
}

.mode-option strong,
.mode-option small {
  display: block;
}

.mode-option strong {
  margin-bottom: 3px;
  font-size: 12px;
}

.mode-option small {
  max-width: 235px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.recommended {
  position: absolute;
  right: 10px;
  top: 8px;
  padding: 3px 5px;
  border-radius: 4px;
  color: #08715f;
  background: #d7f5ed;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.advanced-options {
  margin: 17px 20px;
  border-top: 1px solid #e7edef;
  border-bottom: 1px solid #e7edef;
}

.advanced-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 3px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.advanced-options summary::-webkit-details-marker {
  display: none;
}

.advanced-options summary svg {
  width: 15px;
  transition: transform 0.2s;
}

.advanced-options[open] summary svg {
  transform: rotate(180deg);
}

.advanced-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 3px 3px 16px;
}

.range-field > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.range-field strong {
  color: var(--ink);
}

.range-field input {
  width: 100%;
  accent-color: var(--teal);
}

.toggle-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-field strong,
.toggle-field small {
  display: block;
}

.toggle-field strong {
  font-size: 10px;
}

.toggle-field small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
}

.toggle-field i {
  position: relative;
  width: 36px;
  height: 21px;
  border-radius: 99px;
  background: #cedbdd;
  transition: background 0.2s;
}

.toggle-field i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  content: "";
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(17, 45, 54, 0.2);
  transition: transform 0.2s;
}

.toggle-field input:checked + i {
  background: var(--teal);
}

.toggle-field input:checked + i::after {
  transform: translateX(15px);
}

.primary-button,
.danger-button {
  display: flex;
  width: calc(100% - 40px);
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 20px;
  border-radius: 12px;
  color: white;
  background: var(--navy);
  box-shadow: 0 10px 24px rgba(7, 26, 36, 0.15);
  font-size: 12px;
}

.primary-button:hover {
  background: #0d2d3a;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.primary-button svg,
.danger-button svg {
  width: 17px;
}

.danger-button {
  margin-top: 10px;
  color: #a63a3a;
  border: 1px solid #f0caca;
  background: #fff0f0;
  box-shadow: none;
}

.danger-button:hover {
  background: #ffe5e5;
}

.hidden {
  display: none !important;
}

.control-note {
  margin: 12px 27px 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.health-panel {
  padding-bottom: 22px;
}

.health-row {
  display: flex;
  justify-content: space-between;
  margin: 20px 27px 0;
  color: var(--muted);
  font-size: 11px;
}

.health-row strong {
  color: var(--ink);
}

.health-bar {
  height: 6px;
  margin: 8px 27px 0;
}

.health-bar.secondary > span {
  background: linear-gradient(90deg, #3c8aa8, #88cedf);
}

.aim-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 27px 0;
  padding-top: 17px;
  border-top: 1px solid #e8eeee;
}

.aim-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 9px;
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 9px;
}

.aim-chip strong {
  color: var(--ink);
}

.support-card {
  display: flex;
  gap: 13px;
  padding: 19px 21px;
  border: 1px solid rgba(192, 219, 214, 0.85);
  border-radius: 17px;
  background: rgba(232, 248, 244, 0.82);
}

.support-card > svg {
  width: 22px;
  flex: 0 0 22px;
  color: var(--teal-dark);
}

.support-card strong {
  font-size: 11px;
}

.support-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.toast-stack {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  display: flex;
  width: min(360px, calc(100vw - 44px));
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid #cfe4df;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  box-shadow: 0 15px 40px rgba(22, 54, 65, 0.16);
  font-size: 11px;
  animation: toast-in 0.22s ease;
}

.toast::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  content: "";
  border-radius: 50%;
  background: var(--teal);
}

.toast.error::before {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.confirm-dialog {
  width: min(430px, calc(100vw - 36px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: 0 30px 90px rgba(7, 26, 36, 0.28);
}

.confirm-dialog::backdrop {
  background: rgba(4, 19, 27, 0.58);
  backdrop-filter: blur(4px);
}

.confirm-dialog form {
  padding: 30px;
  text-align: center;
}

.dialog-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 15px;
  color: var(--warning);
  background: #fff1d4;
}

.dialog-icon svg {
  width: 23px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-actions button {
  width: auto;
  margin: 0;
}

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .side-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .support-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 65px;
    padding: 0 18px;
  }

  .sync-time,
  .topbar .icon-button {
    display: none;
  }

  .shell {
    width: min(100% - 28px, 660px);
    padding-top: 38px;
  }

  .hero {
    display: block;
  }

  .hero-date {
    display: none;
  }

  .hero h1 {
    font-size: 38px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    min-height: 116px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 17px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .stat-icon svg {
    width: 18px;
  }

  .stat-card strong {
    font-size: 23px;
  }

  .progress-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .progress-details {
    width: 100%;
  }

  .current-item strong {
    max-width: 68vw;
  }

  .panel-heading {
    padding-right: 20px;
    padding-left: 20px;
  }

  .log-panel .panel-heading,
  .outputs-panel .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .log-actions {
    width: 100%;
  }

  .search-log {
    flex: 1;
  }

  .output-row {
    padding-right: 20px;
    padding-left: 20px;
  }

  .side-column {
    display: flex;
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .status-pill {
    padding: 7px 10px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-copy {
    font-size: 13px;
  }

  .stat-card {
    min-height: 108px;
  }

  .stat-card span {
    font-size: 10px;
  }

  .stat-card small {
    display: none;
  }

  .progress-layout {
    padding-right: 20px;
    padding-left: 20px;
  }

  .progress-meta {
    gap: 11px;
  }

  .output-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .output-row .text-button {
    display: none;
  }
}

/* Commercial sources and profitability simulator */

.section-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  margin-left: 34px;
}

.section-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: 160ms ease;
}

.section-nav a:hover {
  color: var(--navy);
  background: #edf4f5;
}

.simulator-section,
.sources-section {
  margin-bottom: 24px;
  scroll-margin-top: 92px;
}

.source-panel {
  overflow: hidden;
}

.simulator-panel {
  position: relative;
  z-index: 5;
  overflow: visible;
}

.role-user .admin-only {
  display: none !important;
}

.page-simulator .admin-page-content,
.page-admin .simulator-section {
  display: none !important;
}

.page-simulator .shell {
  padding-top: 32px;
}

.page-simulator .nav-simulator {
  color: var(--teal-dark);
  background: #e4f4f1;
}

.page-admin .section-nav a[href^="/admin"] {
  color: var(--teal-dark);
}

.user-chip {
  display: grid;
  min-width: 115px;
  gap: 1px;
  padding: 7px 11px;
  border: 1px solid #d7e6e8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  line-height: 1.1;
}

.user-chip span {
  overflow: hidden;
  max-width: 145px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.users-section {
  margin-bottom: 24px;
  scroll-margin-top: 92px;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(480px, 1.7fr);
  gap: 24px;
  padding: 22px 28px 28px;
  border-top: 1px solid var(--line);
}

.user-form {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid #dce8ea;
  border-radius: 14px;
  background: #f7fafb;
}

.user-form > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.active-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
}

.active-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--teal);
}

.users-table-wrap {
  overflow: auto;
  border: 1px solid #dce8ea;
  border-radius: 14px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.users-table th,
.users-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e7edef;
  text-align: left;
  white-space: nowrap;
}

.users-table th {
  color: var(--muted);
  background: #f2f7f8;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.users-table tr:last-child td {
  border-bottom: 0;
}

.role-badge,
.account-badge {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
}

.role-badge.admin {
  color: #5a43b5;
  background: #eeeaff;
}

.role-badge.user,
.account-badge.active {
  color: #08756d;
  background: #ddf5ef;
}

.account-badge.inactive {
  color: #8c4e55;
  background: #f9e5e7;
}

.auth-page {
  min-height: 100vh;
  overflow-x: hidden;
  background: #edf4f5;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1040px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: 70px;
  padding: 50px 0;
}

.auth-brand {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 34px;
}

.auth-group-logo {
  display: block;
  width: 150px;
  max-height: 230px;
  object-fit: contain;
}

.auth-brand h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.auth-brand h1 span {
  color: var(--teal);
}

.auth-card {
  min-height: 430px;
  padding: 34px;
  border: 1px solid rgba(214, 227, 230, 0.96);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(7, 38, 48, 0.14);
}

.auth-loading {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form h2 {
  margin: 6px 0 6px;
  color: var(--navy);
  font-size: 27px;
  letter-spacing: -0.03em;
}

.auth-form > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #efc5ca;
  border-radius: 9px;
  color: #8b303c;
  background: #fff0f2;
  font-size: 11px;
  line-height: 1.4;
}

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

.simulator-heading {
  align-items: center;
}

.source-label {
  padding: 7px 11px;
  border: 1px solid rgba(14, 165, 164, 0.25);
  border-radius: 999px;
  background: rgba(14, 165, 164, 0.08);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.simulator-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.45fr) repeat(6, minmax(110px, 0.7fr));
  gap: 14px;
  align-items: start;
  padding: 22px 28px 25px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(105deg, rgba(8, 52, 67, 0.035), rgba(14, 165, 164, 0.055));
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > span,
.field > label,
.check-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.medicine-search {
  position: relative;
}

.medicine-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: min(420px, calc(100vh - 150px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  padding: 6px;
  border: 1px solid #d7e1e5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(7, 26, 36, 0.18);
}

.medicine-suggestion {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
}

.medicine-suggestion:hover,
.medicine-suggestion.is-active,
.medicine-suggestion:focus-visible {
  outline: none;
  background: #edf7f6;
}

.medicine-suggestion strong {
  font-size: 12px;
}

.medicine-suggestion span {
  color: var(--muted);
  font-size: 10px;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid #d7e1e5;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.12);
}

.field small {
  color: #81919a;
  font-size: 10px;
  line-height: 1.35;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 36px;
}

.input-suffix b {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.check-field {
  display: flex;
  grid-column: 2 / span 2;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.check-field input {
  accent-color: var(--teal);
}

.simulation-button {
  grid-column: auto;
  align-self: start;
  min-height: 44px;
  margin: 25px 0 0;
}

.simulation-empty {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 155px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.simulation-empty strong {
  color: var(--navy);
  font-size: 17px;
}

.simulation-empty span {
  font-size: 12px;
}

.simulation-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.simulation-summary > div {
  display: grid;
  gap: 5px;
  padding: 18px 24px;
  background: #fff;
}

.simulation-summary span,
.source-metrics span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.simulation-summary strong {
  color: var(--navy);
  font-size: 22px;
}

.recommendations {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 22px 28px;
  background: #f7fafb;
}

.recommendation-group {
  display: grid;
  gap: 10px;
}

.recommendation-group h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--navy);
  font-size: 13px;
}

.recommendation-group h3::after {
  height: 1px;
  content: "";
  flex: 1;
  background: #dce7ea;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.recommendation-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid #dce7ea;
  border-radius: 13px;
  background: #fff;
}

.recommendation-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  content: "";
  background: var(--teal);
}

.recommendation-card.client::before {
  background: #e4a11b;
}

.recommendation-card.balance::before {
  background: #7356c7;
}

.recommendation-card > span {
  color: var(--teal-dark);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recommendation-card > strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-card p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommendation-values {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 6px;
}

.recommendation-values span {
  color: var(--muted);
  font-size: 10px;
}

.recommendation-values b {
  margin-left: 3px;
  color: var(--navy);
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
}

.table-toolbar > div {
  display: grid;
  gap: 3px;
}

.table-toolbar strong {
  color: var(--navy);
  font-size: 13px;
}

.table-toolbar span {
  color: var(--muted);
  font-size: 10px;
}

.table-search {
  width: min(360px, 45vw);
}

.simulation-table-wrap {
  overflow: auto;
  max-height: 610px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.simulation-table {
  width: 100%;
  min-width: 2050px;
  border-collapse: collapse;
  font-size: 11px;
}

.simulation-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #d4e0e4;
  background: #eef4f6;
  color: #5b6f78;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.simulation-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf1f3;
  color: #334850;
  vertical-align: middle;
  white-space: nowrap;
}

.simulation-table tbody tr:hover {
  background: #f7fbfb;
}

.simulation-table tr.best-profit td {
  border-top: 2px solid #32a98f;
  border-bottom: 2px solid #32a98f;
  background: #e9f8f4;
}

.simulation-table tr.best-client td {
  border-top: 2px solid #e1a526;
  border-bottom: 2px solid #e1a526;
  background: #fff7df;
}

.simulation-table tr.best-balance td {
  border-top: 2px solid #7356c7;
  border-bottom: 2px solid #7356c7;
  background: #f1edff;
}

.simulation-table tr.best-profit td:first-child {
  box-shadow: inset 6px 0 #32a98f;
}

.simulation-table tr.best-client td:first-child {
  box-shadow: inset 6px 0 #e1a526;
}

.simulation-table tr.best-balance td:first-child {
  box-shadow: inset 6px 0 #7356c7;
}

.choice-badges {
  display: flex !important;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.choice-badge {
  display: inline-flex !important;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.choice-badge.profit {
  background: #16856f;
}

.choice-badge.client {
  background: #b97900;
}

.choice-badge.balance {
  background: #6544bd;
}

.choice-badge.price {
  background: #0b6973;
}

.choice-badge.alternative {
  background: #1f5b9d;
}

.choice-badge.other {
  background: #60747d;
}

.simulation-table tr.best-product-price td:first-child {
  box-shadow: inset 6px 0 #0b6973;
}

.simulation-table tr.best-non-pharmacy td:first-child {
  box-shadow: inset 6px 0 #1f5b9d;
}

.simulation-table tr.cost-alternative-row td {
  background: #f7fafb;
  border-bottom-color: #e2eaed;
}

.simulation-table tr.cost-alternative-row td:first-child {
  padding-left: 28px;
  box-shadow: inset 6px 0 #9babb2;
}

.cost-alternatives-toggle {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 9px;
  border: 1px solid #9ec1c5;
  border-radius: 999px;
  background: #edf7f7;
  color: #0b6973;
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  font-weight: 900;
}

.cost-alternatives-toggle:hover {
  border-color: #0b6973;
  background: #dff1f1;
}

.simulation-table td:first-child {
  min-width: 245px;
  white-space: normal;
}

.simulation-table td:first-child strong,
.simulation-table td:first-child span {
  display: block;
}

.simulation-table td:first-child strong {
  color: var(--navy);
  font-size: 11px;
}

.simulation-table td:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.simulation-table td:first-child .choice-badge {
  display: inline-flex !important;
  margin-top: 0;
  color: #fff !important;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.035em;
  line-height: 1.25;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.simulation-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.simulation-table .mono {
  color: var(--navy);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.simulation-table .source-cell {
  color: var(--teal-dark);
  font-weight: 800;
}

.simulation-table .profit-cell {
  color: #0b7a55;
  font-weight: 900;
}

.simulation-table .negative {
  color: var(--danger);
}

.simulation-table .client-price {
  color: #9a6510;
  font-weight: 800;
}

.status-ok,
.status-muted {
  font-size: 9px;
  font-weight: 800;
}

.status-ok {
  color: #0b7a55 !important;
}

.status-muted {
  color: #8c9ba2 !important;
}

.empty-table {
  padding: 40px !important;
  color: var(--muted) !important;
  text-align: center !important;
}

.calculation-note {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  padding: 14px 28px 18px;
  background: #fafcfc;
}

.calculation-note span {
  color: #6c7e86;
  font-size: 9px;
}

.calculation-note span::before {
  margin-right: 6px;
  color: var(--teal);
  content: "•";
}

.source-content {
  padding: 22px 28px 26px;
  border-top: 1px solid var(--line);
}

.source-overview {
  display: flex;
  align-items: center;
  gap: 14px;
}

.source-overview > div:last-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.source-overview strong {
  color: var(--navy);
  font-size: 15px;
}

.source-overview span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--teal), #087675);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.source-mark.infoprex {
  background: linear-gradient(145deg, #7356c7, #4b3694);
}

.source-mark.official {
  background: linear-gradient(145deg, #087f72, #064c48);
}

.source-mark.empifarma {
  background: linear-gradient(145deg, #e09a25, #a66208);
}

.source-mark.direct {
  background: linear-gradient(145deg, #2878b8, #174c7a);
}

.source-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.source-metrics > div {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid #e0e8eb;
  border-radius: 10px;
  background: #fafcfc;
}

.source-metrics strong {
  color: var(--navy);
  font-size: 18px;
}

.source-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-actions .primary-button,
.source-actions .secondary-button {
  width: auto;
  min-height: 42px;
  margin: 0;
}

.source-audit {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr;
  gap: 20px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.source-audit strong {
  color: #4f656e;
}

@media (max-width: 1120px) {
  .section-nav {
    display: none;
  }

  .sources-section {
    grid-template-columns: 1fr;
  }

  .simulator-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .field-search {
    grid-column: span 2;
  }

  .check-field {
    grid-column: 1 / span 1;
  }

  .simulation-button {
    grid-column: 2 / span 2;
  }
}

@media (max-width: 760px) {
  .simulator-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .simulator-form {
    grid-template-columns: 1fr 1fr;
    padding-right: 20px;
    padding-left: 20px;
  }

  .field-search,
  .check-field,
  .simulation-button {
    grid-column: 1 / -1;
  }

  .simulation-button {
    margin-top: 0;
  }

  .simulation-summary,
  .source-metrics {
    grid-template-columns: 1fr 1fr;
  }

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

  .recommendations {
    padding-right: 20px;
    padding-left: 20px;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding-right: 20px;
    padding-left: 20px;
  }

  .table-search {
    width: 100%;
  }

  .source-content {
    padding-right: 20px;
    padding-left: 20px;
  }

  .source-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .source-actions .primary-button,
  .source-actions .secondary-button,
  .source-actions .text-button {
    width: 100%;
  }

  .source-audit {
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .status-pill span:last-child {
    display: none;
  }

  .status-pill {
    min-width: 34px;
    justify-content: center;
  }

  .hero h1 {
    overflow-wrap: anywhere;
  }

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

  .simulator-form {
    grid-template-columns: 1fr;
  }

  .field,
  .field-search,
  .check-field,
  .simulation-button {
    grid-column: 1;
  }

  .simulation-summary,
  .source-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .simulation-summary > div {
    padding: 14px 16px;
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 35px 0;
  }

  .auth-brand {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 22px;
  }

  .auth-group-logo {
    width: 110px;
    max-height: 170px;
  }

  .auth-brand h1 {
    font-size: 36px;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    width: min(100% - 24px, 520px);
  }

  .auth-card {
    min-height: 0;
    padding: 24px 20px;
    border-radius: 17px;
  }

  .auth-brand {
    grid-template-columns: 1fr;
  }

  .auth-group-logo {
    width: 94px;
    max-height: 145px;
  }

  .auth-brand h1 {
    font-size: 31px;
  }

  .user-chip {
    min-width: 0;
  }

  .user-chip span {
    max-width: 90px;
  }

  .users-layout {
    padding: 18px;
  }
}
