:root {
  --bg: #323232;
  --phone: #1e1e1f;
  --phone-soft: #262627;
  --phone-elevated: #2d2d2f;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #f3f3f4;
  --muted: #8e8e93;
  --accent: #d5ff49;
  --accent-blue: #74c7ff;
  --accent-purple: #6b6cff;
  --accent-green: #69c17f;
  --accent-red: #ff7a7a;
  --accent-orange: #ffb357;
  --danger: #ff7a7a;
  --shadow: 0 40px 90px rgba(0, 0, 0, 0.45);
  --radius-phone: 42px;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

:root[data-theme="light"] {
  --bg: #efefef;
  --phone: #ffffff;
  --phone-soft: #f7f7f8;
  --phone-elevated: #ffffff;
  --line: rgba(24, 24, 26, 0.08);
  --line-strong: rgba(24, 24, 26, 0.14);
  --text: #141416;
  --muted: #6f6f76;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "SF Pro Display",
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

body {
  overflow-x: hidden;
}

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

.ambient-shape {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel,
.card {
  background: var(--phone-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: var(--radius-phone);
}

.card {
  border-radius: var(--radius-xl);
  padding: 20px;
}

.auth-panel,
.app-frame {
  width: min(100%, 430px);
  min-height: 880px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(33, 33, 34, 0.98), rgba(25, 25, 26, 0.99)),
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.04), transparent 28%);
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 22px;
}

.auth-panel::before,
.app-frame::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 128px;
  height: 34px;
  border-radius: 999px;
  background: #232324;
  z-index: 3;
}

.auth-panel::after,
.app-frame::after {
  content: "19:02";
  position: absolute;
  top: 18px;
  left: 24px;
  color: #8f8f94;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-block {
  padding-top: 42px;
  display: grid;
  gap: 10px;
}

.brand-block h1 {
  margin: 0;
  font-size: 2.8rem;
  line-height: 0.98;
  letter-spacing: -0.06em;
  max-width: 10ch;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.muted,
.secondary-text,
.metric-label,
.session-user,
.list-item small,
.checklist-copy small {
  color: var(--muted);
}

.auth-form,
.stack-form,
.content-area,
.tab-panel,
.list,
.checklist-list {
  display: grid;
  gap: 14px;
}

.auth-form {
  padding: 0;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
}

label span {
  color: #d6d6d8;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #2a2a2b;
  color: var(--text);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(213, 255, 73, 0.35);
  box-shadow: 0 0 0 4px rgba(213, 255, 73, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #77777d;
}

.auth-actions,
.form-actions,
.inline-actions,
.pill-row,
.toolbar,
.chat-input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.tab-button,
.checklist-delete,
.check-toggle {
  border: none;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.tab-button:hover,
.checklist-delete:hover,
.check-toggle:hover {
  transform: translateY(-1px);
}

.primary-button,
.ghost-button,
.danger-button {
  border-radius: 999px;
  padding: 12px 18px;
}

.primary-button {
  color: #1c1c1d;
  background: var(--accent);
  font-weight: 700;
}

.ghost-button {
  color: var(--text);
  background: #2a2a2b;
}

.danger-button,
.checklist-delete {
  color: #ffd2d2;
  background: rgba(255, 122, 122, 0.1);
}

.full-width {
  width: 100%;
}

.feedback,
.feedback-inline {
  min-height: 20px;
  color: var(--accent);
  font-size: 0.92rem;
}

.header-main {
  display: grid;
  gap: 4px;
}

.header-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.header-button {
  padding: 10px 14px;
}

.app-frame {
  display: block;
}

.sidebar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(33, 33, 34, 0.96);
  box-shadow: none;
  z-index: 5;
}

.sidebar > div:first-child,
.sidebar-footer {
  display: none;
}

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

.tab-button {
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 6px 2px;
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 48px;
}

.tab-button.active {
  color: var(--text);
}

.tab-icon {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: #2a2a2b;
  display: grid;
  place-items: center;
}

.tab-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-button.active .tab-icon {
  background: var(--phone-elevated);
  color: var(--accent);
}

.tab-label {
  font-size: 0.58rem;
  line-height: 1.1;
}

.content-area {
  height: 100%;
  padding: 42px 0 84px;
  overflow-y: auto;
  gap: 16px;
}

.content-area::-webkit-scrollbar,
.chat-thread::-webkit-scrollbar {
  width: 6px;
}

.content-area::-webkit-scrollbar-thumb,
.chat-thread::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 18px 18px 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: center;
}

.topbar .eyebrow {
  display: none;
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.topbar h2 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
}

.grid-two,
.grid-three,
.grid-four,
.settings-grid,
.copilot-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.hero-card,
.insight-card,
.card {
  background: var(--phone-elevated);
}

.balance-card {
  display: grid;
  gap: 12px;
  background:
    linear-gradient(180deg, #313133 0%, #2a2a2c 100%);
}

.balance-head,
.selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selector-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: #2a2a2b;
  color: #d1d1d6;
}

.selector-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent-red);
}

.selector-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: #2a2a2b;
}

.selector-switch span {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
}

.selector-switch .active {
  background: #f0f0f0;
  color: #1e1e1f;
}

.ring-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ring-card {
  display: grid;
  gap: 14px;
}

.ring-visual {
  width: 150px;
  height: 150px;
  margin: 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
}

.ring-visual::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 999px;
  background: var(--phone-elevated);
}

.ring-visual span {
  position: relative;
  z-index: 1;
  font-size: 2.1rem;
  font-weight: 800;
}

.ring-visual.finance {
  background: conic-gradient(var(--accent-blue) 0 36%, var(--accent-purple) 36% 60%, var(--accent-green) 60% 82%, #55555a 82% 100%);
}

.ring-visual.health {
  background: conic-gradient(var(--accent) 0 48%, var(--accent-red) 48% 78%, var(--accent-orange) 78% 100%);
}

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

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #d4d4d7;
}

.legend-row small {
  color: var(--muted);
}

.legend-mark {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 10px;
}

.trend-card {
  display: grid;
  gap: 14px;
}

.line-chart-card {
  display: grid;
  gap: 12px;
}

.line-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.line-chart-head strong {
  color: var(--accent);
}

.line-chart {
  width: 100%;
  height: 130px;
}

.line-chart-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.line-chart-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart-labels {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.history-item {
  text-align: left;
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #2a2a2b;
  color: var(--text);
  cursor: pointer;
}

.history-item.selected,
.active-chip {
  background: var(--accent);
  color: #1c1c1d;
}

.metric-value {
  font-size: 2.2rem;
  line-height: 1;
  margin: 10px 0 6px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #2a2a2b;
  color: #d5d5da;
  font-size: 0.86rem;
}

.suggestion-chip {
  background: #2a2a2b;
  color: var(--text);
}

.list-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: #2a2a2b;
  display: grid;
  gap: 6px;
}

.chat-thread {
  max-height: 360px;
  overflow: auto;
}

.chat-bubble {
  max-width: 90%;
  padding: 14px 16px;
  border-radius: 20px;
  line-height: 1.5;
}

.chat-bubble.user {
  justify-self: end;
  background: var(--accent);
  color: #1c1c1d;
}

.chat-bubble.assistant {
  background: #2a2a2b;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: stretch;
  gap: 10px;
}

.chat-input-row input {
  min-width: 0;
}

.chat-input-row .ghost-button,
.chat-input-row .primary-button {
  min-width: 78px;
  justify-content: center;
}

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 150px;
  padding-top: 12px;
}

.bar {
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, #8db82f 100%);
  position: relative;
}

.bar span {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.72rem;
}

.checklist-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: #2a2a2b;
}

.check-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
}

.check-toggle-inner {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.checklist-item.completed .check-toggle-inner {
  background: var(--accent);
  border-color: var(--accent);
  color: #1c1c1d;
}

.checklist-item.completed .checklist-copy strong {
  text-decoration: line-through;
  opacity: 0.72;
}

.checklist-copy {
  display: grid;
  gap: 4px;
}

.checklist-delete {
  padding: 8px 12px;
  border-radius: 999px;
}

.hidden {
  display: none !important;
}

:root[data-theme="light"] .ghost-button,
:root[data-theme="light"] .history-item,
:root[data-theme="light"] .tab-icon,
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .list-item,
:root[data-theme="light"] .checklist-item,
:root[data-theme="light"] .pill,
:root[data-theme="light"] .selector-pill,
:root[data-theme="light"] .selector-switch,
:root[data-theme="light"] .chat-bubble.assistant {
  background: #f1f1f3;
}

:root[data-theme="light"] .line-chart-grid {
  stroke: rgba(24, 24, 26, 0.1);
}

@media (max-width: 480px) {
  .app-shell {
    padding: 0;
  }

  .auth-panel,
  .app-frame {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }
}
