:root {
  --bg: #edf1f6;
  --surface: #ffffff;
  --surface-soft: #f6f9fc;
  --text: #102235;
  --muted: #55687f;
  --border: #d6dfeb;
  --primary: #1261d8;
  --primary-dark: #0d4faa;
  --success: #17653a;
  --success-bg: #eaf8ef;
  --success-border: #bddfc9;
  --warn: #875400;
  --warn-bg: #fff4dc;
  --warn-border: #f4ddb2;
  --danger: #aa2e2e;
  --danger-bg: #feeaea;
  --danger-border: #f3c0c0;
  --info: #1d4f8e;
  --info-bg: #eef5ff;
  --info-border: #c8d8f5;
  --shadow: 0 20px 60px rgba(16, 34, 53, 0.08);
  --app-shell-max: 1180px;
  --rail-divider-color: rgba(214, 223, 235, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Noto Sans", Arial, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(52, 110, 214, 0.12), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(61, 174, 233, 0.1), transparent 28%),
    var(--bg);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.68rem 0.95rem;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

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

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(18, 97, 216, 0.22);
  outline-offset: 2px;
}

button.secondary,
.secondary-link {
  background: #1f344d;
  border-color: #1f344d;
}

button.secondary:hover:not(:disabled),
.secondary-link:hover {
  background: #16273c;
}

button.ghost {
  background: #ffffff;
  color: #233750;
  border-color: #b8c8dc;
}

button.ghost:hover:not(:disabled) {
  background: #f5f8fc;
}

button.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

button.danger:hover:not(:disabled) {
  background: #ffd7d7;
}

button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid #c3d1e3;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  background: #ffffff;
  color: inherit;
}

input[type="range"] {
  width: 100%;
}

progress {
  width: 100%;
  height: 12px;
}

.hidden {
  display: none !important;
}

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

.hero {
  padding-block: 2rem 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.subtitle {
  margin: 0.65rem 0 0;
  max-width: 780px;
  color: var(--muted);
  line-height: 1.6;
}

.page {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}

.layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
    align-items: start;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.decision-banner {
  display: grid;
  gap: 1rem;
}

@media (min-width: 860px) {
  .decision-banner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
}

.decision-banner h2,
.section-head h2,
.panel h3,
.guide-card h2,
.modal-header h2 {
  margin: 0;
}

.decision-banner__actions {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 0.75rem;
  row-gap: 1rem;
  align-items: start;
}

.section-head > :first-child {
  display: grid;
  gap: 0.55rem;
  min-width: min(100%, 34rem);
}

.section-head > :first-child .eyebrow,
.section-head > :first-child .muted {
  margin: 0;
}

.section-head--tight {
  margin-bottom: 0.75rem;
}

.section-head + .message,
.section-head + .hint-stack,
.section-head + .preset-bar,
.section-head + .ingest-bar {
  margin-top: 0.55rem;
}

.section-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #edf3fb;
  color: #21466d;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.accent {
  background: #e2ecff;
  color: #173f85;
}

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

.small {
  font-size: 0.9rem;
}

.preset-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem;
  margin-top: 1rem;
}

.preset-chip {
  min-height: 62px;
  border-radius: 14px;
  border: 1px solid #c9d7ea;
  background: #ffffff;
  color: #1e3650;
  padding: 0.75rem;
  text-align: left;
  font-weight: 700;
}

.preset-chip.is-active {
  background: #ebf3ff;
  border-color: #7ea7e9;
  color: #153f84;
}

.field,
.range-field {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.inline-field {
  min-width: 210px;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

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

.ingest-bar,
.queue-toolbar,
.progress-row,
.preview-pane__head,
.modal-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-start;
}

.ingest-bar {
  margin-top: 0.15rem;
  align-items: flex-start;
}

.ingest-bar .small {
  flex: 1 1 280px;
  min-width: 220px;
  line-height: 1.45;
}

.drop-zone {
  margin-top: 0.85rem;
  border: 1px dashed #96acc8;
  border-radius: 16px;
  padding: 1.15rem;
  background: #f6f9fe;
  color: #41566f;
  text-align: center;
  cursor: pointer;
  display: grid;
  gap: 0.45rem;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.is-over {
  border-color: var(--primary);
  background: #ecf3ff;
  color: #1c436e;
  outline: none;
}

.message {
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  line-height: 1.5;
  font-size: 0.93rem;
}

.message.info {
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info);
}

.message.warn {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}

.message.error {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.message.success {
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}

.hint-stack {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.hint-card {
  display: grid;
  gap: 0.35rem;
}

.subsection {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.subsection .section-head--tight {
  margin-bottom: 0;
}

.checkbox-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.94rem;
  line-height: 1.45;
}

.checkbox-row input {
  margin-top: 0.1rem;
}

.queue-toolbar {
  margin: 1rem 0 0.75rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.queue-table th,
.queue-table td {
  border-top: 1px solid var(--border);
  padding: 0.7rem 0.6rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

.queue-table thead th {
  border-top: 0;
  background: #f8fbff;
  color: #284567;
  position: sticky;
  top: 0;
  z-index: 1;
}

.checkbox-col {
  width: 44px;
}

.file-cell {
  display: grid;
  gap: 0.2rem;
}

.file-cell strong {
  word-break: break-word;
}

.file-subline {
  color: var(--muted);
  font-size: 0.84rem;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.77rem;
  font-weight: 700;
  background: #edf3fb;
  color: #21466d;
}

.badge.warn {
  background: #fff2d4;
  color: #7e5100;
}

.badge.success {
  background: #e8f6ee;
  color: #19623a;
}

.badge.error {
  background: #fdeaea;
  color: #9a2d2d;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 800;
  background: #eef3f9;
  color: #25476b;
}

.status-pill.success {
  background: #e8f6ee;
  color: #17653a;
}

.status-pill.failed {
  background: #fdeaea;
  color: #aa2e2e;
}

.status-pill.skipped {
  background: #fff3da;
  color: #8b5900;
}

.status-pill.processing {
  background: #ebf3ff;
  color: #1755b0;
}

.progress-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.kpis {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem;
  background: #f8fbff;
}

.kpi__label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.kpi strong {
  display: block;
  margin-top: 0.28rem;
}

.empty-state {
  border: 1px dashed #bfd0e6;
  border-radius: 14px;
  padding: 1rem;
  color: var(--muted);
  background: #f7fafe;
}

.results-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  overflow: hidden;
}

.result-card summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1rem;
}

.result-card summary::-webkit-details-marker {
  display: none;
}

.result-card__summary {
  display: grid;
  gap: 0.7rem;
}

@media (min-width: 860px) {
  .result-card__summary {
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, auto));
    align-items: center;
  }
}

.result-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.result-card__body {
  border-top: 1px solid var(--border);
  padding: 0.95rem 1rem 1rem;
  display: grid;
  gap: 0.9rem;
}

.metric-grid {
  display: grid;
  gap: 0.7rem;
}

@media (min-width: 860px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.metric {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #ffffff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.metric strong {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.96rem;
}

.result-warning-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 19, 34, 0.58);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(1120px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #d2deec;
  padding: 1rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
}

.preview-meta {
  margin-top: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.preview-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 860px) {
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.preview-pane {
  display: grid;
  gap: 0.65rem;
}

.preview-surface {
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 320px;
  overflow: hidden;
  background-color: #ffffff;
}

.preview-scroll {
  overflow: auto;
  max-height: 58vh;
  padding: 1rem;
}

.preview-scroll img {
  display: block;
  max-width: none;
  height: auto;
}

.checker {
  background-image:
    linear-gradient(45deg, #edf1f6 25%, transparent 25%),
    linear-gradient(-45deg, #edf1f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1f6 75%),
    linear-gradient(-45deg, transparent 75%, #edf1f6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.guide-layout {
  display: grid;
  gap: 0.8rem;
  padding-bottom: 1rem;
}

@media (min-width: 860px) {
  .guide-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem;
}

.guide-card p,
.guide-card li {
  color: var(--muted);
  line-height: 1.6;
}

.guide-card p {
  margin: 0.55rem 0 0;
}

.guide-card ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
}

.updated-at {
  font-size: 0.84rem;
}

.tool-footer {
  margin-top: 2rem;
  padding-bottom: 2rem;
}

.tool-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  margin-bottom: 0.9rem;
}

.tool-footer__nav a {
  text-decoration: none;
}

.tool-footer__nav a:hover,
.tool-footer__nav a:focus-visible {
  text-decoration: underline;
}

.tool-footer__meta,
.tool-footer__note {
  margin: 0 0 0.75rem;
  color: #4c5c70;
  line-height: 1.6;
}

@media (max-width: 719px) {
  .form-grid.two,
  .kpis {
    grid-template-columns: 1fr;
  }
}
