/* Smart Day — dizayn tizimi
   Neytral ish maydoni, bitta urg'u rangi (ko'k), bitta shrift (Onest).
   Asosiy urg'u: "Bugun" sahifasidagi hafta tasmasi va vaqt chizig'i. Qolgan hamma narsa sokin. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/onest-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root, [data-theme="light"] {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F1F3F6;
  --surface-3: #E6E9EF;
  --border: #E4E7EC;
  --border-strong: #CFD4DD;
  --text: #171A21;
  --text-2: #444B59;
  --muted: #6B7383;
  --accent: #2D5BE3;
  --accent-hover: #2149C4;
  --accent-text: #2450D4;
  --accent-soft: #EAF0FD;
  --on-accent: #FFFFFF;
  --success: #15803D;
  --success-soft: #E6F4EA;
  --danger: #C2321F;
  --danger-soft: #FCEBE8;
  --warn: #A3570B;
  --warn-soft: #FCF1DE;
  --now: #E5484D;
  --shadow-sm: 0 1px 2px rgba(23, 26, 33, .05);
  --shadow: 0 16px 48px rgba(23, 26, 33, .16), 0 2px 6px rgba(23, 26, 33, .06);
  --overlay: rgba(23, 26, 33, .42);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #111317;
  --surface: #181B21;
  --surface-2: #1F232A;
  --surface-3: #2A2F38;
  --border: #262A32;
  --border-strong: #363C47;
  --text: #ECEEF2;
  --text-2: #BAC0CC;
  --muted: #8C94A4;
  --accent: #5E86F2;
  --accent-hover: #7598F5;
  --accent-text: #8EAAF8;
  --accent-soft: rgba(94, 134, 242, .15);
  --on-accent: #0C1224;
  --success: #4CC38A;
  --success-soft: rgba(76, 195, 138, .14);
  --danger: #F07A6B;
  --danger-soft: rgba(240, 122, 107, .14);
  --warn: #E5A54A;
  --warn-soft: rgba(229, 165, 74, .14);
  --now: #FF6B70;
  --shadow-sm: none;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { overflow-x: clip; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.5; min-height: 100dvh;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, video, canvas { max-width: 100%; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
a { color: var(--accent-text); }


/* ---------- Qobiq ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); flex: none; }
.side-add { margin: 0 2px 10px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--text-2);
  text-decoration: none; font-weight: 550; font-size: 14.5px;
}
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 650; }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; width: 100%; text-decoration: none; color: inherit; }
.user-pill:hover, .user-pill[aria-current="page"] { background: var(--surface-2); }
.user-pill > div { min-width: 0; flex: 1; }
.user-pill b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill > div > span { display: block; font-size: 12.5px; color: var(--muted); }
.user-pill > .ic { color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; color: var(--accent-text); background: var(--accent-soft); overflow: hidden; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 64px; }
#view { max-width: 860px; margin: 0 auto; }
#view.wide { max-width: 1040px; }
.topbar, .bottomnav { display: none; }

/* ---------- Sarlavha ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; letter-spacing: -.025em; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split-b { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.section-title { font-size: 15px; font-weight: 650; margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 13px; font-weight: 550; color: var(--muted); }
.label { font-size: 13px; color: var(--muted); font-weight: 550; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 0; box-shadow: var(--shadow-sm); }
.card h2 { font-size: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 8px;
  font-weight: 600; font-size: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); background: var(--surface); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.danger.fill { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; gap: 6px; }
.btn.block { width: 100%; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--muted); flex: none; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-3); gap: 2px; max-width: 100%; }
.seg button { padding: 5px 12px; min-height: 30px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(23, 26, 33, .12); }
[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--surface-2); }
.seg.full { display: flex; } .seg.full button { flex: 1; min-width: 0; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.flag-high { color: var(--danger); }

/* ---------- Progress ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; width: var(--p, 0%); background: var(--accent); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.progress.good > i { background: var(--success); }

/* ---------- Bugun: hafta tasmasi ---------- */
.weekbar { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.week { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; min-width: 0; }
.wd {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; border-radius: 10px; min-width: 0;
  color: var(--text-2); border: 1px solid transparent; transition: background .12s;
}
.wd:hover { background: var(--surface-2); }
.wd span { font-size: 12px; font-weight: 550; color: var(--muted); }
.wd b { font-size: 17px; font-weight: 650; line-height: 1.3; }
.wd i { width: 4px; height: 4px; border-radius: 50%; background: transparent; margin-top: 2px; }
.wd i.has { background: var(--border-strong); }
.wd i.ok { background: var(--success); }
.wd.today b { color: var(--accent-text); }
.wd[aria-pressed="true"] { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); }
.wd[aria-pressed="true"] b { color: var(--text); }
.wd.today[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.wd.today[aria-pressed="true"] span, .wd.today[aria-pressed="true"] b { color: var(--on-accent); }
.wd.today[aria-pressed="true"] i.has, .wd.today[aria-pressed="true"] i.ok { background: var(--on-accent); }
.date-jump { position: relative; }
.date-jump input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- Bugun: umumiy holat ---------- */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; margin-bottom: 8px; }
.overview.one { grid-template-columns: minmax(0, 1fr); }
.ov-progress .ov-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ov-progress strong { font-size: 26px; font-weight: 650; letter-spacing: -.03em; }
.ov-progress strong small { font-size: 16px; color: var(--muted); font-weight: 550; }
.ov-progress .left { font-size: 13px; color: var(--muted); margin-top: 8px; }
.ov-next { display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%; }
button.ov-next:hover { border-color: var(--border-strong); }
.ov-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.ov-next .t { min-width: 0; flex: 1; }
.ov-next h3 { font-size: 16px; font-weight: 600; margin: 1px 0 3px; overflow-wrap: anywhere; }
.ov-next .when { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 14px; color: var(--text-2); }
.ov-next .when b { }
.ov-next .rel { color: var(--accent-text); font-weight: 600; }

.notice { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; }
.notice .ov-icon { width: 34px; height: 34px; border-radius: 9px; }
.notice .btn { margin-left: auto; }
.notice .t { flex: 1 1 200px; min-width: 0; font-size: 14px; color: var(--text-2); }
.notice .t b { display: block; color: var(--text); font-weight: 600; }
.notice.warn .ov-icon { background: var(--warn-soft); color: var(--warn); }

/* ---------- Vazifa qatori ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.task { display: flex; align-items: flex-start; gap: 4px; padding: 4px 6px 4px 8px; position: relative; background: var(--surface); }
.list > .task + .task { border-top: 1px solid var(--border); }
.check {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; margin: 12px 6px 0 4px;
  border: 1.5px solid var(--border-strong); color: transparent; transition: background .12s, border-color .12s; background: var(--surface);
}
.task[style*="--c"] .check { border-color: color-mix(in srgb, var(--c) 70%, var(--border-strong)); }
.check:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.task.done .check, .goal.done .check { background: var(--success); border-color: var(--success); color: #fff; }
.task-main { flex: 1; min-width: 0; padding: 9px 4px 10px; border-radius: 8px; display: block; }
.task-title { font-weight: 550; font-size: 15px; overflow-wrap: anywhere; }
.task.done .task-title { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.task-note { font-size: 13.5px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--muted); }
.task-meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.task-meta .time { font-weight: 600; color: var(--text-2); }
.task-meta .time.late { color: var(--danger); }
.task-meta .cat i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.task-actions { display: flex; flex: none; padding-top: 6px; opacity: 0; transition: opacity .12s; }
.task:hover .task-actions, .task:focus-within .task-actions { opacity: 1; }
@media (hover: none) { .task-actions { display: none; } }

.empty { text-align: center; padding: 36px 20px 32px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--muted); }
.empty > .ic { color: var(--muted); margin-bottom: 8px; }
.empty h3 { color: var(--text); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

/* ---------- Vaqt chizig'i ---------- */
.timeline { position: relative; }
.tl-row { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 12px; position: relative; }
.tl-row + .tl-row { margin-top: 8px; }
.tl-time { text-align: right; padding-top: 11px; font-weight: 650; font-size: 14px; color: var(--text); }
.tl-time small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.tl-row.past .tl-time { color: var(--muted); }
.tl-card { min-width: 0; }
.tl-card .task { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); border-left: 3px solid var(--c, var(--border-strong)); }
.tl-row.is-done .tl-card .task { background: var(--surface-2); box-shadow: none; border-left-color: var(--border-strong); }
.tl-now { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 12px; align-items: center; margin: 10px 0; color: var(--now); }
.tl-now span { text-align: right; font-size: 12.5px; font-weight: 700; }
.tl-now i { height: 2px; background: var(--now); border-radius: 2px; position: relative; display: block; }
.tl-now i::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

/* ---------- Kalendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-head h2 { margin: 0; font-size: 17px; min-width: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 550; color: var(--muted); padding: 4px 0 6px; }
.cal-day {
  aspect-ratio: 1 / 1; min-width: 0; min-height: 0; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-weight: 550; color: var(--text); border: 1px solid transparent;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { color: var(--muted); opacity: .5; }
.cal-day.today { color: var(--accent-text); font-weight: 700; }
.cal-day[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.cal-dots { display: flex; gap: 2px; height: 4px; }
.cal-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.cal-dots i.ok { background: var(--success); }
.cal-day[aria-pressed="true"] .cal-dots i { background: var(--on-accent); }
.day-panel .list { box-shadow: none; }
.goal { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.goal:last-of-type { border-bottom: 0; }
.goal .check { width: 20px; height: 20px; margin: 0 4px 0 0; }
.goal.done .goal-title { text-decoration: line-through; color: var(--muted); }
.goal-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.inline-add .input { flex: 1; min-height: 38px; }

/* ---------- Statistika ---------- */
.stat-num { font-size: 30px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.stat-num small { font-size: 15px; color: var(--muted); font-weight: 550; letter-spacing: 0; }
.stat-card .row { justify-content: space-between; align-items: baseline; margin: 6px 0 12px; }
.stat-card .pct { font-weight: 650; color: var(--text-2); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 20px; border-bottom: 1px solid var(--border-strong); position: relative; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.bars::before { top: 20px; } .bars::after { top: calc(20px + (100% - 20px) / 2); }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; z-index: 1; min-width: 0; }
.bar { width: 100%; max-width: 26px; border-radius: 5px 5px 1px 1px; background: var(--accent); min-height: 3px; height: var(--h); transition: height .45s cubic-bezier(.2, .8, .2, 1); }
.bar.none { background: var(--surface-3); }
.bar.full { background: var(--success); }
.bar-val { font-size: 11px; font-weight: 600; color: var(--text-2); margin-bottom: 3px; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); min-width: 0; }
.bar-labels span.today { color: var(--accent-text); font-weight: 700; }
.cat-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; }
.cat-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); flex: none; }
.cat-row .progress { margin-top: 6px; }
.cat-row .progress > i { background: var(--c); }
.cat-name { font-weight: 550; font-size: 14px; overflow-wrap: anywhere; }
.cat-val { font-size: 13px; color: var(--text-2); text-align: right; }
.streak { display: flex; align-items: center; gap: 14px; }
.flame { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: var(--warn); background: var(--warn-soft); flex: none; }

/* ---------- Formalar ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-width: 0; max-width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong);
  transition: border-color .12s, box-shadow .12s;
}
.select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  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='%236B7383' stroke-width='2' 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 10px center; }
.textarea { resize: vertical; min-height: 72px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.title-input { font-size: 18px; font-weight: 550; min-height: 48px; border-color: transparent; background: var(--surface-2); }
.title-input:focus { background: var(--surface); }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span-all { grid-column: 1 / -1; }
.fields-2.plan > .field:last-child { grid-column: 1 / -1; }
.fields-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 550; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface); max-width: 100%; }
.pick:hover { background: var(--surface-2); }
.pick > i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.pick[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.hint { font-size: 13px; color: var(--muted); }
.field .hint { margin-top: -2px; }
.date-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.date-row .input { flex: 1 1 150px; width: auto; }
.more { margin: 0 0 12px; border-top: 1px solid var(--border); }
.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 12px 0; font-weight: 600; font-size: 14px; color: var(--text-2); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary .sum-extra { color: var(--muted); font-weight: 500; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more > summary > .ic:last-child { margin-left: auto; transition: transform .15s; }
.more[open] > summary > .ic:last-child { transform: rotate(180deg); }
.more > summary:hover { color: var(--text); }
.pw { position: relative; }
.pw .input { padding-right: 44px; }
.pw .icon-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }

.switch { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; flex: none; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Sozlamalar ro'yxati */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: 680px; }
.set-group h2 { font-size: 14px; font-weight: 650; color: var(--text-2); margin: 0 0 8px 2px; }
.set-list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 13px 16px; }
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-row .t { min-width: 0; flex: 1 1 220px; }
.set-row .t b { display: block; font-weight: 550; font-size: 14.5px; }
.set-row .t span { display: block; font-size: 13px; color: var(--muted); }
.set-row .ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.set-row .select { width: auto; min-width: 180px; max-width: 100%; }
.set-row.block { display: block; }
.set-note { font-size: 13px; color: var(--muted); padding: 8px 4px 0; display: flex; gap: 8px; }
.set-note .ic { margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--success); }
.status.no { color: var(--muted); }
.status.bad { color: var(--danger); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c); }
.icon-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-opt { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); background: var(--surface-2); border: 1px solid transparent; }
.icon-opt[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.cat-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px 16px; }
.cat-item + .cat-item { border-top: 1px solid var(--border); }
.cat-item .name { flex: 1; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.profile-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; padding: 16px; }
.profile-top .who { min-width: 0; }
.profile-top .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-top .who span { display: block; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-top .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.set-form { padding: 4px 16px 16px; }

/* ---------- Modal, toast, signal ---------- */
.modal-back { position: fixed; inset: 0; background: var(--overlay); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { width: min(520px, 100%); max-height: min(92dvh, 860px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); animation: rise .2s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal.sm { width: min(400px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 4px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 8px 20px 20px; }
.modal-text { color: var(--text-2); margin-bottom: 18px; overflow-wrap: anywhere; }
body.no-scroll { overflow: hidden; }

#toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { pointer-events: auto; padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; font-weight: 550; display: flex; gap: 10px; align-items: center; animation: rise .18s ease; max-width: 100%; }
.toast span { overflow-wrap: anywhere; }
.toast.error { background: var(--danger); color: #fff; }
.toast.success .ic { color: #4ADE80; }
[data-theme="dark"] .toast.success .ic { color: var(--success); }

#alerts { position: fixed; z-index: 80; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(94vw, 420px); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.alert-card { pointer-events: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); animation: drop .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
.alert-card .top { display: flex; gap: 12px; align-items: flex-start; }
.alert-card .ring-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--on-accent); background: var(--accent); flex: none; animation: ringb 1s ease-in-out 3; }
@keyframes ringb { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(12deg); } 40% { transform: rotate(-10deg); } 60% { transform: rotate(6deg); } 80% { transform: rotate(-4deg); } }
.alert-card .when { font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.alert-card h3 { font-size: 16px; overflow-wrap: anywhere; }
.alert-card p { font-size: 13.5px; color: var(--text-2); white-space: pre-line; margin-top: 2px; overflow-wrap: anywhere; }
.alert-card .row { margin-top: 12px; gap: 8px; }

/* ---------- Kirish ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-side { background: var(--bg); border-right: 1px solid var(--border); padding: 40px clamp(24px, 5vw, 64px); display: flex; flex-direction: column; }
.auth-side .brand { padding: 0; }
.auth-side .pitch { margin: auto 0; max-width: 420px; }
.auth-side h2 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.03em; margin-bottom: 26px; }
.benefit { display: flex; gap: 14px; margin-bottom: 20px; }
.benefit .ov-icon { background: var(--surface); border: 1px solid var(--border); }
.benefit b { display: block; font-weight: 600; }
.benefit span { color: var(--muted); font-size: 14px; }
.auth-side .foot { font-size: 13px; color: var(--muted); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(380px, 100%); }
.auth-card > .brand { display: none; padding: 0 0 24px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.025em; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-switch button { color: var(--accent-text); font-weight: 600; }
.auth-switch button:hover { text-decoration: underline; }
.auth.solo { grid-template-columns: minmax(0, 1fr); background: var(--bg); }

.skeleton { height: 84px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Planshet ---------- */
@media (max-width: 1099px) {
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .fields-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields-3 > .field:last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .auth-side { display: none; }
  .auth-card > .brand { display: flex; }
  .auth-main { align-items: start; padding-top: max(48px, 10dvh); }
  .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: var(--shadow-sm); }
}

/* ---------- Telefon ---------- */
@media (max-width: 899px) {
  .app { display: block; }
  .sidebar { display: none; }
  .main { padding: 4px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 20;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  }
  .topbar .brand { padding: 0; font-size: 16px; min-width: 0; gap: 9px; }
  .topbar .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
  .topbar .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .me { text-decoration: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
  .topbar .me[aria-current="page"] .avatar { box-shadow: 0 0 0 2px var(--accent); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--border);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; min-width: 0; }
  .bottomnav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottomnav a[aria-current="page"] { color: var(--accent-text); }
  .bottomnav .nav-add { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto; border-radius: 50%; color: var(--on-accent); background: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
  .bottomnav .nav-add:active { transform: scale(.94); }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .grid.cols-3, .grid.cols-2, .grid.split-b { grid-template-columns: minmax(0, 1fr); }
  .overview { grid-template-columns: minmax(0, 1fr); }
  .modal-back { place-items: end center; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; width: 100%; max-height: 94dvh; padding-bottom: env(safe-area-inset-bottom); animation-name: sheet; }
  @keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
  .modal.sm { width: 100%; }
  .modal-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--border-strong); }
  .modal-head { padding-top: 18px; }
  .page-head { margin-bottom: 14px; align-items: center; }
  .page-head h1 { font-size: 24px; }
  .page-head .add-btn { display: none; } /* qo'shish — pastki menyudagi "+" */
  .set-row .select { min-width: 0; width: 100%; }
  .set-row { flex-wrap: wrap; }
  .set-row .ctl { flex: 1 1 100%; justify-content: flex-start; }
  .set-row.inline { flex-wrap: nowrap; }
  .set-row.inline .t { flex: 1 1 0; }
  .set-row.inline .ctl { flex: 0 0 auto; }
  .profile-top { grid-template-columns: auto minmax(0, 1fr); }
  .profile-top .avatar.lg { width: 56px; height: 56px; font-size: 20px; }
  .profile-top .actions { grid-column: 1 / -1; }
  .set-row .ctl .seg { display: flex; width: 100%; }
  .set-row .ctl .seg button { flex: 1 1 auto; padding: 5px 8px; }
  .bar-val { display: none; }
  .bars { gap: 3px; } .bar-labels { gap: 3px; }
  .bar-labels span { font-size: 10px; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .icon-btn { width: 40px; height: 40px; }
  .input, .select, .textarea { font-size: 16px; min-height: 44px; } /* iOS yaqinlashtirmasligi uchun */
  .title-input { font-size: 18px; min-height: 50px; }
  .check { width: 24px; height: 24px; margin-top: 11px; }
}
/* Telefon gorizontal holatda */
@media (max-width: 899px) and (max-height: 480px) {
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .topbar { position: static; padding-top: 6px; padding-bottom: 4px; }
  .bottomnav a { min-height: 44px; flex-direction: row; gap: 6px; font-size: 12px; }
  .bottomnav .nav-add { width: 40px; height: 40px; }
  .modal { max-height: 100dvh; border-radius: 12px 12px 0 0; }
}
/* Tor telefonlar */
@media (max-width: 380px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  .weekbar > .icon-btn { width: 30px; }
  .week { gap: 2px; }
  .wd b { font-size: 15px; }
  .wd span { font-size: 11px; }
  .fields-2:not(#tf-times) { grid-template-columns: minmax(0, 1fr); }
  .btn { padding: 0 12px; }
  .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-head { padding-left: 16px; }
  .tl-row, .tl-now { grid-template-columns: 42px minmax(0, 1fr); gap: 8px; }
  .bottomnav a { font-size: 10.5px; }
  .cal-day { border-radius: 7px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Ruxsat so'rash oynasi ---------- */
.perm-ask { text-align: center; padding: 4px 4px 2px; }
.perm-ask .big-ic { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent-text); }
.perm-ask.warn .big-ic { background: var(--warn-soft); color: var(--warn); }
.perm-ask h3 { font-size: 19px; margin-bottom: 6px; }
.perm-ask p { color: var(--text-2); max-width: 340px; margin: 0 auto; }
.perm-ask ol { text-align: left; color: var(--text-2); margin: 12px auto 0; padding-left: 22px; max-width: 340px; display: grid; gap: 6px; }
.perm-ask .acts { display: grid; gap: 8px; margin-top: 20px; }

/* ---------- AzbekDev ---------- */
.made-by { display: flex; align-items: center; gap: 9px; padding: 8px; margin-bottom: 6px; border-radius: 10px; text-decoration: none; color: var(--text-2); font-size: 12.5px; line-height: 1.3; }
.made-by:hover { background: var(--surface-2); color: var(--text); }
.made-by img { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.made-by b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.about { display: flex; align-items: center; gap: 14px; padding: 16px; flex-wrap: wrap; }
.about img { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.about .t { flex: 1 1 160px; min-width: 0; }
.about .t b { display: block; font-size: 15px; }
.about .t span { color: var(--muted); font-size: 13.5px; }
.credit { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; font-size: 13px; }
.credit:hover { color: var(--text); }
.credit img { width: 20px; height: 20px; border-radius: 5px; }
.auth-credit { text-align: center; margin-top: 26px; }
@media (min-width: 861px) { .auth-credit { display: none; } }
