/* Bertha in the browser: soft glass, the one design system, the same
   language as leyoda.eu. A calm wash of pastel light behind everything,
   the frame (sidebar, toolbar pills) frosted, the work on translucent
   white cards with a hairline highlight and one soft shadow. Glass is
   for navigation, never for content. */

:root {
  /* Near-black ink, a breath of green */
  --ink: #1a1f1c;
  --ink-soft: #4c5550;
  --ink-faint: #7a8480;
  --accent: #2f7d5f;
  --accent-soft: rgba(47, 125, 95, 0.12);
  --success: #2f7d5f;
  --warning: #a8730f;
  --error: #b3382e;

  /* The backdrop: warm off-white with mint, sage, cream and sand glows */
  --base: rgb(243, 242, 236);
  --glow-a: rgba(179, 224, 199, 0.55);
  --glow-b: rgba(214, 232, 205, 0.5);
  --glow-c: rgba(246, 238, 210, 0.55);
  --glow-d: rgba(205, 226, 219, 0.45);

  /* Glass for the frame */
  --glass: rgba(255, 255, 255, 0.58);
  --glass-edge: rgba(255, 255, 255, 0.75);

  /* The card */
  --card: rgba(255, 255, 255, 0.74);
  --card-edge: rgba(255, 255, 255, 0.85);
  --card-shadow: 0 6px 18px rgba(10, 20, 15, 0.07);

  /* The well: a faint tint carved into the card */
  --well: rgba(10, 20, 15, 0.05);
  --well-edge: rgba(10, 20, 15, 0.04);

  --hairline: rgba(26, 31, 28, 0.1);
  --skeleton: rgba(10, 20, 15, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Deep green-charcoal, warm type, never pure black */
    --ink: #ece9dd;
    --ink-soft: #b7bcb2;
    --ink-faint: #8b938c;
    --accent: #7fc4a4;
    --accent-soft: rgba(127, 196, 164, 0.16);

    --base: rgb(17, 21, 19);
    --glow-a: rgba(38, 74, 56, 0.5);
    --glow-b: rgba(52, 84, 66, 0.4);
    --glow-c: rgba(84, 78, 44, 0.35);
    --glow-d: rgba(38, 68, 64, 0.45);

    --glass: rgba(24, 30, 27, 0.62);
    --glass-edge: rgba(255, 255, 255, 0.08);

    --card: rgba(30, 39, 35, 0.78);
    --card-edge: rgba(255, 255, 255, 0.07);
    --card-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);

    --well: rgba(255, 255, 255, 0.06);
    --well-edge: rgba(255, 255, 255, 0.04);

    --hairline: rgba(236, 233, 221, 0.12);
    --skeleton: rgba(255, 255, 255, 0.07);
  }
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--base);
  background-image:
    radial-gradient(60% 55% at 12% 8%, var(--glow-a), transparent 100%),
    radial-gradient(50% 45% at 88% 12%, var(--glow-b), transparent 100%),
    radial-gradient(55% 50% at 78% 88%, var(--glow-c), transparent 100%),
    radial-gradient(60% 60% at 18% 92%, var(--glow-d), transparent 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Frame ---------- */

.app-root {
  min-height: 100vh;
}

.glass-sidebar {
  position: fixed;
  top: 16px;
  bottom: 16px;
  left: 16px;
  width: 232px;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: var(--card-shadow);
}

.sidebar-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 10px 16px;
}

.sidebar-brand .name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand .firm {
  font-size: 12px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background-color 300ms, color 300ms, transform 300ms;
}

.nav-item svg { width: 18px; height: 18px; flex: none; }

.nav-item:hover {
  background: var(--well);
  color: var(--ink);
}

.nav-item:active { transform: scale(0.97); }

.nav-item.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px 0;
}

.foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.foot-hint {
  font-size: 12px;
  color: var(--ink-faint);
}

/* The eight language pills share the narrow foot: they wrap instead
   of overflowing the sidebar */
.language-pills {
  flex-wrap: wrap;
  gap: 6px;
}

/* The pill that says this is a demo */
.demo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

/* ---------- Content ---------- */

.content {
  margin-left: 280px;
  padding: 28px 28px 48px;
  max-width: 1080px;
}

.screen {
  animation: screen-in 360ms cubic-bezier(0.34, 1.26, 0.64, 1);
}

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

.page-head {
  margin: 4px 0 20px;
}

.kicker {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  margin: 4px 0 0;
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 60ch;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stack { display: grid; gap: 14px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

/* The figure card: hours saved, the one big number */
.figure {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.figure .value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.figure .label {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.sheet th {
  text-align: left;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

table.sheet td {
  padding: 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

table.sheet tr:last-child td { border-bottom: none; }

/* Amounts: tabular figures, right-aligned */
td.amount, th.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.amount { font-weight: 650; }

.total-row td {
  border-top: 1px solid var(--hairline);
  font-weight: 700;
}

/* ---------- Badges and pills ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--well);
  color: var(--ink-soft);
  white-space: nowrap;
}

.badge.tone-accent { background: var(--accent-soft); color: var(--accent); }
.badge.tone-success { background: rgba(47, 125, 95, 0.14); color: var(--success); }
.badge.tone-warning { background: rgba(168, 115, 15, 0.14); color: var(--warning); }
.badge.tone-error { background: rgba(179, 56, 46, 0.12); color: var(--error); }
.badge.tone-muted { background: var(--well); color: var(--ink-faint); }

/* Near-black primary pills, white secondary pills with a hairline */
button.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 300ms, opacity 300ms, background-color 300ms, box-shadow 300ms;
}

button.pill:active { transform: scale(0.96); }

button.pill.primary {
  background: var(--ink);
  color: var(--base);
  border: none;
}

button.pill.primary:hover { opacity: 0.88; }

button.pill.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--hairline);
}

button.pill.secondary:hover { background: var(--well); }

button.pill:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Fields and wells ---------- */

.well {
  background: var(--well);
  border: 1px solid var(--well-edge);
  border-radius: 12px;
  padding: 10px 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.field input, .field select {
  font: inherit;
  color: var(--ink);
  background: var(--well);
  border: 1px solid var(--well-edge);
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 300ms;
}

.field input:focus, .field select:focus {
  border-color: var(--accent);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filter-bar .field { min-width: 160px; }

textarea.note {
  font: inherit;
  color: var(--ink);
  background: var(--well);
  border: 1px solid var(--well-edge);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 64px;
  resize: vertical;
  outline: none;
  width: 100%;
}

/* ---------- Progress tracks ---------- */

.track {
  height: 6px;
  border-radius: 999px;
  background: var(--well);
  overflow: hidden;
}

.track .fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 360ms cubic-bezier(0.34, 1.26, 0.64, 1);
}

/* ---------- The filing chain ---------- */

.chain {
  display: flex;
  align-items: flex-start;
  gap: 0;
  flex-wrap: wrap;
  row-gap: 10px;
}

.chain-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--well);
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chain-step .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.chain-step.done {
  background: var(--accent-soft);
  color: var(--accent);
}

.chain-step.done .dot { background: var(--accent); }

.chain-step.current {
  background: var(--ink);
  color: var(--base);
}

.chain-step.current .dot { background: var(--base); }

.chain-arrow {
  align-self: center;
  color: var(--ink-faint);
  padding: 0 6px;
  font-size: 13px;
}

.event-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 13px;
}

.event-list li {
  display: flex;
  gap: 8px;
  padding: 3px 0;
}

.event-list .when {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Approvals ---------- */

.approval {
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}

.approval:last-child { border-bottom: none; padding-bottom: 0; }

.approval .title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.approval .title {
  font-weight: 650;
}

.approval .detail {
  margin: 6px 0 0;
  color: var(--ink-soft);
  max-width: 70ch;
}

.approval .prepared {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.approval .actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.approval .note-field {
  margin-top: 12px;
}

.decision-note {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Deadlines and deliveries ---------- */

.deadline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.deadline:last-child { border-bottom: none; }

.deadline .what { display: flex; flex-direction: column; gap: 1px; }

.deadline .when {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
  color: var(--ink-soft);
}

.delivery {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.delivery:last-child { border-bottom: none; }

.delivery .counts {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 13px;
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.delivery .track { grid-column: 1 / -1; }

/* ---------- Briefing ---------- */

.briefing-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--hairline);
}

.briefing-section:last-child { border-bottom: none; }

.briefing-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.briefing-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
}

.briefing-section li { padding: 2px 0; }

/* ---------- Pairing ---------- */

.pairing-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.pairing {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
}

.pairing .hero {
  text-align: center;
  padding-top: 12px;
}

.pairing .hero .mark {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.pairing form {
  display: grid;
  gap: 14px;
}

.fingerprint-box {
  text-align: center;
  padding: 18px;
}

.fingerprint {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 8px 0 4px;
  color: var(--ink);
}

.error-note {
  color: var(--error);
  font-size: 13.5px;
  margin: 0;
}

.hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 4px 0 0;
}

.pairing .demo-entry {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding-top: 4px;
}

/* ---------- Empty and loading states ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 36px 16px;
  text-align: center;
}

.empty svg { width: 28px; height: 28px; color: var(--ink-faint); }

.empty p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 42ch;
}

.loading {
  display: grid;
  gap: 10px;
  padding: 8px 0;
}

.skeleton {
  height: 14px;
  border-radius: 7px;
  background: var(--skeleton);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: var(--card-shadow);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  animation: toast-in 340ms cubic-bezier(0.34, 1.26, 0.64, 1);
  z-index: 40;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Motion ---------- */

/* Sprays of 300 to 400 ms, nothing loops except the loading pulse.
   With reduced motion: opacity only, and no pulse. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .screen { animation: none; }

  .skeleton { animation: none; opacity: 0.5; }
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .glass-sidebar {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px;
  }

  .sidebar-brand { display: none; }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    overflow-x: auto;
  }

  .nav-item { padding: 8px 12px; }

  .nav-item span { display: none; }

  .sidebar-foot { display: none; }

  .content {
    margin-left: 0;
    padding: 20px 14px 96px;
  }
}
