:root {
  --bg: #0c1117;
  --surface: #121a23;
  --surface-2: #182331;
  --text: #eef4fb;
  --muted: #8fa0b3;
  --line: #263445;
  --accent: #58b7ff;
  --accent-2: #6ee7a8;
  --danger: #ff6b6b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --text: #111827;
  --muted: #64748b;
  --line: #d7dee8;
  --accent: #1769e0;
  --accent-2: #149466;
  --shadow: 0 18px 42px rgba(30, 41, 59, 0.08);
}

body[data-theme="indigo"] {
  --bg: #101225;
  --surface: #191d36;
  --surface-2: #23294a;
  --accent: #91a7ff;
  --accent-2: #73e0d0;
}

body[data-theme="forest"] {
  --bg: #0e1511;
  --surface: #16231b;
  --surface-2: #203228;
  --accent: #73d58c;
  --accent-2: #e3d278;
}

body[data-theme="moon"] {
  --bg: #11131c;
  --surface: #1d2130;
  --surface-2: #282d40;
  --accent: #d8dfff;
  --accent-2: #91d8ff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(88, 183, 255, 0.12), transparent 30%), var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(18, 26, 35, 0.86);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #071018;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
small,
p {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
}

nav button,
.btn {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
}

.rail nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  text-align: left;
}

.rail nav button.active {
  background: var(--surface-2);
}

.workspace {
  min-width: 0;
  padding: 24px 24px 96px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 40px);
}

h2 {
  font-size: 18px;
}

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

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

.wide {
  grid-column: 1 / -1;
}

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

.card,
.metrics article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.card {
  padding: 16px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

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

.metrics article {
  padding: 16px;
}

.metrics span {
  color: var(--muted);
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.field {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: 0;
  color: var(--text);
  background: var(--surface-2);
}

textarea {
  min-height: 124px;
  resize: vertical;
}

.btn {
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061018;
}

.btn.ghost {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.btn.danger {
  color: #fff;
  background: var(--danger);
}

.list {
  display: grid;
  gap: 10px;
}

.row,
.person {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

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

.chips,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
}

.actions .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin: 10px 0;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload strong,
.upload small {
  display: block;
}

.preview {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-2);
  white-space: pre-wrap;
}

.image-chip {
  display: inline-block;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #061018;
  background: var(--accent-2);
  font-weight: 800;
}

.options {
  display: grid;
  gap: 8px;
}

.bigline strong,
.bigline span {
  display: block;
}

.bigline strong {
  font-size: 24px;
}

.bottom-nav {
  display: none;
}

.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}

.pulse {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .app {
    display: block;
  }

  .rail {
    position: static;
    height: auto;
    padding: 16px 16px 0;
    border-right: 0;
    background: transparent;
  }

  .rail nav {
    display: none;
  }

  .workspace {
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom));
  }

  .hero {
    align-items: stretch;
  }

  .grid.two,
  .metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .card,
  .metrics article {
    border-radius: 16px;
    box-shadow: none;
  }

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

  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
  }

  .bottom-nav button {
    min-width: 0;
    padding: 7px 3px;
    color: var(--muted);
  }

  .bottom-nav button.active {
    color: var(--text);
    background: var(--surface-2);
  }

  .bottom-nav span,
  .bottom-nav small {
    display: block;
    font-size: 11px;
  }
}
