/* src/styles.css */
:root {
  color: #1c1917;
  --stone-950: #1c1917;
  --stone-700: #44403c;
  --stone-600: #57534e;
  --stone-500: #78716c;
  --stone-300: #d6d3d1e6;
  --stone-200: #e7e5e4eb;
  --surface: #ffffffd1;
  --surface-strong: #ffffffeb;
  --surface-warm: #fff7e7e6;
  --amber-700: #b45309;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --rose-900: #881337;
  --rose-100: #fff1f2f5;
  --rose-200: #fecdd3fa;
  background: #efe7dc;
  font-family: Avenir Next, Segoe UI, sans-serif;
}

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

body {
  color: var(--stone-950);
  background: radial-gradient(circle at 0 0, #f9e6bff2, #f4ece0d1 38%, #e8dbc6e6 100%);
  margin: 0;
}

* {
  box-sizing: border-box;
}

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

h1, h2, h3, p, ul {
  margin: 0;
}

ul {
  padding-left: 1.25rem;
}

::selection {
  background: #f59e0b38;
}

.app-shell {
  min-height: 100vh;
  padding: 2rem 1rem;
}

.app-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 84rem;
  margin: 0 auto;
}

.page-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-toolbar__copy {
  display: grid;
  gap: .35rem;
}

.page-kicker {
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--stone-500);
  font-size: .78rem;
  font-weight: 700;
}

.page-title {
  color: var(--stone-950);
  font-family: Iowan Old Style, Palatino Linotype, serif;
  font-size: 2rem;
  line-height: 1.1;
}

.page-summary {
  color: var(--stone-600);
  max-width: 48rem;
  font-size: 1rem;
  line-height: 1.7;
}

.app-grid, .dashboard-stack, .chart-stack, .form-stack {
  display: grid;
  gap: 1.5rem;
}

.form-stack {
  gap: 1.25rem;
}

.summary-grid, .metrics-grid {
  display: grid;
  gap: 1rem;
}

.message-actions, .result-actions {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.ui-card {
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid #ffffffa6;
  border-radius: 1.75rem;
  box-shadow: 0 24px 90px -45px #7856208c;
}

.panel-card__header {
  border-bottom: 1px solid var(--stone-200);
  padding: 1.5rem;
}

.panel-card__header--accent {
  background: linear-gradient(135deg, #ffffffeb, #fbf0d6e0);
}

.panel-card__header--plain {
  background: #ffffffb3;
}

.ui-card-title {
  letter-spacing: -.02em;
  color: var(--stone-950);
  font-family: Iowan Old Style, Palatino Linotype, serif;
  font-size: 1.6rem;
  font-weight: 600;
}

.ui-card-description {
  color: var(--stone-600);
  margin-top: .45rem;
  font-size: .95rem;
  line-height: 1.6;
}

.ui-card-content {
  padding: 1.5rem;
}

.field-group {
  display: grid;
  gap: .5rem;
}

.field-group--readonly .ui-label {
  color: var(--stone-600);
}

.ui-label {
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--stone-500);
  font-size: .74rem;
  font-weight: 600;
}

.ui-input, .ui-select {
  color: var(--stone-950);
  outline: none;
  background: #fff;
  border: 1px solid #d6d3d1cc;
  border-radius: 1rem;
  width: 100%;
  min-height: 3rem;
  padding: .8rem 1rem;
  transition: border-color .14s, box-shadow .14s, background-color .14s;
  box-shadow: inset 0 1px #ffffffb3;
}

.ui-select {
  appearance: none;
}

.ui-input:focus, .ui-select:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 4px #fde68abf, inset 0 1px #ffffffb3;
}

.ui-input:disabled {
  cursor: not-allowed;
  border-color: var(--stone-200);
  color: var(--stone-500);
  background: #f5f5f4f2;
}

.ui-input[readonly], .ui-select:disabled {
  cursor: not-allowed;
  border-color: var(--stone-200);
  color: var(--stone-500);
  background: #f5f5f4f2;
  box-shadow: inset 0 1px #ffffff73;
}

.ui-input[readonly]:focus, .ui-select:disabled:focus {
  border-color: var(--stone-200);
  box-shadow: inset 0 1px #ffffff73;
}

.field-note {
  color: var(--stone-500);
  font-size: .92rem;
  line-height: 1.6;
}

.action-button {
  display: inline-flex;
  cursor: pointer;
  border: 1px solid #0000;
  border-radius: 999px;
  justify-content: center;
  align-items:  center;
  gap: .6rem;
  min-height: 3rem;
  padding: .75rem 1.15rem;
  transition: transform .12s, box-shadow .12s, background-color .12s, border-color .12s;
  font-weight: 600;
}

.action-button svg {
  flex: none;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button--primary {
  color: #fdfcfb;
  background: linear-gradient(135deg, #1c1917, #44403c);
  box-shadow: 0 18px 40px -24px #1c191799;
}

.action-button--secondary {
  border-color: var(--stone-300);
  color: var(--stone-950);
  background: #ffffffeb;
}

.action-button--disabled, .action-button:disabled {
  border-color: var(--stone-300);
  color: var(--stone-500);
  cursor: not-allowed;
  box-shadow: none;
  background: #e7e5e4e6;
  transform: none;
}

.summary-card {
  border: 1px solid var(--stone-200);
  background: linear-gradient(145deg, #ffffffdb, #fff7e7e0);
}

.summary-card__content {
  display: flex;
  align-items:  flex-start;
  gap: 1rem;
  padding: 1.25rem;
}

.summary-icon {
  display: inline-flex;
  background: var(--amber-100);
  color: var(--amber-700);
  border-radius: 1rem;
  flex: none;
  justify-content: center;
  align-items:  center;
  width: 2.75rem;
  height: 2.75rem;
}

.summary-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.summary-copy {
  display: grid;
  gap: .35rem;
}

.summary-label, .metric-label {
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--stone-500);
  font-size: .74rem;
}

.summary-value, .metric-value {
  color: var(--stone-950);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
}

.error-box {
  border: 1px solid var(--rose-200);
  background: var(--rose-100);
  color: var(--rose-900);
  border-radius: 1.5rem;
  padding: 1.5rem;
}

.error-box__title {
  font-weight: 600;
}

.error-box__list {
  display: grid;
  gap: .5rem;
  margin-top: .75rem;
  font-size: .95rem;
  line-height: 1.6;
}

.metric-card {
  border: 1px solid var(--stone-200);
  background: #fafaf9c7;
  border-radius: 1.5rem;
  padding: 1rem;
}

.metric-value {
  margin-top: .45rem;
}

.metric-detail {
  color: var(--stone-500);
  margin-top: .35rem;
  font-size: .88rem;
}

.chart-frame {
  border: 1px solid var(--stone-200);
  background: linear-gradient(#ffffffe6, #fcf8f1e0);
  border-radius: 1.75rem;
  width: 100%;
  height: 26.25rem;
  padding: 1rem;
}

.chart-tooltip {
  background: #fffffff5;
  border: 1px solid #d6d3d1f2;
  border-radius: 1rem;
  min-width: 12rem;
  padding: .9rem 1rem;
  box-shadow: 0 18px 48px -24px #1c191759;
}

.chart-tooltip__title {
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--stone-500);
  font-size: .82rem;
  font-weight: 700;
}

.chart-tooltip__rows {
  display: grid;
  gap: .45rem;
  margin-top: .7rem;
}

.chart-tooltip__row {
  display: flex;
  color: var(--stone-700);
  justify-content: space-between;
  align-items:  center;
  gap: 1rem;
  font-size: .95rem;
}

.chart-tooltip__row strong {
  color: var(--stone-950);
}

@media (min-width: 768px) {
  .summary-grid, .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-toolbar {
    flex-direction: row;
    justify-content: space-between;
    align-items:  center;
  }

  .result-actions, .message-actions {
    flex-direction: row;
  }
}

@media (min-width: 1100px) {
  .app-shell {
    padding: 2.5rem;
  }

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