@font-face {
  font-family: "Manrope";
  src: url("/assets/manrope.ttf") format("truetype");
  font-display: swap;
  font-weight: 200 800;
}

:root {
  --bg: #0b0a0d;
  --surface: rgba(27, 25, 31, 0.92);
  --surface-solid: #1b191f;
  --surface-raised: #24212a;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f6f3f8;
  --muted: #a8a2b0;
  --purple: #8c52ff;
  --purple-soft: rgba(140, 82, 255, 0.15);
  --green: #6ee7a8;
  --red: #ff7c8b;
  --radius: 22px;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -5%, rgba(117, 61, 226, 0.18), transparent 36%),
    linear-gradient(180deg, #0d0c10 0%, #0a090c 100%);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.14;
  pointer-events: none;
}

.ambient-one {
  top: 16%;
  right: -140px;
  background: #8c52ff;
}

.ambient-two {
  bottom: 20%;
  left: -170px;
  background: #44307e;
}

.app-shell {
  width: min(100%, 780px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px calc(104px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: max(10px, env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(180deg, rgba(11, 10, 13, 0.98) 65%, transparent);
  backdrop-filter: blur(16px);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  background: #fff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar-copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.icon-button,
.round-add {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 24px;
}

.round-add {
  border-color: transparent;
  border-radius: 50%;
  background: var(--purple);
}

.view {
  display: none;
  animation: view-in 180ms ease-out;
}

.view.active {
  display: block;
}

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

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(27px, 8vw, 42px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.hero-card {
  position: relative;
  display: flex;
  min-height: 280px;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  margin: 8px 0 24px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 90% 12%, rgba(153, 92, 255, 0.5), transparent 40%),
    linear-gradient(145deg, #2d2442, #17141d 62%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
}

.hero-card::after {
  position: absolute;
  right: -35px;
  bottom: -65px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 35px rgba(255, 255, 255, 0.025), 0 0 0 70px rgba(255, 255, 255, 0.02);
}

.hero-card h1 {
  max-width: 440px;
  margin-top: 22px;
}

.hero-card p {
  max-width: 430px;
  margin-bottom: 24px;
  color: #c7c0ce;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.pill-purple {
  border-color: rgba(184, 145, 255, 0.35);
  color: #d6bfff;
  background: rgba(140, 82, 255, 0.16);
}

.primary-button,
.secondary-button,
.danger-aware-button {
  position: relative;
  z-index: 1;
  min-height: 50px;
  padding: 0 20px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 750;
  transition: transform 140ms ease, opacity 140ms ease;
}

.primary-button:active,
.secondary-button:active,
.danger-aware-button:active,
.quick-card:active,
.stat-card:active {
  transform: scale(0.98);
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #935eff, #7040d8);
  box-shadow: 0 12px 30px rgba(116, 63, 222, 0.28);
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-raised);
}

.danger-aware-button {
  background: #f3eef9;
  color: #17131d;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 26px 2px 15px;
}

.section-heading h1,
.section-heading h2 {
  margin-top: 4px;
}

.section-heading.compact {
  margin-top: 8px;
}

.muted,
.section-intro {
  color: var(--muted);
  font-size: 13px;
}

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

.stat-card {
  display: flex;
  min-height: 112px;
  cursor: pointer;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: var(--surface);
  text-align: left;
}

.stat-card.accent {
  border-color: rgba(140, 82, 255, 0.35);
  background: linear-gradient(145deg, rgba(140, 82, 255, 0.19), rgba(32, 27, 39, 0.95));
}

.stat-value {
  color: var(--text);
  font-size: 34px;
  font-weight: 760;
  letter-spacing: -0.05em;
}

.quick-grid {
  display: grid;
  gap: 10px;
  margin: 22px 0 28px;
}

.quick-card {
  display: flex;
  min-height: 76px;
  cursor: pointer;
  align-items: center;
  gap: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.quick-card > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quick-card small {
  color: var(--muted);
}

.quick-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: #dac7ff;
  background: var(--purple-soft);
  font-size: 22px;
}

.panel-block {
  padding-top: 5px;
}

.stack-list,
.card-list,
.timeline {
  display: grid;
  gap: 12px;
}

.content-card,
.confirmation-card,
.timeline-card,
.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.content-card h3,
.timeline-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.content-card p,
.timeline-card p,
.confirmation-card p {
  overflow: hidden;
  margin: 0;
  color: #c5c0ca;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.card-top,
.card-meta,
.card-actions,
.confirmation-actions,
.timeline-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-top,
.timeline-top {
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-meta {
  flex-wrap: wrap;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.card-actions,
.confirmation-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.small-button,
.text-button {
  min-height: 36px;
  padding: 0 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
}

.small-button.primary {
  border-color: rgba(140, 82, 255, 0.4);
  color: #dfd0ff;
  background: var(--purple-soft);
}

.small-button.danger {
  color: #ffabb5;
}

.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.empty-state {
  padding: 34px 22px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
}

.notice {
  margin: 12px 0;
  padding: 13px 15px;
  border: 1px solid rgba(140, 82, 255, 0.25);
  border-radius: 15px;
  color: #d4c9df;
  background: rgba(140, 82, 255, 0.09);
  font-size: 12px;
  line-height: 1.5;
}

.notice-error {
  border-color: rgba(255, 124, 139, 0.35);
  color: #ffc1c8;
  background: rgba(255, 124, 139, 0.1);
}

.hidden {
  display: none !important;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 17px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.03);
}

.segment {
  min-height: 40px;
  cursor: pointer;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.segment.active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.18);
}

.calendar-pane {
  display: none;
}

.calendar-pane.active {
  display: block;
}

.form-card {
  display: grid;
  gap: 15px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  display: grid;
  gap: 7px;
}

label > span,
.field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

input,
select {
  min-height: 48px;
  padding: 0 13px;
}

textarea {
  min-height: 110px;
  padding: 13px;
  resize: vertical;
  line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
  color: #6f6976;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timeline-card {
  position: relative;
  margin-left: 13px;
}

.timeline-card::before {
  position: absolute;
  top: 23px;
  left: -20px;
  width: 10px;
  height: 10px;
  border: 3px solid var(--bg);
  border-radius: 50%;
  background: var(--purple);
  content: "";
  box-shadow: 0 0 0 1px var(--purple);
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 10px;
  bottom: 8px;
  left: 10px;
  display: grid;
  max-width: 760px;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin: 0 auto;
  padding: 8px 8px var(--safe-bottom);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: rgba(25, 23, 29, 0.94);
  box-shadow: 0 -12px 45px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(22px);
}

.nav-button {
  display: flex;
  min-width: 0;
  min-height: 52px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 15px;
  color: #77717f;
  background: transparent;
}

.nav-button span {
  font-size: 19px;
}

.nav-button small {
  overflow: hidden;
  max-width: 100%;
  font-size: 9px;
  text-overflow: ellipsis;
}

.nav-button.active {
  color: #d8c4ff;
  background: rgba(140, 82, 255, 0.1);
}

.nav-create span {
  display: grid;
  width: 38px;
  height: 38px;
  margin-top: -24px;
  place-items: center;
  border: 4px solid #19171d;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, #9b68ff, #7241db);
  box-shadow: 0 8px 22px rgba(123, 68, 223, 0.36);
  font-size: 24px;
}

dialog {
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(6px);
}

.sheet-dialog {
  width: min(100%, 780px);
  max-width: none;
  max-height: 94vh;
  margin: auto auto 0;
}

.sheet {
  display: grid;
  max-height: 94vh;
  overflow-y: auto;
  gap: 16px;
  padding: 12px 18px calc(24px + var(--safe-bottom));
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: #17151b;
  box-shadow: 0 -30px 80px rgba(0, 0, 0, 0.46);
}

.compact-dialog .sheet {
  padding-bottom: calc(26px + var(--safe-bottom));
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 2px;
  border-radius: 999px;
  background: #49434f;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-header h2 {
  margin-top: 4px;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
}

.editor-toolbar button {
  min-width: 40px;
  height: 36px;
  padding: 0 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.char-counter {
  justify-self: end;
  color: var(--muted);
}

.preview-wrap {
  display: grid;
  gap: 8px;
}

.telegram-preview {
  min-height: 100px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 18px 18px 18px 5px;
  color: #f1edf3;
  background: #2a2730;
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.telegram-preview a {
  color: #9ecbff;
}

.upload-zone {
  display: flex;
  min-height: 78px;
  cursor: pointer;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px dashed rgba(177, 144, 241, 0.4);
  border-radius: 17px;
  background: rgba(140, 82, 255, 0.06);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upload-zone small {
  color: var(--muted);
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--purple-soft);
  font-size: 24px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.media-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 13px;
  background: #2a2730;
}

.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 28px;
  height: 28px;
  cursor: pointer;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
}

.toggle-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
}

.toggle-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 14px;
}

.toggle-row + .toggle-row {
  border-top: 1px solid var(--line);
}

.toggle-row > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
}

.toggle-row small {
  color: var(--muted);
  font-weight: 400;
}

.toggle-row input {
  width: 44px;
  min-height: 24px;
  accent-color: var(--purple);
}

.sheet-actions {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 9px;
}

.center-dialog {
  width: min(calc(100% - 30px), 430px);
  margin: auto;
}

.confirm-card {
  display: grid;
  gap: 12px;
  padding: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: #1a171f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 16px;
  color: #dac7ff;
  background: var(--purple-soft);
  font-size: 23px;
}

.confirm-card p {
  max-height: 220px;
  overflow-y: auto;
  color: #c5bfca;
  line-height: 1.55;
  white-space: pre-wrap;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.toast {
  position: fixed;
  z-index: 100;
  top: calc(18px + env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 30px), 520px);
  padding: 13px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #2a2630;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.38);
  font-size: 13px;
  text-align: center;
}

.toast.success {
  border-color: rgba(110, 231, 168, 0.35);
}

.toast.error {
  border-color: rgba(255, 124, 139, 0.4);
}

@media (min-width: 640px) {
  .app-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .quick-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-card {
    min-height: 330px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
