:root {
  --bg: #eef4f9;
  --bg-deep: #dce7f2;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #f6f9fc;
  --panel-muted: #edf3f8;
  --sidebar-bg: rgba(15, 23, 42, 0.94);
  --sidebar-line: rgba(148, 163, 184, 0.18);
  --ink: #102033;
  --muted: #5f7084;
  --line: #d8e1eb;
  --line-strong: #c5d2e0;
  --accent: #1662c4;
  --accent-strong: #0f4f95;
  --accent-soft: #dbeafe;
  --success: #0f8a5f;
  --error: #c13f35;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
  --display: "Montserrat", "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --sans: "Montserrat", "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 24rem),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--ink);
  font-family: var(--sans);
}

body {
  position: relative;
  overflow-x: hidden;
}

.background-orb {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.18;
  pointer-events: none;
}

.orb-a {
  top: -8rem;
  right: -6rem;
  background: #60a5fa;
}

.orb-b {
  bottom: -8rem;
  left: -8rem;
  background: #38bdf8;
}

.shell {
  width: min(1440px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.welcome-screen {
  width: min(1320px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.welcome-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  min-height: 720px;
  border-radius: 2rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 34px 64px rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.welcome-hero-panel,
.welcome-access-panel {
  padding: 3rem;
}

.welcome-hero-panel {
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 22rem),
    linear-gradient(180deg, #0f172a, #172554 58%, #1e3a8a);
  color: #eff6ff;
}

.welcome-kicker {
  margin: 0;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 800;
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.2rem;
  font-size: 1.8rem;
  font-weight: 700;
}

.welcome-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: white;
  box-shadow: 0 18px 28px rgba(37, 99, 235, 0.28);
}

.welcome-screen h1,
.welcome-screen h2 {
  margin: 1.6rem 0 0;
  font-family: var(--display);
  letter-spacing: -0.05em;
}

.welcome-screen h1 {
  max-width: 12ch;
  font-size: clamp(3rem, 5.6vw, 5rem);
  line-height: 0.97;
  color: white;
}

.welcome-screen h2 {
  font-size: clamp(2rem, 3.2vw, 3rem);
  line-height: 1.02;
  color: var(--ink);
}

.welcome-copy {
  margin: 1.2rem 0 0;
  max-width: 34rem;
  font-size: 1.02rem;
  line-height: 1.7;
}

.welcome-hero-panel .welcome-copy {
  color: rgba(226, 232, 240, 0.86);
}

.welcome-access-panel .welcome-copy {
  color: var(--muted);
}

.welcome-points {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.welcome-points article {
  padding: 1.1rem 1.15rem;
  border-radius: 1.15rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.welcome-points article {
  background: rgba(15, 23, 42, 0.28);
}

.welcome-points strong,
.welcome-hero-visual strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
}

.welcome-points span {
  display: block;
  margin-top: 0.35rem;
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.6;
}

.welcome-access-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.16), transparent 18rem),
    rgba(255, 255, 255, 0.98);
}

.welcome-hero-visual {
  margin-top: 1.6rem;
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.12), transparent 18rem),
    linear-gradient(180deg, #f9fbff, #edf4ff);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.08);
}

.welcome-hero-visual img {
  display: block;
  width: 100%;
  height: auto;
}

.welcome-note {
  margin-top: 1.6rem;
  background: var(--panel-strong);
  border-color: var(--line);
}

.welcome-note .plain-list {
  margin-top: 0.8rem;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

.content-shell {
  min-width: 0;
}

.view[hidden] {
  display: none !important;
}

.hero {
  padding: 0.35rem 0 1.35rem;
}

.eyebrow,
.panel-kicker,
.status-label,
.block-title {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.hero h1,
.panel h2,
.checklist h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero h1 {
  margin-top: 0.5rem;
  font-size: clamp(2.35rem, 4.8vw, 4.25rem);
  font-weight: 800;
}

.lede {
  max-width: 56rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.status-grid,
.workspace,
.field-grid,
.history-workspace {
  display: grid;
  gap: 1rem;
}

.status-grid {
  margin-top: 1.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace {
  grid-template-columns: minmax(0, 1.42fr) minmax(340px, 0.78fr);
  align-items: start;
}

.history-workspace {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 1rem;
  padding: 1.15rem;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.94)),
    var(--sidebar-bg);
  border: 1px solid var(--sidebar-line);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  color: #e5edf5;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  border-radius: 1.25rem 1.25rem 0 0;
  background: linear-gradient(90deg, #60a5fa, #22c55e);
}

.sidebar .eyebrow,
.sidebar .status-label,
.sidebar .panel-kicker,
.sidebar .block-title {
  color: #93c5fd;
}

.sidebar-brand {
  margin-bottom: 1.3rem;
}

.sidebar-brand h1 {
  font-size: 2rem;
  color: #f8fbff;
  font-weight: 800;
}

.sidebar-lede {
  margin-top: 0.8rem;
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.82);
}

.sidebar-nav {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.3rem;
}

.sidebar-link {
  width: 100%;
  justify-content: flex-start;
  padding: 0.92rem 1rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(30, 41, 59, 0.66);
  color: #dbe7f3;
  box-shadow: none;
}

.sidebar-link.is-active {
  background: linear-gradient(135deg, #1662c4, #0f4f95);
  color: white;
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: 0 14px 24px rgba(15, 79, 149, 0.32);
}

.sidebar-status {
  display: grid;
  gap: 0.9rem;
}

.sidebar .status-card {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(148, 163, 184, 0.16);
  color: #eff6ff;
  box-shadow: none;
}

.sidebar .status-card strong {
  color: white;
}

.sidebar .status-card small {
  color: rgba(226, 232, 240, 0.7);
}

.sidebar-checklist {
  margin-top: 1rem;
  background: rgba(15, 23, 42, 0.52);
  border-color: rgba(148, 163, 184, 0.16);
  color: rgba(226, 232, 240, 0.84);
  box-shadow: none;
}

.sidebar-checklist h3 {
  font-size: 1rem;
  color: #f8fbff;
}

.view-header {
  padding-top: 0.2rem;
}

.preview-panel,
.history-panel {
  margin-top: 1.25rem;
}

.history-detail-panel {
  position: static;
}

.panel,
.status-card,
.checklist {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.panel,
.checklist {
  border-radius: 1.15rem;
  padding: 1.25rem;
}

.sidebar.panel {
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.94)),
    var(--sidebar-bg);
  border-color: var(--sidebar-line);
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  color: #e5edf5;
}

.sidebar .sidebar-checklist.checklist {
  background: rgba(15, 23, 42, 0.52);
  border-color: rgba(148, 163, 184, 0.16);
  color: rgba(226, 232, 240, 0.84);
  box-shadow: none;
}

.form-panel::before,
.side-panel::before,
.preview-panel::before,
.history-panel::before,
.history-detail-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  border-radius: 1.15rem 1.15rem 0 0;
  background: linear-gradient(90deg, #1662c4, #60a5fa);
}

.status-card {
  border-radius: 1rem;
  padding: 0.95rem 1rem;
}

.status-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.status-card small {
  color: var(--muted);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  font-size: 1.7rem;
  font-weight: 700;
}

.items-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.items-heading h3 {
  margin: 0.32rem 0 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
}

.panel-badge,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 0.9rem;
}

.history-item {
  display: grid;
  grid-template-columns: 1.3fr 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: var(--panel-strong);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.history-item.is-active {
  border-color: rgba(22, 98, 196, 0.38);
  box-shadow: inset 0 0 0 1px rgba(22, 98, 196, 0.12);
  background: #f7fbff;
}

.history-main strong,
.history-meta strong {
  display: block;
}

.history-meta strong {
  font-variant-numeric: tabular-nums;
}

.history-main small,
.history-meta small {
  display: block;
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field span {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

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

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

input,
select,
button,
a {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 3rem;
  padding: 0.74rem 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

input[readonly] {
  background: #f7fafc;
  color: #0f172a;
}

input:focus,
select:focus {
  outline: 2px solid rgba(22, 98, 196, 0.14);
  border-color: rgba(22, 98, 196, 0.48);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.45rem;
}

button {
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #1662c4, #0f4f95);
  color: white;
  padding: 0.88rem 1.15rem;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 28px rgba(15, 79, 149, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

button:hover,
.button-link:hover,
.secondary-button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(15, 79, 149, 0.24);
}

.secondary-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

.secondary-button:hover {
  box-shadow: none;
}

.button-link,
.secondary-button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0.88rem 1.15rem;
  border-radius: 0.85rem;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.button-link {
  background: linear-gradient(135deg, #1662c4, #0f4f95);
  color: white;
  box-shadow: 0 14px 28px rgba(15, 79, 149, 0.2);
}

.secondary-button-link {
  background: white;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}

.secondary-button-link:hover {
  box-shadow: none;
}

button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.items-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.items-list {
  display: grid;
  gap: 0.85rem;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(150px, 0.6fr) auto;
  gap: 0.85rem;
  align-items: end;
}

.item-description,
.item-amount {
  margin-bottom: 0;
}

.icon-button {
  min-height: 3rem;
  padding-inline: 1rem;
}

.preview-actions {
  margin-top: 0;
}

.preview-frame {
  width: 100%;
  min-height: 980px;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: white;
}

.hint,
.plain-list,
.checklist {
  color: var(--muted);
}

.hint {
  margin: 0;
  max-width: 34rem;
  line-height: 1.5;
}

.message-box {
  border-radius: 0.95rem;
  padding: 0.92rem 1rem;
  border: 1px solid var(--line);
  background: #f8fbfe;
  color: var(--muted);
}

.message-box.success {
  border-color: rgba(15, 138, 95, 0.22);
  color: var(--success);
  background: rgba(225, 246, 238, 0.9);
}

.message-box.error {
  border-color: rgba(193, 63, 53, 0.2);
  color: var(--error);
  background: rgba(252, 237, 235, 0.92);
}

.message-box.loading {
  border-color: rgba(22, 98, 196, 0.22);
  color: var(--accent-strong);
  background: rgba(227, 239, 255, 0.92);
}

.result-card {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: 1rem;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.result-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

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

.result-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.result-grid dd {
  margin: 0.2rem 0 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-block {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.result-text {
  margin: 0.45rem 0 0;
  line-height: 1.55;
}

.result-block a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  word-break: break-all;
}

.plain-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  line-height: 1.55;
}

.checklist {
  margin-top: 1rem;
}

@media (max-width: 1080px) {
  .welcome-card,
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .history-detail-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .welcome-hero-panel,
  .welcome-access-panel {
    padding: 2rem 1.35rem;
  }

  .welcome-screen {
    width: min(100vw - 1rem, 1320px);
    padding-top: 1rem;
  }

  .workspace,
  .history-workspace,
  .status-grid,
  .field-grid,
  .field-grid.triple,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .items-heading,
  .result-topline,
  .actions {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .preview-frame {
    min-height: 760px;
  }

  .shell {
    width: min(100vw - 1rem, 1440px);
  }
}
