:root {
  --ink: #162321;
  --muted: #5e6865;
  --panel: rgba(255, 251, 244, 0.92);
  --panel-strong: #fffdf8;
  --line: rgba(22, 35, 33, 0.11);
  --cedar: #1f5d53;
  --cedar-deep: #133a34;
  --cedar-soft: rgba(31, 93, 83, 0.12);
  --amber: #b67020;
  --amber-soft: rgba(182, 112, 32, 0.12);
  --shadow: 0 24px 60px rgba(26, 42, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 93, 83, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(182, 112, 32, 0.16), transparent 24%),
    linear-gradient(180deg, #f6f0e6 0%, #efe5d7 52%, #f7f2e9 100%);
}

code,
table {
  font-family: "IBM Plex Mono", monospace;
}

.app-shell {
  width: min(1380px, calc(100vw - 18px));
  margin: 0 auto;
  padding: 12px 0 18px;
}

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

.hero-copy {
  min-width: 0;
}

.eyebrow,
.panel-kicker,
.metric-label {
  margin: 0 0 8px;
  color: var(--cedar-deep);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.panel h2,
.metric-card h3 {
  margin: 0;
  line-height: 1;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.2vw, 3.2rem);
}

.hero-subtitle {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.42;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.meta-chip,
.date-pill {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 20px rgba(26, 42, 40, 0.06);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
}

.date-pill {
  color: var(--cedar-deep);
  font-weight: 700;
}

.control-grid,
.summary-grid,
.detail-grid {
  display: grid;
  gap: 10px;
}

.control-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 10px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
}

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

.panel,
.metric-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  padding: 13px;
}

.metric-card {
  padding: 14px 14px 13px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  animation: lift-in 360ms ease;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: auto -30px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 93, 83, 0.16), transparent 60%);
  z-index: -1;
}

.panel-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.panel-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.38;
}

.panel-meta {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.upload-box {
  display: block;
  margin-top: 10px;
  padding: 14px;
  border: 1.5px dashed rgba(31, 93, 83, 0.34);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(31, 93, 83, 0.08), rgba(255, 255, 255, 0.96)),
    var(--panel-strong);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.upload-box:hover,
.upload-box.drag-over {
  transform: translateY(-1px);
  border-color: var(--cedar);
  box-shadow: 0 18px 36px rgba(31, 93, 83, 0.14);
}

.upload-title {
  display: block;
  font-size: 0.98rem;
  font-weight: 700;
}

.upload-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.status {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 14px;
  font-size: 0.84rem;
  line-height: 1.38;
}

.status-muted {
  background: rgba(22, 35, 33, 0.05);
  color: var(--muted);
}

.status-ready {
  background: var(--cedar-soft);
  color: var(--cedar-deep);
}

.status-error {
  background: var(--amber-soft);
  color: #8b4f08;
}

.rules {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rule-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.rule-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.rule-value {
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.primary-button,
.ghost-button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
}

.primary-button {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--cedar) 0%, var(--cedar-deep) 100%);
  color: #fff9f0;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(19, 58, 52, 0.2);
}

.ghost-button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.primary-button:hover:not(:disabled),
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.metric-value {
  margin-top: 10px;
  font-size: clamp(1.25rem, 2.4vw, 2.05rem);
}

.metric-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.34;
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
  max-height: 430px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
}

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

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4ece0;
  color: var(--cedar-deep);
  text-align: left;
  font-size: 0.82rem;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.82rem;
}

tbody tr:nth-child(even) {
  background: rgba(31, 93, 83, 0.04);
}

.amount-column,
.amount-cell {
  text-align: right;
}

.currency-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(31, 93, 83, 0.12);
  color: var(--cedar-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.empty-row {
  padding: 18px;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
  text-align: center;
}

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

@media (max-width: 1180px) {
  .control-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 16px, 100%);
    padding-top: 12px;
  }

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

  .hero-meta {
    justify-content: flex-start;
  }

  .control-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .rule-value {
    text-align: left;
  }

  .action-row {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
