.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, border-color var(--speed) ease;
}

.sections-grid > .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.12);
  border-color: color-mix(in srgb, var(--border) 75%, #7f77dd 25%);
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  font-size: 1.06em;
  opacity: 0.9;
  flex-shrink: 0;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn.primary {
  background: var(--brand-gradient-cta);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--brand-shadow-cta);
}

.btn:hover {
  transform: translateY(-1px);
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-size: 12px;
  background: rgba(127, 119, 221, 0.08);
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent);
  box-shadow: var(--shadow-soft);
  transition: transform var(--speed) ease, border-color var(--speed) ease;
}

.item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--border) 75%, #7f77dd 25%);
}

.item.done {
  opacity: 0.6;
  text-decoration: line-through;
  transform: scale(0.99);
}

.item.overdue {
  background: linear-gradient(180deg, rgba(212, 83, 126, 0.12), transparent), var(--card);
  border-color: color-mix(in srgb, var(--border) 65%, #d4537e 35%);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(127, 119, 221, 0.18);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  transition: width 320ms ease;
}

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

.kanban-col {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  min-height: 140px;
  background: rgba(127, 119, 221, 0.05);
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(10, 12px);
  gap: 4px;
}

.heat {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(29, 158, 117, 0.15);
}

.heat.active {
  background: var(--sport);
}

@media (max-width: 767px) {
  .kanban {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kanban-col {
    min-height: 96px;
  }

  .heatmap {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    width: 100%;
    gap: 3px;
  }

  .heat {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
  }

  .sections-grid > .card:hover {
    transform: none;
  }

  .item:hover {
    transform: none;
  }
}

.gp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 30, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  backdrop-filter: blur(6px);
  z-index: 1200;
}

.gp-modal {
  width: min(440px, calc(100vw - 22px));
  max-height: min(90vh, 720px);
  margin: 0 auto;
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 12px;
  overflow: auto;
  animation: modal-in 180ms ease;
}

.gp-modal.gp-modal-wide {
  width: min(620px, calc(100vw - 22px));
  max-height: min(92vh, 780px);
}

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

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

.field-row .field {
  margin: 0;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  font-size: 14px;
  min-height: 40px;
  width: 100%;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.gp-modal h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.gp-modal .btn {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
}

.gp-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 2px;
}

.gp-modal-head-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--icon-accent);
  background: var(--icon-accent-bg);
  flex-shrink: 0;
}

.gp-modal-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.gp-modal .field > span {
  font-size: 13px;
  font-weight: 600;
}

.gp-modal .field-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.gp-modal .field-checkbox > span {
  font-weight: 500;
  font-size: 13px;
  order: 2;
}

.gp-modal .field-checkbox input[type="checkbox"] {
  order: 1;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.gp-modal .field-file {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  width: 100%;
  font-size: 13px;
}

.profile-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  position: relative;
}

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

.profile-file-trigger {
  flex-shrink: 0;
}

.profile-file-name {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Профиль: подписка (отдельный блок) */
.profile-sub-v2 {
  margin-top: 6px;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 70%, rgba(127, 119, 221, 0.35) 30%);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--card) 92%, rgba(127, 119, 221, 0.14) 8%) 0%,
    color-mix(in srgb, var(--card) 96%, rgba(55, 138, 221, 0.08) 4%) 100%
  );
  box-shadow: 0 12px 36px rgba(55, 138, 221, 0.12);
}

[data-theme="dark"] .profile-sub-v2 {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.profile-sub-v2-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, rgba(127, 119, 221, 0.2) 20%);
  background: color-mix(in srgb, var(--card) 88%, rgba(127, 119, 221, 0.06) 12%);
}

.profile-sub-v2-head i {
  font-size: 1.1rem;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px color-mix(in srgb, var(--books) 35%, transparent));
}

.profile-sub-v2-hero {
  position: relative;
  padding: 16px 16px 18px;
  margin: 12px 12px 0;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--border) 65%, rgba(127, 119, 221, 0.45) 35%);
  background: radial-gradient(120% 80% at 10% 0%, rgba(127, 119, 221, 0.18), transparent 55%),
    radial-gradient(100% 70% at 100% 100%, rgba(55, 138, 221, 0.14), transparent 50%),
    color-mix(in srgb, var(--card) 94%, transparent);
}

.profile-sub-v2-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.profile-sub-v2-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-sub-v2-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #12b76a, #0d9e6a);
  box-shadow: 0 4px 12px rgba(18, 183, 106, 0.35);
}

.profile-sub-v2-hero-title {
  font-size: 1.15rem;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--text);
}

.profile-sub-v2-hero-lead {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

.profile-sub-v2-caption {
  margin: 16px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-sub-v2-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

@media (max-width: 520px) {
  .profile-sub-v2-grid {
    grid-template-columns: 1fr;
  }
}

.profile-sub-v2-card {
  position: relative;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 96%, transparent);
  text-align: center;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.profile-sub-v2-card:hover {
  border-color: color-mix(in srgb, var(--border) 55%, #7f77dd 45%);
}

.profile-sub-v2-card.is-current {
  border-color: color-mix(in srgb, #7f77dd 55%, var(--border) 45%);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--card) 82%, rgba(127, 119, 221, 0.2) 18%),
    color-mix(in srgb, var(--card) 90%, rgba(55, 138, 221, 0.12) 10%)
  );
  box-shadow: 0 0 0 2px color-mix(in srgb, #7f77dd 35%, transparent), 0 8px 22px rgba(55, 138, 221, 0.18);
  transform: translateY(-1px);
}

.profile-sub-v2-card-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: #fff;
  background: var(--brand-gradient);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--books) 30%, transparent);
}

.profile-sub-v2-card.is-current .profile-sub-v2-card-icon {
  box-shadow: 0 8px 20px rgba(55, 138, 221, 0.45);
}

.profile-sub-v2-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 4px;
}

.profile-sub-v2-card-price {
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.02em;
}

.profile-sub-v2-card-price--accent {
  font-size: 14px;
  background: linear-gradient(135deg, #12b76a, #378add);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.profile-sub-v2-card-hint {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f79009;
}

.profile-sub-v2-foot {
  margin: 0;
  padding: 10px 14px 14px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  border-top: 1px dashed color-mix(in srgb, var(--border) 85%, rgba(127, 119, 221, 0.2) 15%);
}

.tag-input-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--card) 90%, #7f77dd 10%);
}

.tag-input-wrap i {
  color: var(--muted);
  font-size: 13px;
}

.tag-editor-main {
  width: 100%;
  display: grid;
  gap: 7px;
}

.tag-input-wrap input[type="text"] {
  border: 0;
  background: transparent;
  color: var(--text);
  width: 100%;
  padding: 2px 0;
  outline: none;
}

/* Flatpickr stability */
.flatpickr-input[readonly] {
  width: 100%;
  min-height: 40px;
}

.flatpickr-alt-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
}

.flatpickr-calendar {
  z-index: 1300;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-size: 13px;
}

.tag-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-hint {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(127, 119, 221, 0.08);
}

.tag-hint-live {
  background: rgba(127, 119, 221, 0.16);
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 60%, #7f77dd 40%);
}

.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(127, 119, 221, 0.1);
}

.task-tag-chip i {
  font-size: 10px;
}

.gp-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.gp-btn-cancel i,
.gp-btn-save i {
  font-size: 12px;
}

@media (max-width: 767px) {
  .gp-modal.gp-modal-wide {
    width: min(440px, calc(100vw - 16px));
  }
  .field-row {
    grid-template-columns: 1fr;
  }
}

[data-theme="dark"] .gp-modal-head-icon {
  color: var(--icon-accent);
  background: var(--icon-accent-bg);
}

@keyframes modal-in {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border: 1px solid transparent;
}

.priority-high {
  color: #b42318;
  background: rgba(217, 45, 32, 0.1);
  border-color: rgba(217, 45, 32, 0.25);
}

.priority-medium {
  color: #b54708;
  background: rgba(247, 144, 9, 0.12);
  border-color: rgba(247, 144, 9, 0.28);
}

.priority-low {
  color: #027a48;
  background: rgba(18, 183, 106, 0.12);
  border-color: rgba(18, 183, 106, 0.28);
}

.toast {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: auto;
  max-width: min(420px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  background: #172033;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: toast-in 220ms ease;
}

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