:root {
  --bg-deep: #0a0a0c;
  --bg-elevated: #121218;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f3f0;
  --text-muted: #8a8794;
  --accent: #e8c547;
  --accent-soft: rgba(232, 197, 71, 0.14);
  --accent-glow: rgba(232, 197, 71, 0.35);
  --success: #6ee7b7;
  --success-muted: rgba(110, 231, 183, 0.15);
  --danger: #f87171;
  --graph-bg: #0e0e12;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  --font: "Outfit", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.body--goal {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(232, 197, 71, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 100% 50%, rgba(120, 100, 200, 0.06), transparent),
    var(--bg-deep);
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.app--goal {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.goal-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.goal-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.65rem 1rem 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 18, 24, 0.92);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  z-index: 2;
}

.goal-topbar .goal-back {
  margin: 0;
  flex-shrink: 0;
}

.goal-topbar-main {
  flex: 1;
  min-width: 140px;
}

.goal-title-input {
  width: 100%;
  font-weight: 600;
  font-size: 1rem;
}

.goal-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.goal-meta {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  box-shadow: none;
}

.goal-meta.is-collapsed {
  display: none;
}

h1 {
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.subtitle {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.95rem;
  margin: 0 0 2rem;
}

.player-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: linear-gradient(145deg, rgba(232, 197, 71, 0.12), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(232, 197, 71, 0.25);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  margin: -0.3rem 0 1.15rem;
}

.player-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(232, 197, 71, 0.35), rgba(120, 100, 200, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.player-info {
  flex: 1;
  min-width: 180px;
}

.player-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.card-actions {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.player-level {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.55rem;
}

.player-xpbar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.player-xpbar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f5e6a8);
  box-shadow: 0 0 22px var(--accent-glow);
}

.player-xptext {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.player-stats {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.player-cats {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.55rem;
}

.cat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 24, 0.25);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}

.cat-row-title {
  font-weight: 900;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.cat-row-sub {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.78rem;
}

.cat-row-right {
  text-align: right;
  min-width: 140px;
}

.cat-row-level {
  font-weight: 900;
  color: var(--accent);
  font-size: 0.85rem;
}

.cat-row-xp {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  margin-top: 0.05rem;
}

.cat-row-bar {
  margin-top: 0.35rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cat-row-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f5e6a8);
}

.player-mini {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  background: linear-gradient(145deg, rgba(232, 197, 71, 0.10), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(232, 197, 71, 0.22);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  box-shadow: none;
}

.player-avatar--mini {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.player-mini-info {
  flex: 1;
}

.player-mini-name {
  font-weight: 750;
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.player-mini-level {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
}

.player-xpbar--mini {
  height: 8px;
}

.player-xpbar--mini .player-xpbar-fill {
  box-shadow: 0 0 16px var(--accent-glow);
}

.toast-item {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(18, 18, 24, 0.95);
  border: 1px solid rgba(232, 197, 71, 0.25);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.toast-item.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0px);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 999px;
}

.modal--player-profile {
  max-width: 920px;
}

.player-profile {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.player-profile-left {
  width: 260px;
  flex-shrink: 0;
}

.player-photo-frame {
  width: 220px;
  height: 220px;
  border-radius: 18px;
  border: 1px solid rgba(232, 197, 71, 0.25);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
}

.player-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-photo-placeholder {
  font-weight: 900;
  font-size: 2rem;
  color: var(--accent);
  text-shadow: 0 0 22px var(--accent-glow);
}

.player-photo-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.player-photo-upload {
  cursor: pointer;
}

.player-profile-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0.75rem 0 0;
}

.player-profile-right {
  flex: 1;
  min-width: 260px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 860px) {
  .player-profile {
    flex-direction: column;
  }
  .player-profile-right {
    grid-template-columns: 1fr;
  }
}

.player-subpanel {
  margin-top: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.player-subpanel-title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
}

.player-habit-columns {
  margin-top: 0.5rem;
}

.habit-card {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 24, 0.25);
  padding: 0.9rem 0.95rem;
}

.habit-card--neg {
  border-color: rgba(248, 113, 113, 0.25);
}

.habit-card-title {
  font-weight: 800;
  margin-bottom: 0.7rem;
}

.habit-add {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.habit-add .input {
  flex: 1;
}

.habit-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.habit-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}

.habit-text {
  flex: 1;
  font-weight: 650;
  color: var(--text);
  word-break: break-word;
}

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(145deg, #f0d56a, var(--accent));
  color: #1a1608;
  border-color: transparent;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.05);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.home-empty-wrap {
  min-height: 120px;
}

.category-section {
  margin-bottom: 1.25rem;
}

.category-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 860px) {
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.category-card {
  font-family: inherit;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.9rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.2s, background 0.15s;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
}

.category-card:hover {
  border-color: rgba(232, 197, 71, 0.35);
  transform: translateY(-2px);
}

.category-card.is-active {
  border-color: rgba(232, 197, 71, 0.62);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 18px 52px rgba(0, 0, 0, 0.28);
}

.category-card-title {
  font-size: 0.98rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
  line-height: 1.25;
}

.category-card-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.95;
}

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* --- Ежедневный план (главная и редактор) --- */
.daily-block {
  margin: -0.2rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.1rem;
}

.daily-block-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.daily-block-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-end;
}

@media (max-width: 860px) {
  .daily-block-actions {
    align-items: flex-start;
  }
}

.daily-block-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.daily-block-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

.daily-day-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 860px) {
  .daily-day-chips {
    justify-content: flex-start;
  }
}

.day-chip {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.day-chip:hover {
  border-color: rgba(232, 197, 71, 0.35);
}

.day-chip.is-active {
  border-color: rgba(232, 197, 71, 0.65);
  background: rgba(232, 197, 71, 0.14);
}

.daily-block-items {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.daily-reflection {
  margin: 0.75rem 0 0.85rem;
}

.daily-reflection-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.daily-reflection-input {
  min-height: 64px;
}

.daily-empty {
  padding: 1rem 0.25rem;
  color: var(--text-muted);
}

.daily-empty-title {
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.daily-empty-sub {
  font-weight: 600;
  font-size: 0.82rem;
}

.daily-home-item {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 24, 0.25);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.daily-home-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.daily-home-text {
  flex: 1;
  min-width: 0;
}

.daily-home-title {
  font-weight: 850;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.daily-home-sub {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.82rem;
  word-break: break-word;
}

/* Editor page */
.daily-editor {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.daily-editor-left {
  flex: 1;
  min-width: 320px;
}

.daily-editor-right {
  flex: 1.25;
  min-width: 360px;
}

@media (max-width: 980px) {
  .daily-editor {
    flex-direction: column;
  }
}

.daily-panel {
  height: 100%;
}

.daily-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.daily-panel-title {
  margin: 0;
}

.daily-panel-hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.daily-item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 24, 0.25);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.daily-item-main {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.daily-item-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.daily-item-text {
  min-width: 0;
}

.daily-item-title {
  font-weight: 900;
  margin-bottom: 0.15rem;
}

.daily-item-sub {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.82rem;
  word-break: break-word;
}

.daily-muted {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.3rem 0;
}

.daily-sources {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.daily-goal-panel {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
}

.daily-goal-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.daily-goal-title {
  font-weight: 950;
}

.daily-goal-meta {
  color: var(--text-muted);
  font-weight: 650;
  font-size: 0.82rem;
}

.daily-goal-nodes {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.daily-source-node {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(18, 18, 24, 0.22);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}

.daily-source-node-text {
  min-width: 0;
  flex: 1;
}

.daily-source-node-label {
  font-weight: 850;
  word-break: break-word;
}

.daily-source-add:disabled {
  opacity: 0.55;
}

.days-list {
  display: grid;
  gap: 0.75rem;
}

.day-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(18, 18, 24, 0.25);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}

.day-card:hover {
  border-color: rgba(232, 197, 71, 0.35);
  transform: translateY(-1px);
}

.day-card.is-today {
  border-color: rgba(232, 197, 71, 0.55);
  background: rgba(232, 197, 71, 0.08);
}

.day-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.day-card-title {
  font-weight: 950;
}

.day-card-meta {
  color: var(--text-muted);
  font-weight: 750;
  font-size: 0.82rem;
}

.day-card-ref {
  color: rgba(244, 243, 240, 0.92);
  font-weight: 650;
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}

.day-card-ref--muted {
  color: var(--text-muted);
}


.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow);
}

.goal-card:hover {
  border-color: rgba(232, 197, 71, 0.35);
  transform: translateY(-2px);
}

.goal-card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
  line-height: 1.3;
}

.goal-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge-active {
  color: var(--success);
  border-color: rgba(110, 231, 183, 0.35);
  background: var(--success-muted);
}

.badge-done {
  color: var(--accent);
  border-color: rgba(232, 197, 71, 0.4);
  background: var(--accent-soft);
}

.badge-paused {
  color: var(--text-muted);
}

.badge-priority-high {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.35);
}

.badge-priority-medium {
  color: #fcd34d;
}

.badge-priority-low {
  color: var(--text-muted);
}

.badge-category {
  color: var(--accent);
  border-color: rgba(232, 197, 71, 0.42);
  background: rgba(232, 197, 71, 0.12);
}

.goal-card-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.goal-card-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f5e6a8);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.goal-card-footer {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.back-link:hover {
  color: var(--accent);
}

.detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.input,
.textarea,
.select {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: rgba(232, 197, 71, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .row-2 {
    grid-template-columns: 1fr;
  }
}

.graph-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.graph-section--fill {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  box-shadow: none;
}

.graph-section--fill .graph-section-header {
  flex-shrink: 0;
}

.graph-section--fill .graph-viewport {
  flex: 1;
  min-height: 200px;
  height: auto;
}

.graph-section--fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 50 !important;
  border: none !important;
  border-radius: 0 !important;
  max-height: none !important;
  box-shadow: none !important;
}

.graph-section--fullscreen .graph-viewport {
  flex: 1;
  min-height: 0;
  height: auto;
}

.graph-fullscreen-exit {
  display: none;
  flex-shrink: 0;
}

.graph-section--fullscreen .graph-fullscreen-exit {
  display: inline-flex;
}

.graph-hint--inline {
  margin: 0.25rem 0 0;
  max-width: none;
  font-size: 0.78rem;
  line-height: 1.35;
}

.graph-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.graph-section-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.graph-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.4;
}

.graph-viewport {
  position: relative;
  height: min(72vh, 640px);
  background: var(--graph-bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 24px 24px;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
}

.graph-viewport.is-panning {
  cursor: grabbing;
}

.graph-canvas {
  position: absolute;
  left: 0;
  top: 0;
  /* width/height задаёт graph-editor.js под логические границы графа */
  transform-origin: 0 0;
  will-change: transform;
  overflow: visible;
}

.graph-edges {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.graph-edges .edge-hit {
  pointer-events: stroke;
  cursor: pointer;
}

.graph-edges .edge-hit:hover + .edge-line,
.graph-edges .edge-line:hover {
  stroke: rgba(232, 197, 71, 0.85);
  stroke-width: 2.5;
}

.graph-node {
  position: absolute;
  width: 200px;
  min-height: 76px;
  background: linear-gradient(165deg, #1e1e2a, #16161f);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0.65rem 1.1rem 0.65rem 0.85rem;
  cursor: grab;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.graph-node:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.graph-node.is-selected {
  border-color: rgba(232, 197, 71, 0.55);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 12px 32px rgba(0, 0, 0, 0.45);
}

.graph-node.is-done {
  opacity: 0.72;
}

.graph-node.is-done .graph-node-label {
  text-decoration: line-through;
  color: var(--text-muted);
}

.graph-node-label {
  font-size: 0.88rem;
  line-height: 1.35;
  font-weight: 500;
  padding-right: 0.25rem;
  word-break: break-word;
}

.graph-node-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.graph-node-del {
  display: none;
  position: absolute;
  bottom: 6px;
  right: 6px;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  cursor: pointer;
  z-index: 3;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.graph-node-del:hover {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fecaca;
}

.graph-node.is-selected .graph-node-del {
  display: flex;
}

.node-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid rgba(232, 197, 71, 0.65);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  cursor: crosshair;
  pointer-events: auto;
  box-sizing: border-box;
}

.node-handle-in {
  left: -11px;
}

.node-handle-out {
  right: -11px;
}

.node-handle:hover {
  background: var(--accent-soft);
  transform: translateY(-50%) scale(1.1);
}

.graph-connector-line {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

.modal-root:empty {
  display: none;
}

.modal-backdrop {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.35rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.modal h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state p {
  margin: 0 0 1rem;
}

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

.auth-shell {
  display: flex;
  justify-content: center;
}

.auth-panel {
  width: 100%;
  max-width: 560px;
}

.auth-tabs {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.25rem;
}

.auth-status {
  min-height: 1.25rem;
  margin: -0.1rem 0 0.9rem;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 650;
}

.auth-hint {
  margin-top: 1rem;
}

.auth-loading {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 650;
}

.account-dock {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(232, 197, 71, 0.18);
  background: rgba(18, 18, 24, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  z-index: 120;
}

.account-dock-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.12rem;
}

.account-dock-value {
  font-size: 0.88rem;
  font-weight: 750;
}

@media (max-width: 720px) {
  .auth-tabs {
    flex-direction: column;
  }

  .account-dock {
    left: 12px;
    right: 12px;
    bottom: 12px;
    justify-content: space-between;
  }
}
