:root {
  color-scheme: light;
  --page: #eef2f1;
  --surface: #ffffff;
  --surface-muted: #f6f8f8;
  --ink: #17211e;
  --muted: #66736f;
  --line: #d8e0dd;
  --primary: #126a52;
  --primary-hover: #0d5944;
  --cyan: #177d8f;
  --amber: #9a6400;
  --danger: #b8323a;
  --success-bg: #e5f5ee;
  --danger-bg: #fdebed;
  --warning-bg: #fff4d8;
  --focus: #0c7c65;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea,
fieldset {
  border-radius: 6px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #12201c;
}

.auth-panel {
  width: min(100%, 420px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid #2e423b;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: block;
  width: 200px;
  max-width: 64vw;
  height: auto;
}

.brand-product {
  margin: 0;
}

.brand-product {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.auth-panel h1 {
  margin: 28px 0 18px;
  font-size: 24px;
  line-height: 1.2;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  min-height: 42px;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

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

.auth-form label,
.control-group > label {
  color: #34413d;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bfcac6;
}

input {
  min-height: 42px;
  padding: 9px 11px;
}

textarea {
  min-height: 132px;
  padding: 11px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--focus);
}

.button,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 750;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button {
  min-height: 42px;
  padding: 9px 14px;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  color: #ffffff;
  background: var(--primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  color: #0c5e6d;
  background: #e5f4f7;
  border-color: #9bcbd3;
}

.button-danger {
  color: #ffffff;
  background: var(--danger);
}

.button-quiet {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
  font-size: 13px;
}

.auth-form .button {
  margin-top: 9px;
}

.form-message {
  margin: 4px 0 0;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
}

.form-message.is-error {
  color: #842028;
  background: var(--danger-bg);
}

.form-message.is-success {
  color: #0d5d46;
  background: var(--success-bg);
}

.workspace {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(16px, 3vw, 40px);
  color: #ffffff;
  background: #12201c;
  border-bottom: 3px solid var(--primary);
}

.brand-lockup-compact .brand-logo {
  width: 160px;
}

.brand-lockup-compact .brand-product {
  color: #b8c6c1;
}

.account-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: #43d39d;
  border-radius: 50%;
}

.account-name {
  max-width: min(42vw, 300px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  color: #ffffff;
  background: transparent;
  border-color: #50615b;
  font-size: 20px;
}

main {
  width: min(100%, 1600px);
  margin: 0 auto;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(320px, 1.5fr) minmax(260px, 0.9fr);
  gap: 22px;
  padding: 24px clamp(16px, 3vw, 40px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.control-group {
  min-width: 0;
}

.control-group > label {
  display: block;
  margin-bottom: 8px;
}

.file-row {
  display: grid;
  gap: 10px;
}

input[type="file"] {
  min-height: 44px;
  padding: 7px;
  background: var(--surface-muted);
}

.file-name {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.options-control {
  display: grid;
  align-content: start;
  gap: 10px;
}

.mode-switch {
  display: flex;
  min-width: 0;
  gap: 18px;
  margin: 4px 0 0;
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.mode-switch legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mode-switch label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
}

.mode-switch input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.progress-band {
  padding: 16px clamp(16px, 3vw, 40px);
  background: #e7eeeb;
  border-bottom: 1px solid var(--line);
}

.progress-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #42504b;
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #c8d3cf;
  border-radius: 4px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--primary);
  transition: width 180ms ease;
}

.data-section {
  padding: 22px clamp(16px, 3vw, 40px) 40px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.table-wrap {
  position: relative;
  min-height: 260px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5eae8;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #53605c;
  background: #f1f5f3;
  font-size: 12px;
  text-transform: uppercase;
}

th:nth-child(1) { width: 90px; }
th:nth-child(2) { width: 230px; }
th:nth-child(3) { width: 180px; }
th:nth-child(4) { width: 140px; }
th:nth-child(5) { width: 150px; }
th:nth-child(6) { width: 54px; }

td input {
  min-height: 34px;
  padding: 6px 8px;
  background: transparent;
  border-color: transparent;
}

td input:hover,
td input:focus {
  background: #ffffff;
  border-color: #afbeb8;
}

.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 750;
}

.status-neutral { color: #52605b; background: #edf1ef; }
.status-success { color: #0b6046; background: var(--success-bg); }
.status-warning { color: #765000; background: var(--warning-bg); }
.status-error { color: #8b252d; background: var(--danger-bg); }

.row-remove {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
}

.row-remove:hover {
  background: var(--danger-bg);
  border-color: #efb4b9;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: min(380px, calc(100vw - 40px));
  padding: 12px 14px;
  color: #ffffff;
  background: #17211e;
  border-left: 4px solid var(--cyan);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgb(0 0 0 / 24%);
  font-size: 13px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .control-band {
    grid-template-columns: 1fr 1fr;
  }

  .options-control {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .auth-shell {
    padding: 0;
    background: var(--surface);
  }

  .auth-panel {
    min-height: 100vh;
    padding: 26px 20px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    padding-inline: 14px;
  }

  .brand-lockup-compact .brand-product {
    display: none;
  }

  .brand-lockup-compact .brand-logo {
    width: 124px;
    max-width: 38vw;
  }

  .account-name {
    max-width: 48vw;
  }

  .control-band {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 14px;
  }

  .options-control {
    grid-column: auto;
  }

  .action-row {
    grid-template-columns: 1fr 1fr;
  }

  .action-row .button-secondary {
    grid-column: 1 / -1;
  }

  .progress-band,
  .data-section {
    padding-inline: 14px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
