:root {
  --ink: #111827;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.14);
  --paper: rgba(250, 251, 252, 0.94);
  --teal: #166b76;
  --orange: #e76f4a;
  --shadow: 0 26px 70px rgba(0, 7, 15, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, sans-serif;
  background-color: #080d13;
  background-image:
    radial-gradient(circle at 13% 8%, rgba(38, 213, 229, 0.16), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(181, 76, 228, 0.14), transparent 31%),
    radial-gradient(circle at 52% 105%, rgba(27, 108, 128, 0.13), transparent 36%),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.034) 0 2px, transparent 2px 10px),
    repeating-linear-gradient(30deg, rgba(0, 0, 0, 0.42) 0 2px, transparent 2px 10px),
    linear-gradient(135deg, #070b10 0%, #121b24 48%, #080d13 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.58;
  background-image:
    linear-gradient(115deg, transparent 44%, rgba(119, 232, 244, 0.035) 46%, transparent 49%),
    linear-gradient(25deg, transparent 44%, rgba(196, 118, 235, 0.025) 46%, transparent 49%);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black 5%, rgba(0,0,0,.58) 72%, transparent);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
  position: relative;
}

.auth-wrap {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 28px;
  align-items: center;
}

.brand-panel,
.auth-card,
.card,
.topbar {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-panel {
  min-height: 340px;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #f8fbff;
  border-color: rgba(109, 227, 241, 0.22);
  background:
    radial-gradient(circle at 18% 18%, rgba(43, 223, 238, 0.16), transparent 35%),
    radial-gradient(circle at 86% 15%, rgba(190, 79, 237, 0.17), transparent 34%),
    linear-gradient(145deg, rgba(7, 15, 24, 0.96), rgba(19, 32, 45, 0.94));
}

.brand-panel .eyebrow {
  color: #8ee9f1;
}

.brand-panel > p:last-child {
  max-width: 650px;
  color: #c7d3df;
}

.brand-art {
  display: block;
  object-fit: contain;
  border: 1px solid rgba(121, 227, 240, 0.22);
  background: #07111a;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.34),
    0 0 30px rgba(75, 219, 235, 0.11);
}

.brand-art-login {
  width: min(410px, 100%);
  aspect-ratio: 1.39 / 1;
  margin-bottom: 26px;
  border-radius: 22px;
}

.brand-art-header {
  width: 154px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 18px;
}

.topbar-identity {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.95;
  margin-bottom: 16px;
}

h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.eyebrow {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.auth-card {
  padding: 34px;
  border-color: rgba(124, 223, 234, 0.22);
}

label {
  display: grid;
  gap: 8px;
  color: #64748b;
  margin: 18px 0;
}

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

input:focus {
  outline: 3px solid rgba(22, 107, 118, 0.18);
  border-color: rgba(22, 107, 118, 0.55);
}

input[readonly] {
  color: #475569;
  background: rgba(241, 245, 249, 0.82);
}

button,
.user-pill a,
.button-link {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: var(--orange);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(231, 111, 74, 0.25);
}

button.secondary {
  background: var(--teal);
  box-shadow: 0 14px 32px rgba(22, 107, 118, 0.22);
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quiet-link,
.muted-button {
  background: rgba(15, 23, 42, 0.08) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 28px;
  margin-bottom: 20px;
  border-color: rgba(128, 223, 235, 0.2);
}

.topbar h1 {
  font-size: clamp(28px, 3vw, 44px);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.user-pill span,
.rate-badge,
.section-title span {
  border-radius: 999px;
  background: rgba(22, 107, 118, 0.10);
  color: #0f5962;
  padding: 10px 14px;
  font-weight: 800;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-bottom: 20px;
}

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

.settings-inline-grid label {
  margin: 0 0 18px;
}

.report-tabs {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(238, 245, 248, 0.9);
  box-shadow: 0 16px 40px rgba(0, 7, 15, 0.24);
  backdrop-filter: blur(16px);
}

.report-tabs a,
.report-tabs span {
  border-radius: 999px;
  padding: 12px 18px;
  color: #475569;
  font-weight: 800;
  text-decoration: none;
  background: rgba(15, 23, 42, 0.06);
}

.report-tabs .active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal), #1f7b83);
  box-shadow: 0 12px 28px rgba(22, 107, 118, 0.22);
}

.card {
  padding: 28px;
}

.upload-card {
  display: grid;
  align-content: start;
}

.history-card {
  margin-bottom: 20px;
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
}

th {
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.table-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.table-action.secondary-action {
  background: var(--teal);
  box-shadow: 0 10px 24px rgba(22, 107, 118, 0.18);
}

.button-link.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--teal);
  box-shadow: 0 12px 28px rgba(22, 107, 118, 0.2);
}

.readonly-grid {
  margin: 18px 0;
}

.download-location-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.download-location-form.embedded {
  margin-top: 6px;
}

.download-location-heading h3 {
  margin: -4px 0 0;
  color: var(--ink);
  font-size: 18px;
}

.download-location-form label {
  margin: 0;
  font-weight: 700;
}

.download-location-form input[readonly] {
  cursor: default;
  background: #f8fafc;
}

.download-location-form.folder-picker-unavailable input[readonly] {
  color: #475569;
  background: #f1f5f9;
}

.download-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.download-location-actions button {
  justify-self: start;
}

.download-location-note {
  margin: 0;
  font-size: 13px;
}

.download-location-note strong {
  color: var(--teal);
}

.saved-path {
  flex: 1 0 100%;
  max-width: min(620px, 100%);
  padding: 8px 10px;
  border: 1px solid rgba(22, 107, 118, 0.12);
  border-radius: 12px;
  background: rgba(22, 107, 118, 0.07);
  color: #0f5962;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.table-action.danger-action {
  background: #aa2e2e;
  box-shadow: 0 10px 24px rgba(170, 46, 46, 0.18);
}

.table-action.disabled {
  cursor: not-allowed;
  opacity: 0.56;
  background: rgba(15, 23, 42, 0.08);
  color: #64748b;
  box-shadow: none;
}

.alert {
  border-radius: 18px;
  padding: 14px 16px;
  margin: 14px 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
}

.alert.error {
  color: #991b1b;
  background: #fff1f0;
}

.alert.success {
  color: #166534;
  background: #ecfdf5;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 24px;
  color: var(--muted);
}

.site-footer {
  text-align: center;
  color: #a9bbc9;
  font-size: 13px;
  margin-top: 28px;
}

.auth-wrap.single {
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
}

.password-card {
  width: 100%;
}

.progress-open,
.progress-open body,
.modal-open,
.modal-open body {
  overflow: hidden;
}

.report-progress[hidden] {
  display: none;
}

.report-progress {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 20, 30, 0.66);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.report-progress-card {
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(50, 160, 171, 0.2), transparent 42%),
    linear-gradient(145deg, #fffdf8, #f4fafb);
  box-shadow: 0 30px 90px rgba(3, 12, 22, 0.38);
}

.report-progress-card h2 {
  margin: 7px 0 8px;
}

.report-progress-track {
  height: 12px;
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid rgba(22, 107, 118, 0.14);
  border-radius: 999px;
  background: #e6eef0;
}

.report-progress-track span {
  display: block;
  width: 5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e86f48, #f3a563 44%, #1f7b86 100%);
  box-shadow: 0 0 18px rgba(31, 123, 134, 0.28);
  transition: width 280ms ease;
}

.report-progress-track span.error {
  background: #b83232;
}

.report-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
}

.report-progress-meta strong {
  color: var(--teal);
  font-size: 18px;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 20, 30, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.confirm-modal-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 111, 72, 0.17), transparent 42%),
    linear-gradient(145deg, #fffdf8, #f5fafb);
  box-shadow: 0 30px 90px rgba(3, 12, 22, 0.42);
}

.confirm-modal-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(145deg, #ef7a51, #b83232);
  box-shadow: 0 14px 32px rgba(184, 50, 50, 0.24);
  font-size: 28px;
  font-weight: 800;
}

.confirm-modal-copy h2 {
  margin: 5px 0 8px;
}

.danger-eyebrow {
  color: #a52e2e;
}

.confirm-report-name {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.confirm-modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.confirm-modal-actions button {
  min-width: 132px;
}

.app-toast-region {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10070;
  display: grid;
  gap: 12px;
  width: min(430px, calc(100vw - 32px));
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(148, 197, 209, 0.28);
  border-radius: 20px;
  color: #f8fbff;
  background:
    radial-gradient(circle at 100% 0%, rgba(49, 151, 164, 0.24), transparent 44%),
    linear-gradient(145deg, rgba(12, 20, 30, 0.98), rgba(24, 35, 47, 0.98));
  box-shadow: 0 22px 64px rgba(0, 7, 15, 0.42);
  animation: appToastIn 180ms ease-out both;
}

.app-toast.leaving {
  animation: appToastOut 170ms ease-in both;
}

.app-toast-icon,
.app-dialog-icon {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), #24909a);
  font-weight: 900;
}

.app-toast-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(22, 107, 118, 0.34);
}

.app-toast.error .app-toast-icon,
.app-dialog.error .app-dialog-icon {
  background: linear-gradient(145deg, #ef7a51, #b83232);
  box-shadow: 0 12px 28px rgba(184, 50, 50, 0.28);
}

.app-toast-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app-toast-copy strong {
  font-size: 14px;
}

.app-toast-copy span {
  color: #b7c7d5;
  font-size: 13px;
  line-height: 1.35;
}

.app-toast-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  color: #c8d6e3;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.app-dialog[hidden] {
  display: none;
}

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 10, 16, 0.68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.app-dialog-card {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 18px;
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid rgba(148, 197, 209, 0.32);
  border-radius: 28px;
  color: #f8fbff;
  background:
    radial-gradient(circle at 100% 0%, rgba(49, 151, 164, 0.26), transparent 44%),
    linear-gradient(145deg, rgba(11, 17, 24, 0.98), rgba(25, 37, 49, 0.98));
  box-shadow: 0 32px 92px rgba(0, 7, 15, 0.5);
}

.app-dialog-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 18px;
}

.app-dialog-copy h2 {
  margin: 4px 0 8px;
  color: #fff;
}

.app-dialog-copy .eyebrow {
  color: #9ee9ef;
}

.app-dialog-copy .muted {
  margin: 0;
  color: #b7c7d5;
}

.app-dialog-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.app-dialog-actions button {
  min-width: 150px;
}

.app-dialog-actions .muted-button {
  color: #f8fbff !important;
  background: rgba(255, 255, 255, 0.09) !important;
}

@keyframes appToastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes appToastOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@media (max-width: 850px) {
  .auth-wrap,
  .grid {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 240px;
    padding: 34px;
  }

  .brand-art-login {
    width: min(320px, 100%);
  }

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

  .topbar-identity {
    width: 100%;
    align-items: flex-start;
  }

  .brand-art-header {
    width: 112px;
    height: 78px;
  }

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

  .report-progress-card {
    padding: 24px;
    border-radius: 22px;
  }

  .report-progress-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .confirm-modal-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    padding: 22px;
    border-radius: 22px;
  }

  .confirm-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .confirm-modal-actions {
    flex-direction: column-reverse;
  }

  .confirm-modal-actions button {
    width: 100%;
  }

  .app-dialog-card {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 14px;
    padding: 22px;
    border-radius: 22px;
  }

  .app-dialog-icon {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }

  .app-dialog-actions {
    flex-direction: column-reverse;
  }

  .app-dialog-actions button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1240px);
    padding: 20px 0 28px;
  }

  .auth-wrap {
    gap: 14px;
    min-height: auto;
  }

  .brand-panel,
  .auth-card,
  .card,
  .topbar {
    border-radius: 22px;
  }

  .brand-panel,
  .auth-card,
  .card,
  .topbar {
    padding: 22px;
  }

  .brand-panel h1 {
    font-size: 38px;
  }

  .topbar-identity {
    display: grid;
    gap: 16px;
  }

  .brand-art-header {
    width: 122px;
    height: 78px;
  }

  .user-pill {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .user-pill a,
  .user-pill span {
    width: 100%;
    text-align: center;
  }

  .site-footer {
    margin-top: 24px;
  }
}

/* Salesman report workspace */
.salesman-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.salesman-upload-card,
.salesman-structure-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.salesman-file-field input[type="file"] {
  margin-top: 8px;
}

.generation-mode-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.generation-mode-fieldset legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.generation-mode-option {
  position: relative;
  cursor: pointer;
}

.generation-mode-option > input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.generation-mode-card {
  display: grid;
  min-height: 112px;
  padding: 18px;
  border: 1px solid rgba(74, 101, 120, .24);
  border-radius: 18px;
  background: rgba(255, 255, 255, .68);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.generation-mode-card strong {
  color: var(--ink);
  font-size: 16px;
}

.generation-mode-card small {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.generation-mode-option:hover .generation-mode-card {
  transform: translateY(-2px);
  border-color: rgba(19, 111, 124, .55);
}

.generation-mode-option > input:checked + .generation-mode-card {
  border-color: var(--teal);
  background: linear-gradient(145deg, rgba(223, 246, 247, .94), rgba(255, 255, 255, .9));
  box-shadow: inset 4px 0 0 var(--teal), 0 14px 30px rgba(20, 71, 82, .12);
}

.generation-mode-option > input:focus-visible + .generation-mode-card {
  outline: 3px solid rgba(35, 139, 151, .25);
  outline-offset: 2px;
}

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

.report-feature-list > div {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(74, 101, 120, .18);
  border-radius: 16px;
  background: rgba(255, 255, 255, .62);
}

.report-feature-list > div > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.report-feature-list p,
.report-feature-list small {
  display: block;
  margin: 0;
}

.report-feature-list small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.mode-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 111, 124, .1);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .salesman-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .generation-mode-grid { grid-template-columns: 1fr; }
  .generation-mode-card { min-height: 96px; }
}
