/* ============================================================
   Planner — colourful, calm, and quick.
   Violet → pink brand gradient, soft tinted surfaces, a colour
   accent per plan / column, dark mode, and a phone-first tab bar.
   ============================================================ */
:root {
  --bg: #f6f4ff; --surface: #ffffff; --surface-2: #faf9ff;
  --text: #1d1a3b; --muted: #78739a; --line: #ebe8fa;
  --brand: #6d4aff; --brand-2: #b04bff; --pink: #ff5c9d;
  --brand-soft: #efeaff; --ring: rgba(109, 74, 255, .22);
  --green: #1fb76a; --red: #ef4444; --amber: #f59e0b; --blue: #3b8cff; --teal: #14b8a6;
  --c1: #7c5cff; --c2: #ff5c9d; --c3: #ff9f43; --c4: #14c8b0; --c5: #3b9cff; --c6: #6dd36f;
  --grad: linear-gradient(135deg, #6d4aff 0%, #b04bff 55%, #ff5c9d 100%);
  --radius: 16px; --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(60, 40, 140, .05), 0 6px 20px rgba(60, 40, 140, .07);
  --shadow-lg: 0 18px 50px rgba(60, 40, 140, .22);
  --sidebar: linear-gradient(170deg, #241b5c 0%, #3a1d78 55%, #5a1f86 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12102a; --surface: #1c1a3a; --surface-2: #211f45;
    --text: #efeeff; --muted: #a09cc8; --line: #2d2a58;
    --brand-soft: #2a2560; --ring: rgba(150, 120, 255, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
  .cal .day.out { background: #17153a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14.5px/1.55 "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 105% -10%, rgba(255, 92, 157, .13), transparent 60%),
    radial-gradient(800px 480px at -10% -5%, rgba(109, 74, 255, .15), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ring); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: #e9e5ff; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 22px; font-size: 19px; font-weight: 800; letter-spacing: -.03em; color: #fff; }
.brand i {
  width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(255, 92, 157, .4); font-style: normal; font-size: 18px;
}
.nav { flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 2px; border-radius: 12px; color: #cfc8f5; transition: .15s; }
.nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .17); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.nav .ico { width: 24px; text-align: center; font-size: 16px; }
.nav-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #9b92d4; margin: 20px 12px 6px; }
.sidebar .me { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .13); font-size: 13px; }
.sidebar .me a, .sidebar .me button { color: #cfc8f5; background: none; border: 0; padding: 0; cursor: pointer; }
.sidebar .me a:hover, .sidebar .me button:hover { color: #fff; }
.badge { margin-left: auto; min-width: 20px; text-align: center; background: var(--pink); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.badge[hidden] { display: none; }

.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 36px 0; justify-content: flex-end; position: relative; z-index: 20; }
.topbar .brand-m { display: none; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow); transition: .15s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--brand); }
.icon-btn .badge { position: absolute; top: -6px; right: -6px; margin: 0; box-shadow: 0 0 0 3px var(--bg); }
.btn.install-btn { display: none; }
main { padding: 8px 36px 60px; min-width: 0; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- buttons & inputs ---------- */
.btn {
  background: var(--grad); color: #fff; border: 0; border-radius: 12px; padding: 9px 18px; cursor: pointer; font-weight: 600;
  box-shadow: 0 6px 16px rgba(109, 74, 255, .3); transition: transform .15s, box-shadow .15s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(109, 74, 255, .36); filter: saturate(1.1); }
.btn:active { transform: none; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); box-shadow: none; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line)); box-shadow: none; }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); box-shadow: none; }
.btn.sm { padding: 5px 13px; font-size: 13px; border-radius: 10px; }

input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input[type=email], select, textarea {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236d4aff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input[type=search] { padding-left: 38px; background-repeat: no-repeat; background-position: 13px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378739a' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
/* checkboxes: never stretched, always the same size */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none; width: 19px; height: 19px; margin: 0; padding: 0; min-width: 0;
  border: 1.7px solid #c7c1e8; border-radius: 6px; background: var(--surface); cursor: pointer; display: inline-grid; place-content: center; transition: .15s; vertical-align: middle;
}
input[type=checkbox]:hover { border-color: var(--brand); }
input[type=checkbox]:checked { background: var(--grad); border-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E"),
  var(--grad); background-size: 72%, cover; background-repeat: no-repeat; background-position: center; }
label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 5px; letter-spacing: .02em; }
.messages { margin-bottom: 14px; }
.msg { padding: 11px 16px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-weight: 500; margin-bottom: 6px; animation: rise .3s both; }
.msg.error { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }
.msg.success { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); }

/* ---------- page header, hero, stats ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 22px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head .sub { color: var(--muted); }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hero {
  background: var(--grad); color: #fff; border-radius: 24px; padding: 28px 30px 26px; position: relative; overflow: hidden; margin: 8px 0 8px;
  box-shadow: 0 20px 45px rgba(109, 74, 255, .3);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.hero::before { width: 260px; height: 260px; right: -60px; top: -110px; }
.hero::after { width: 160px; height: 160px; right: 150px; bottom: -90px; background: rgba(255, 220, 120, .22); }
.hero h1 { font-size: 30px; position: relative; }
.hero p { margin: 4px 0 20px; opacity: .88; position: relative; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; position: relative; }
.tile { background: rgba(255, 255, 255, .17); border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(8px); border-radius: 16px; padding: 13px 16px; transition: .2s; }
a.tile:hover { background: rgba(255, 255, 255, .27); transform: translateY(-2px); }
.tile b { display: block; font-size: 28px; line-height: 1.1; font-weight: 800; }
.tile span { font-size: 12.5px; opacity: .9; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  --col: var(--c1); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 16px;
  box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; display: block; position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--col); }
.card::after { content: ""; position: absolute; width: 130px; height: 130px; right: -40px; top: -50px; border-radius: 50%; background: color-mix(in srgb, var(--col) 12%, transparent); }
a.card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px color-mix(in srgb, var(--col) 28%, transparent); }
.card .emoji { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 23px; background: color-mix(in srgb, var(--col) 15%, var(--surface)); position: relative; z-index: 1; }
.card h3 { margin: 12px 0 2px; font-size: 16px; position: relative; z-index: 1; }
.card .muted { font-size: 13px; position: relative; z-index: 1; }
.bar { height: 7px; background: color-mix(in srgb, var(--col, var(--brand)) 14%, var(--line)); border-radius: 7px; overflow: hidden; margin-top: 14px; position: relative; z-index: 1; }
.bar > span { display: block; height: 100%; background: var(--col, var(--brand)); border-radius: 7px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.cards .card:nth-child(6n+1), .col:nth-child(6n+1) { --col: var(--c1); }
.cards .card:nth-child(6n+2), .col:nth-child(6n+2) { --col: var(--c2); }
.cards .card:nth-child(6n+3), .col:nth-child(6n+3) { --col: var(--c3); }
.cards .card:nth-child(6n+4), .col:nth-child(6n+4) { --col: var(--c4); }
.cards .card:nth-child(6n+5), .col:nth-child(6n+5) { --col: var(--c5); }
.cards .card:nth-child(6n+6), .col:nth-child(6n+6) { --col: var(--c6); }
.new-plan {
  background: var(--surface); border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: 20px; padding: 18px; margin-top: 30px;
  display: grid; grid-template-columns: 80px 1fr 150px auto; gap: 12px; align-items: end;
}

/* ---------- plan header + view switcher ---------- */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 10px 0 16px; flex-wrap: wrap; }
.plan-head h1 { font-size: 26px; display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.plan-head .pe { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--brand-soft); box-shadow: var(--shadow); }
.kind { font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); letter-spacing: 0; }
.kind.work { background: color-mix(in srgb, var(--blue) 15%, var(--surface)); color: var(--blue); }
.tabs { display: inline-flex; gap: 3px; padding: 4px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-radius: 15px; margin: 0 0 18px; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 8px 18px; border-radius: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; transition: .15s; }
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--brand); box-shadow: 0 2px 10px rgba(60, 40, 140, .12); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar input[type=search] { width: 230px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 16px 0 12px; margin: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: .15s; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle::before { content: ""; width: 30px; height: 18px; border-radius: 12px; background: #d6d1ee; transition: .2s;
  background-image: radial-gradient(circle at 9px 9px, #fff 7px, transparent 7.5px); background-repeat: no-repeat; }
.toggle:has(input:checked) { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.toggle:has(input:checked)::before { background-color: var(--brand); background-image: radial-gradient(circle at 21px 9px, #fff 7px, transparent 7.5px); }
.toggle:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.clear-link { color: var(--brand); font-weight: 600; font-size: 13.5px; }

/* ---------- board ---------- */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding: 4px 4px 24px; margin: 0 -4px; scroll-snap-type: x proximity; }
.col {
  --col: var(--c1); flex: 0 0 300px; scroll-snap-align: start; border-radius: 20px; padding: 12px;
  background: color-mix(in srgb, var(--col) 7%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--col) 16%, var(--line));
}
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; font-weight: 700; }
.col-head > span { display: flex; align-items: center; gap: 9px; }
.col-head > span::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--col); box-shadow: 0 0 0 4px color-mix(in srgb, var(--col) 22%, transparent); }
.col-head .count { background: color-mix(in srgb, var(--col) 18%, var(--surface)); color: var(--col); font-size: 12px; font-weight: 700; padding: 0 9px; border-radius: 10px; margin-left: 2px; filter: brightness(.85); }
.col-head details { position: relative; }
.col-head summary { cursor: pointer; list-style: none; color: var(--muted); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; font-weight: 800; }
.col-head summary:hover { background: var(--surface); color: var(--text); }
.col-head summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: 34px; z-index: 6; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); border-radius: 14px; padding: 12px; width: 220px; display: grid; gap: 8px; }
.drop { min-height: 36px; display: grid; gap: 10px; border-radius: 14px; transition: background .15s; }
.drop.over { background: color-mix(in srgb, var(--col) 14%, transparent); outline: 2px dashed color-mix(in srgb, var(--col) 55%, transparent); outline-offset: -2px; }
.task {
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 12px 14px; box-shadow: var(--shadow);
  cursor: pointer; position: relative; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.task:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--col, var(--brand)) 55%, var(--line)); box-shadow: 0 10px 24px color-mix(in srgb, var(--col, var(--brand)) 20%, transparent); }
.task.dragging { opacity: .45; transform: rotate(2deg); }
.task .t-title { display: flex; gap: 10px; align-items: flex-start; font-weight: 550; }
.task.done .t-title span { text-decoration: line-through; color: var(--muted); }
.task.done { opacity: .78; }
.circle {
  flex: none; width: 21px; height: 21px; border-radius: 50%; border: 2px solid #c7c1e8; background: var(--surface); cursor: pointer; margin-top: 1px; padding: 0;
  color: #fff; font-size: 12px; font-weight: 800; line-height: 17px; text-align: center; transition: .18s;
}
.circle:hover { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--surface)); transform: scale(1.12); }
.circle.on { background: linear-gradient(135deg, #34d399, #1fb76a); border-color: transparent; box-shadow: 0 3px 9px rgba(31, 183, 106, .4); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); align-items: center; }
.chip { padding: 2px 10px; border-radius: 20px; background: color-mix(in srgb, var(--blue) 12%, var(--surface)); color: var(--blue); font-weight: 600; }
.chip.late { background: color-mix(in srgb, var(--red) 13%, var(--surface)); color: var(--red); }
.chip.p1 { background: color-mix(in srgb, var(--red) 13%, var(--surface)); color: var(--red); }
.chip.p3 { background: color-mix(in srgb, var(--amber) 16%, var(--surface)); color: #c77700; }
.chip.neutral { background: var(--brand-soft); color: var(--brand); }
.dots { display: flex; gap: 4px; margin-bottom: 9px; }
.dots i { height: 6px; width: 30px; border-radius: 4px; }
.lbl { color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.avatars { margin-left: auto; display: flex; padding-left: 6px; }
.avatar { width: 25px; height: 25px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; text-transform: uppercase; margin-left: -7px; border: 2px solid var(--surface); }
.avatars .avatar:nth-child(3n+2) { background: linear-gradient(135deg, #14c8b0, #3b9cff); }
.avatars .avatar:nth-child(3n+3) { background: linear-gradient(135deg, #ff9f43, #ff5c9d); }
.add-task { margin-top: 10px; }
.add-task input { border: 2px dashed color-mix(in srgb, var(--col) 30%, var(--line)); background: transparent; height: 40px; }
.add-task input:focus { background: var(--surface); }
.add-col { flex: 0 0 250px; }
.add-col input { border: 2px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); background: transparent; height: 46px; border-radius: 16px; }

/* ---------- grid / table ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 13px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
th a:hover { color: var(--brand); }
td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; transition: background .12s; }
tbody tr.row:hover { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; border-radius: 18px; }

/* ---------- schedule ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.cal .dow { padding: 11px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); text-align: center; background: var(--surface-2); }
.cal .day { min-height: 112px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; transition: background .12s; }
.cal .day:hover { background: var(--surface-2); }
.cal .day:nth-child(7n+7) { border-right: 0; }
.cal .day.out { background: var(--surface-2); opacity: .55; }
.cal .num { font-size: 12.5px; font-weight: 600; margin-bottom: 5px; display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 13px; }
.cal .today .num { background: var(--grad); color: #fff; box-shadow: 0 4px 10px rgba(109, 74, 255, .4); }
.cal .pill { display: block; font-size: 12px; font-weight: 550; padding: 3px 8px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: .12s; }
.cal .pill:hover { transform: translateX(2px); }
.cal .pill.done { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); text-decoration: line-through; }
.cal .pill.late { background: color-mix(in srgb, var(--red) 13%, var(--surface)); color: var(--red); }
.month-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.month-nav h2 { min-width: 170px; text-align: center; font-size: 18px; }

/* ---------- charts ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sc, var(--brand)); }
.stat b { font-size: 30px; font-weight: 800; display: block; line-height: 1.15; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.panel h3 { font-size: 15px; margin-bottom: 16px; }
.donut { width: 160px; height: 160px; border-radius: 50%; margin: 0 auto 16px; position: relative; }
.donut::after { content: ""; position: absolute; inset: 30px; background: var(--surface); border-radius: 50%; }
.legend { display: grid; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 9px; }
.legend div { display: flex; justify-content: space-between; }
.hbar { display: grid; grid-template-columns: 96px 1fr 28px; gap: 12px; align-items: center; margin-bottom: 11px; font-size: 13px; }
.hbar .track { background: var(--line); height: 10px; border-radius: 6px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 6px; background: var(--grad); }
.hbar:nth-child(5n+2) .track span { background: linear-gradient(90deg, #ff5c9d, #ff9f43); }
.hbar:nth-child(5n+3) .track span { background: linear-gradient(90deg, #14c8b0, #3b9cff); }
.hbar:nth-child(5n+4) .track span { background: linear-gradient(90deg, #6dd36f, #14c8b0); }
.hbar:nth-child(5n+5) .track span { background: linear-gradient(90deg, #3b9cff, #7c5cff); }

/* ---------- lists (my tasks, notifications) ---------- */
.group { margin-bottom: 26px; }
.group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; color: var(--muted); }
.group h3.late { color: var(--red); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; gap: 14px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.item:last-child { border: 0; }
.item:hover { background: var(--brand-soft); }
.item .grow { flex: 1; min-width: 0; }
.item.done .grow b { text-decoration: line-through; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 64px 20px; }
.empty .big { font-size: 54px; display: block; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- notifications ---------- */
.seg { display: inline-flex; padding: 4px; gap: 3px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-radius: 14px; }
.seg a { padding: 7px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg a.active { background: var(--surface); color: var(--brand); box-shadow: 0 2px 8px rgba(60, 40, 140, .12); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.day-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 4px 10px; }
.nlist { display: grid; gap: 10px; }
.nitem {
  --c: var(--brand); position: relative; display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px 14px 18px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; overflow: hidden;
}
.nitem:hover { transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--c) 20%, transparent); }
.nitem.unread { background: color-mix(in srgb, var(--c) 6%, var(--surface)); border-color: color-mix(in srgb, var(--c) 28%, var(--line)); }
.nitem.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c); }
.nitem.gone { opacity: 0; transform: translateX(30px); transition: .25s; }
.nicon { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 22px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.nbody { flex: 1; min-width: 0; }
.nbody .t { font-weight: 550; display: block; }
.nitem:not(.unread) .t { font-weight: 450; color: var(--muted); }
.nbody .m { font-size: 12.5px; color: var(--muted); }
.ndot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); flex: none; }
.nx { flex: none; width: 32px; height: 32px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; opacity: 0; transition: .15s; }
.nitem:hover .nx, .nx:focus-visible { opacity: 1; }
.nx:hover { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.banner {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 20px; margin-bottom: 18px; color: #fff; background: var(--grad);
  box-shadow: 0 14px 30px rgba(109, 74, 255, .28); flex-wrap: wrap;
}
.banner .bi { font-size: 30px; }
.banner .bt { flex: 1; min-width: 200px; }
.banner .bt b { display: block; font-size: 15.5px; }
.banner .bt span { opacity: .9; font-size: 13.5px; }
.banner .btn { background: #fff; color: var(--brand); box-shadow: none; }
.banner[hidden] { display: none; }

/* bell popover */
.bell-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: 54px; width: 380px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; transform-origin: top right; animation: pop .16s ease both;
}
.popover[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-6px); } }
.popover header { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; background: var(--grad); color: #fff; }
.popover header b { font-size: 15px; }
.popover header button { background: rgba(255, 255, 255, .22); border: 0; color: #fff; border-radius: 9px; padding: 3px 11px; font-size: 12px; font-weight: 600; cursor: pointer; }
.popover .pi { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); --c: var(--brand); }
.popover .pi:hover { background: var(--brand-soft); }
.popover .pi .nicon { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
.popover .pi.unread { background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.popover .pi .t { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.popover .pi .m { font-size: 12px; color: var(--muted); }
.popover footer { padding: 12px; text-align: center; }
.popover footer a { color: var(--brand); font-weight: 700; font-size: 13.5px; }
.popover .none { padding: 34px 20px; text-align: center; color: var(--muted); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }
.toast { --c: var(--brand); display: flex; gap: 12px; align-items: center; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 16px; box-shadow: var(--shadow-lg); animation: slidein .35s cubic-bezier(.2, .9, .3, 1.2) both; cursor: pointer; }
.toast.out { opacity: 0; transform: translateX(30px); transition: .25s; }
@keyframes slidein { from { opacity: 0; transform: translateX(60px) scale(.9); } }
.toast .nicon { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
.toast .t { font-size: 13.5px; font-weight: 550; line-height: 1.35; }

/* ---------- settings / account ---------- */
.settings { max-width: 680px; display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.row form { margin: 0; }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; margin: 0; font-size: 14px; font-weight: 500; color: var(--text); letter-spacing: 0; }
.switch input { margin-top: 2px; }
.switch small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; }
.device { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: var(--surface-2); }
.device .ico { font-size: 22px; }
.device .grow { flex: 1; min-width: 0; }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.ok::before { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }
.status.bad::before { background: var(--red); }

/* ---------- task dialog ---------- */
dialog { border: 0; border-radius: 24px; padding: 0; width: min(680px, 95vw); max-height: 92vh; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); animation: pop .2s ease both; }
dialog::backdrop { background: rgba(24, 14, 60, .5); backdrop-filter: blur(6px); }
.modal { padding: 0 26px 26px; max-height: 90vh; overflow-y: auto; }
.modal::before { content: ""; display: block; height: 8px; margin: 0 -26px 20px; background: var(--grad); }
.modal .title { font-size: 21px; font-weight: 700; border: 0; padding: 4px 0; margin-bottom: 14px; height: auto; background: transparent; letter-spacing: -.02em; }
.modal .title:focus { box-shadow: none; border-bottom: 2px solid var(--brand); border-radius: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.checks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.checks li { margin: 0; }
.checks label { display: inline-flex; gap: 8px; align-items: center; margin: 0; padding: 6px 13px 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer; letter-spacing: 0; transition: .15s; }
.checks label:hover { border-color: var(--brand); }
.checks label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.field { margin-bottom: 16px; }
.ck { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.ck input[type=text] { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 2px; height: 34px; background: transparent; }
.ck input[type=text]:focus { box-shadow: none; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 8px; }
.x:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.modal-foot { display: flex; justify-content: space-between; margin-top: 22px; gap: 10px; flex-wrap: wrap; }
.comments { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.comment { margin-bottom: 12px; padding: 10px 14px; background: var(--surface-2); border-radius: 14px; }
.comment small { color: var(--muted); }
.errorlist { color: var(--red); list-style: none; margin: 3px 0; padding: 0; font-size: 12.5px; }
.att { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.att img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; display: block; }
.att .ico { width: 46px; text-align: center; font-size: 24px; }
.att .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- auth + offline ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--sidebar); position: relative; overflow: hidden; }
.auth-page::before, .auth-page::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.auth-page::before { width: 480px; height: 480px; background: #ff5c9d; right: -120px; top: -140px; }
.auth-page::after { width: 440px; height: 440px; background: #3b9cff; left: -140px; bottom: -160px; opacity: .4; }
.auth { position: relative; z-index: 1; width: 100%; max-width: 400px; background: color-mix(in srgb, var(--surface) 94%, transparent); border-radius: 28px; padding: 38px 34px 34px; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); animation: rise .5s both; }
.auth .logo { width: 62px; height: 62px; border-radius: 20px; background: var(--grad); display: grid; place-items: center; font-size: 30px; margin: 0 auto 16px; box-shadow: 0 12px 28px rgba(176, 75, 255, .45); }
.auth h1 { text-align: center; font-size: 26px; }
.auth .tag { text-align: center; color: var(--muted); margin: 4px 0 24px; }
.auth p { margin: 0 0 14px; }
.auth .errorlist { margin-bottom: 12px; }

/* ---------- phone / installed-app layout ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 0; justify-content: space-between; }
  .topbar .brand-m { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
  .topbar .brand-m i { width: 30px; height: 30px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; font-style: normal; font-size: 16px; }
  .topbar .right { display: flex; gap: 8px; }
  main { padding: 6px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: var(--shadow-lg);
  }
  .tabbar a { display: grid; place-items: center; gap: 1px; padding: 7px 0; border-radius: 16px; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
  .tabbar a .i { font-size: 20px; line-height: 1.2; }
  .tabbar a.active { color: var(--brand); background: var(--brand-soft); }
  .tabbar .badge { position: absolute; top: 2px; right: 22%; margin: 0; font-size: 10px; padding: 0 5px; min-width: 17px; }
  .page-head h1, .hero h1 { font-size: 23px; }
  .hero { padding: 22px 20px; border-radius: 22px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .new-plan { grid-template-columns: 1fr; }
  .col { flex-basis: 84vw; }
  .toolbar select, .toolbar input[type=search] { flex: 1 1 140px; width: auto; }
  .cal .day { min-height: 74px; padding: 4px; }
  .cal .pill { font-size: 10.5px; padding: 1px 4px; }
  .grid2 { grid-template-columns: 1fr; }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); right: 16px; }
  .popover { position: fixed; top: calc(62px + env(safe-area-inset-top)); right: 12px; left: 12px; width: auto; max-width: none; }
  .hbar { grid-template-columns: 80px 1fr 24px; }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .modal { max-height: 100dvh; }
}
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }
