:root {
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-strong: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-border-strong: rgba(255, 255, 255, 0.28);
  --glass-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.55),
    0 4px 20px -4px rgba(0, 0, 0, 0.35);
  --glass-inner: inset 0 1px 0 0 rgba(255, 255, 255, 0.25);
  --text: #f5f7ff;
  --text-dim: rgba(245, 247, 255, 0.7);
  --text-faint: rgba(245, 247, 255, 0.45);
  --accent: #8b6bff;
  --accent-2: #4fc1ff;
  --accent-3: #ff7ec8;
  --ok: #5df6b0;
  --warn: #ffd36b;
  --err: #ff7a8a;
  --radius: 20px;
  --radius-sm: 12px;
  --blur: 22px;

  --body-bg-base: #0a0f22;
  --body-bg:
    radial-gradient(1200px 700px at 10% -10%, #2a1b6b 0%, transparent 60%),
    radial-gradient(1000px 600px at 110% 10%, #0c4c7a 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 120%, #5b1b6b 0%, transparent 55%),
    linear-gradient(180deg, #0a0f22 0%, #0b0d1f 100%);

  --blob-a: radial-gradient(circle, #8b6bff, transparent 70%);
  --blob-b: radial-gradient(circle, #4fc1ff, transparent 70%);
  --blob-c: radial-gradient(circle, #ff7ec8, transparent 70%);
  --blob-d: radial-gradient(circle, #5df6b0, transparent 70%);
  --blob-opacity: 0.55;
  --blob-blend: screen;

  --input-bg: rgba(255, 255, 255, 0.06);
  --input-bg-focus: rgba(255, 255, 255, 0.09);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --stat-value-gradient: linear-gradient(135deg, #fff, #cbd8ff);
  --toast-bg: rgba(22, 26, 48, 0.85);
  --scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.2);
  --modal-backdrop: rgba(8, 10, 22, 0.55);
  --note-ok-bg: rgba(93, 246, 176, 0.12);
  --note-ok-border: rgba(93, 246, 176, 0.3);
  --note-err-bg: rgba(255, 122, 138, 0.12);
  --note-err-border: rgba(255, 122, 138, 0.35);
}

:root[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-strong: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-border-strong: rgba(139, 107, 255, 0.35);
  --glass-shadow: 0 18px 50px -20px rgba(90, 60, 200, 0.2),
    0 4px 18px -6px rgba(90, 60, 200, 0.1);
  --glass-inner: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  --text: #1a1d35;
  --text-dim: rgba(26, 29, 53, 0.65);
  --text-faint: rgba(26, 29, 53, 0.45);
  --accent: #6b4fff;
  --accent-2: #2c9cff;
  --accent-3: #ff5fa6;
  --ok: #0e9f63;
  --warn: #c87800;
  --err: #d63752;

  --body-bg-base: #f5f3ff;
  --body-bg:
    radial-gradient(1200px 700px at 10% -10%, #e4d7ff 0%, transparent 55%),
    radial-gradient(1000px 600px at 110% 10%, #d4ebff 0%, transparent 55%),
    radial-gradient(900px 700px at 50% 120%, #ffdcec 0%, transparent 55%),
    linear-gradient(180deg, #f8f7ff 0%, #eeeaff 100%);

  --blob-a: radial-gradient(circle, #c5b3ff, transparent 70%);
  --blob-b: radial-gradient(circle, #a0d6ff, transparent 70%);
  --blob-c: radial-gradient(circle, #ffb5d6, transparent 70%);
  --blob-d: radial-gradient(circle, #b6f0d4, transparent 70%);
  --blob-opacity: 0.7;
  --blob-blend: multiply;

  --input-bg: rgba(255, 255, 255, 0.75);
  --input-bg-focus: rgba(255, 255, 255, 0.95);
  --chip-bg: rgba(255, 255, 255, 0.55);
  --stat-value-gradient: linear-gradient(135deg, #3a2e8a, #1b5fc9);
  --toast-bg: rgba(255, 255, 255, 0.95);
  --scrollbar-thumb: rgba(80, 70, 140, 0.25);
  --scrollbar-thumb-hover: rgba(80, 70, 140, 0.4);
  --modal-backdrop: rgba(100, 90, 180, 0.28);
  --note-ok-bg: rgba(14, 159, 99, 0.1);
  --note-ok-border: rgba(14, 159, 99, 0.35);
  --note-err-bg: rgba(214, 55, 82, 0.1);
  --note-err-border: rgba(214, 55, 82, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--body-bg-base);
  color: var(--text);
  font-family: "Vazirmatn", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--body-bg);
}

.bg-mesh {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--blob-opacity);
  mix-blend-mode: var(--blob-blend);
  animation: float 22s ease-in-out infinite;
}

.blob-a {
  width: 520px;
  height: 520px;
  background: var(--blob-a);
  top: -120px;
  right: -80px;
  animation-delay: 0s;
}

.blob-b {
  width: 460px;
  height: 460px;
  background: var(--blob-b);
  bottom: -140px;
  right: 20%;
  animation-delay: -6s;
}

.blob-c {
  width: 420px;
  height: 420px;
  background: var(--blob-c);
  top: 30%;
  left: -100px;
  animation-delay: -12s;
}

.blob-d {
  width: 360px;
  height: 360px;
  background: var(--blob-d);
  bottom: 10%;
  left: 25%;
  animation-delay: -18s;
  opacity: calc(var(--blob-opacity) * 0.65);
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(40px, -30px) scale(1.08);
  }
  66% {
    transform: translate(-30px, 40px) scale(0.95);
  }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}

.header {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, background 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  transform: translateY(-1px) rotate(-10deg);
  border-color: var(--glass-border-strong);
}

.theme-toggle:active {
  transform: translateY(0) rotate(0);
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 26px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 10px 30px -10px rgba(139, 107, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: white;
}

.titles h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.titles p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-weight: 700;
  font-size: 18px;
  background: var(--stat-value-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card {
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.card-head.between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

.tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: linear-gradient(135deg, rgba(139, 107, 255, 0.35), rgba(79, 193, 255, 0.25));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 6px 18px -10px rgba(139, 107, 255, 0.9);
}

.row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus {
  border-color: rgba(139, 107, 255, 0.7);
  background: var(--input-bg-focus);
  box-shadow: 0 0 0 4px rgba(139, 107, 255, 0.18);
}

input::placeholder {
  color: var(--text-faint);
}

input[type="time"] {
  max-width: 140px;
  font-variant-numeric: tabular-nums;
}

input[type="number"] {
  max-width: 120px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--chip-bg);
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.chip:hover {
  border-color: var(--glass-border-strong);
  color: var(--text);
}

.chip.active {
  background: linear-gradient(135deg, rgba(139, 107, 255, 0.4), rgba(79, 193, 255, 0.3));
  border-color: rgba(139, 107, 255, 0.6);
  color: #fff;
  box-shadow: 0 6px 20px -8px rgba(139, 107, 255, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chip.small {
  padding: 7px 10px;
  font-size: 12px;
}

.chip.test-chip {
  background: rgba(255, 189, 89, 0.12);
  border-color: rgba(255, 189, 89, 0.35);
  color: #ffd89a;
}
.chip.test-chip.active {
  background: linear-gradient(135deg, rgba(255, 189, 89, 0.5), rgba(255, 140, 80, 0.35));
  border-color: rgba(255, 189, 89, 0.7);
  color: #fff;
  box-shadow: 0 6px 20px -8px rgba(255, 189, 89, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.time-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-strong);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--glass-border-strong);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, #8b6bff 0%, #4fc1ff 100%);
  border-color: rgba(139, 107, 255, 0.7);
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(139, 107, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.primary:hover {
  box-shadow: 0 16px 40px -12px rgba(139, 107, 255, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  background: linear-gradient(135deg, rgba(255, 122, 138, 0.9), rgba(255, 78, 142, 0.7));
  border-color: rgba(255, 122, 138, 0.5);
  color: #fff;
}

.icon-btn {
  padding: 8px 12px;
  font-weight: 600;
}

.note {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--note-ok-bg);
  border: 1px solid var(--note-ok-border);
  font-size: 13px;
  color: var(--ok);
}

.note.err {
  background: var(--note-err-bg);
  border-color: var(--note-err-border);
  color: var(--err);
}

.tasks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.task {
  padding: 14px;
  border-radius: 16px;
  background: var(--chip-bg);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.2s;
}

.task:hover {
  background: var(--glass-bg-strong);
}

.task.inactive {
  opacity: 0.55;
}

.task-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.task-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.task-meta .badge {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.task-meta .badge.accent {
  background: linear-gradient(135deg, rgba(139, 107, 255, 0.25), rgba(79, 193, 255, 0.2));
  border-color: rgba(139, 107, 255, 0.45);
  color: #e6e0ff;
}

.task-next {
  font-size: 12px;
  color: var(--text-faint);
}

.task-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.task-actions .btn {
  padding: 8px 12px;
  font-size: 13px;
}

.logs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.log-item {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--chip-bg);
  border: 1px solid var(--glass-border);
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.log-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.log-status.ok   { background: var(--ok); }
.log-status.err  { background: var(--err); }
.log-status.skip { background: var(--warn); }

.log-time {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-msg {
  flex: 1;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  font-size: 12px;
  color: var(--text-faint);
}

.foot .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rise 0.22s ease-out;
}

@keyframes rise {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-head {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
}

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

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.modal-foot {
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--glass-border);
}

.icon-btn.close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--toast-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--glass-shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  z-index: 60;
  animation: rise 0.22s ease-out;
  max-width: 90%;
}

.toast.err {
  color: var(--err);
  border-color: rgba(255, 122, 138, 0.4);
}

.toast.ok {
  color: var(--ok);
  border-color: rgba(93, 246, 176, 0.4);
}

@media (max-width: 520px) {
  .container { padding: 14px 12px 30px; gap: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .titles h1 { font-size: 16px; }
  .card-head h2 { font-size: 16px; }
  .btn { padding: 11px 14px; }
  .task-top { flex-direction: column; align-items: stretch; }
  .task-actions { justify-content: flex-end; }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
