:root {
  --accent: #7c3aed;
  --accent-rgb: 124, 58, 237;
  --ink: #241d33;
  --muted: #81788f;
  --line: rgba(42, 31, 61, 0.13);
  --page: #f5f3f8;
  --surface: #fff;
  --surface-rgb: 255, 255, 255;
  --overlay: rgba(39, 30, 54, 0.2);
  color: var(--ink);
  background: var(--page);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  --ink: #f5f1fb;
  --muted: #a99fb6;
  --line: rgba(255, 255, 255, 0.14);
  --page: #070709;
  --surface: #0d0d10;
  --surface-rgb: 13, 13, 16;
  --overlay: rgba(0, 0, 0, 0.68);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.phone-app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100svh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
}

.screen {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.main-screen {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.4svh, 22px);
  padding:
    calc(18px + env(safe-area-inset-top))
    16px
    calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: clamp(26px, 8vw, 42px);
  background: var(--surface);
}

.tool-row {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 7px;
  padding: 0 10px;
}

.neon-button {
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.62);
  background: rgba(var(--accent-rgb), 0.055);
  color: var(--accent);
  cursor: pointer;
  box-shadow:
    0 3px 10px rgba(var(--accent-rgb), 0.16),
    inset 0 0 8px rgba(var(--accent-rgb), 0.055);
}

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

.neon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.tool-button {
  width: clamp(42px, 11.5vw, 50px);
  height: clamp(42px, 11.5vw, 50px);
  border-radius: 14px;
}

.tool-button svg {
  width: 28px;
  height: 28px;
}

.chat-stage {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  place-items: center;
}

.chat-messages {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.chat-messages::-webkit-scrollbar,
.section-cards::-webkit-scrollbar {
  display: none;
}

.chat-message {
  max-width: 82%;
  align-self: flex-end;
  margin: 0;
  padding: 10px 13px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 16px 16px 4px;
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.voice-button {
  display: grid;
  width: clamp(142px, 44vw, 184px);
  height: clamp(142px, 44vw, 184px);
  place-items: center;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-shadow:
    0 0 0 2px rgba(var(--accent-rgb), 0.6),
    0 10px 30px rgba(var(--accent-rgb), 0.32);
}

.voice-button svg {
  width: 66px;
  height: 66px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
}

.chat-form {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.attach-button,
.send-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
}

.attach-button svg {
  width: 27px;
  height: 27px;
}

.chat-form input {
  min-width: 0;
  height: 46px;
  flex: 1 1 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.chat-form input::placeholder {
  color: var(--muted);
  opacity: 0.62;
}

.chat-form input:focus {
  border-color: rgba(var(--accent-rgb), 0.7);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.send-button {
  font-size: 29px;
  font-weight: 300;
  line-height: 1;
}

.login-screen {
  display: flex;
  align-items: stretch;
  padding:
    calc(24px + env(safe-area-inset-top))
    18px
    calc(20px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at top right, rgba(var(--accent-rgb), 0.13), transparent 38%),
    var(--surface);
}

.login-content {
  display: flex;
  width: 100%;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
}

.login-brand {
  padding-top: clamp(18px, 9svh, 76px);
}

.eyebrow,
.access-label {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: clamp(54px, 18vw, 76px);
  letter-spacing: -0.08em;
}

.access-card,
.settings-card {
  width: 100%;
  padding: 20px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 22px;
  background: rgba(var(--surface-rgb), 0.98);
  box-shadow: 0 14px 34px rgba(49, 36, 71, 0.13);
}

.access-card h2,
.settings-head h2 {
  margin: 8px 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.access-text {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.access-form {
  display: grid;
  gap: 10px;
}

.access-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

.access-form input:focus {
  border-color: rgba(var(--accent-rgb), 0.72);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.access-form button {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.access-error {
  min-height: 17px;
  margin-bottom: 0;
  color: #dc3f4c;
  font-size: 13px;
  font-weight: 700;
}

.section-screen {
  position: absolute;
  inset: 0;
  padding:
    calc(18px + env(safe-area-inset-top))
    16px
    calc(18px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: var(--surface);
}

.section-head,
.settings-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-head {
  padding: 2px 0 16px;
}

.section-head h2 {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: -0.05em;
}

.section-finance {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 13px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
  cursor: pointer;
}

.section-finance svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.section-back,
.settings-close {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 13px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.section-back {
  flex: 0 0 42px;
}

.section-cards {
  display: grid;
  max-height: calc(100% - 62px);
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.section-card {
  padding: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.075), var(--surface));
  box-shadow: 0 8px 20px rgba(49, 36, 71, 0.075);
}

.section-card-meta {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-card h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: -0.03em;
}

.section-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.calendar {
  padding: 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(49, 36, 71, 0.075);
}

.calendar-nav {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.calendar-nav h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: -0.03em;
  text-align: center;
  text-transform: capitalize;
}

.calendar-arrow {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
  cursor: pointer;
  font-size: 22px;
}

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

.calendar-weekday {
  padding: 4px 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--ink);
  font-size: 13px;
}

.calendar-day.is-outside {
  color: var(--muted);
  opacity: 0.38;
}

.calendar-day.is-today {
  border-color: rgba(var(--accent-rgb), 0.42);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.28);
}

.settings-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  padding:
    16px
    16px
    calc(16px + env(safe-area-inset-bottom));
  background: var(--overlay);
  backdrop-filter: blur(8px);
}

.settings-head {
  justify-content: space-between;
}

.settings-head h2 {
  margin: 0;
}

.settings-label {
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.language-switch,
.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.language-button,
.theme-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.language-button.is-active,
.theme-button.is-active {
  border-color: rgba(var(--accent-rgb), 0.7);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

.accent-switch {
  display: flex;
  gap: 12px;
}

.accent-button {
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
}

.accent-button[data-accent="purple"] { background: #7c3aed; }
.accent-button[data-accent="blue"] { background: #2563eb; }
.accent-button[data-accent="green"] { background: #16a34a; }
.accent-button[data-accent="orange"] { background: #ea580c; }
.accent-button[data-accent="red"] { background: #dc2626; }

.accent-button.is-active {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-height: 620px) {
  .voice-button {
    width: 126px;
    height: 126px;
  }
}

@media (min-width: 700px) {
  .phone-app {
    box-shadow: 0 0 70px rgba(49, 36, 71, 0.13);
  }
}
