:root {
  --bg: #020304;
  --panel: #060809;
  --panel-soft: #0b0f10;
  --panel-muted: #101415;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f7f7f2;
  --muted: #8f9691;
  --accent: #f4f0e8;
  --accent-soft: rgba(244, 240, 232, 0.08);
  --success: #8ee69b;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, #050607 0%, #010101 100%);
}

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

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

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero,
.panel,
.stat-card,
.side-card,
.day-card {
  border: 1px solid var(--line);
  background: rgba(6, 8, 9, 0.94);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 28px;
  border-radius: 34px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2,
.day-date {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  max-width: 14ch;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.35rem;
}

.hero-text,
.side-copy,
.subtle-text,
.status-message,
.day-meta,
.breakdown-item,
.toolbar-field span,
.stat-card span {
  color: var(--muted);
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  line-height: 1.7;
}

.hero-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-steps span,
.file-picker,
.toolbar-field select,
.ghost-button,
.primary-button,
.copy-button,
.output-box,
.url-input {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.hero-steps span {
  padding: 10px 14px;
  color: var(--text);
}

.hero-side {
  display: grid;
  gap: 14px;
  align-content: end;
}

.side-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(16, 20, 21, 0.96), rgba(8, 10, 11, 0.96));
}

.side-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.side-copy {
  margin: 0;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: 28px;
  padding: 22px;
}

.panel-header,
.results-header,
.toolbar,
.panel-actions,
.upload-row,
.day-header,
.day-output,
.url-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-actions,
.toolbar {
  flex-wrap: wrap;
}

.source-stack {
  display: grid;
  gap: 18px;
}

.input-label {
  display: inline-block;
  margin-bottom: 10px;
  font-weight: 600;
}

.source-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 13, 14, 0.96), rgba(6, 8, 9, 0.96));
}

.source-select,
.url-input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  color: var(--text);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #030405;
}

.source-pane[hidden] {
  display: none;
}

.source-meta {
  margin: 0;
  padding: 0 4px;
}

.sheet-input {
  width: 100%;
  min-height: 360px;
  padding: 18px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: #030405;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.55;
  resize: vertical;
}

.sheet-input:focus,
.source-select:focus,
.url-input:focus,
.toolbar-field select:focus,
.copy-button:focus,
.ghost-button:focus,
.primary-button:focus {
  outline: 2px solid rgba(244, 240, 232, 0.35);
  outline-offset: 2px;
}

.file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 12px 18px;
  cursor: pointer;
}

.file-picker-block {
  width: 100%;
  justify-content: center;
  min-height: 54px;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.subtle-text {
  margin: 0;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.primary-button,
.ghost-button,
.copy-button {
  appearance: none;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.primary-button {
  border: 0;
  padding: 13px 18px;
  background: var(--accent);
  color: #070809;
  font-weight: 700;
}

.ghost-button,
.copy-button {
  padding: 12px 16px;
}

.ghost-button.is-copied,
.copy-button.is-copied {
  border-color: rgba(142, 230, 155, 0.35);
  background: rgba(142, 230, 155, 0.12);
  color: var(--success);
}

.ghost-button[disabled],
.copy-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button:hover,
.ghost-button:hover,
.copy-button:hover,
.file-picker:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.toolbar-field {
  display: grid;
  gap: 6px;
}

.toolbar-field select {
  min-width: 160px;
  padding: 11px 16px;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(16, 20, 21, 0.96), rgba(8, 10, 11, 0.96));
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.status-message {
  margin: 0 0 18px;
  min-height: 24px;
}

.results-list {
  display: grid;
  gap: 18px;
}

.day-card {
  padding: 20px;
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(4, 5, 6, 0.98), rgba(4, 5, 6, 0.98)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 50%);
}

.day-date {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.day-meta {
  margin: 8px 0 0;
}

.output-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  padding: 18px 20px;
  background: #050607;
  overflow: hidden;
}

.output-text {
  flex: 1;
  margin: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.02rem;
  line-height: 1.7;
}

.copy-button {
  flex: 0 0 auto;
}

.breakdown-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.breakdown-item {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  line-height: 1.5;
}

.empty-state {
  padding: 30px;
  border-radius: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
  }

  .hero,
  .panel,
  .day-card {
    padding: 18px;
    border-radius: 24px;
  }

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

  .panel-header,
  .results-header,
  .day-header,
  .day-output,
  .url-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .panel-actions,
  .form-actions {
    width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

  .toolbar-field,
  .toolbar-field select,
  .primary-button,
  .ghost-button,
  .copy-button,
  .file-picker,
  .source-select,
  .url-input {
    width: 100%;
  }

  .output-box {
    padding: 16px;
  }

  .output-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
