:root {
  --bg: #0a0e16;
  --bg2: #0f1522;
  --card: rgba(255, 255, 255, 0.045);
  --card-b: rgba(255, 255, 255, 0.08);
  --text: #eef2f8;
  --hint: #8b95a8;
  --accent: #4f8cff;
  --accent2: #8a5cff;
  --up: #22e07a;
  --down: #ff4d5e;
  --flat: #7d8799;
  --radius: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: 96px; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(138, 92, 255, .18), transparent 60%),
    radial-gradient(700px 400px at -20% 10%, rgba(79, 140, 255, .14), transparent 60%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--hint); }
.small { font-size: 12px; }

/* ---------- Sarlavha ---------- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 8px; }
.hello { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.sub { color: var(--hint); font-size: 13px; margin-top: 2px; }
.clock { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 8px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--card-b); }

main { padding: 0 14px; }
.tab { display: none; animation: fade .3s ease; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Kartalar ---------- */
.card { background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius); padding: 16px; margin: 12px 0;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; letter-spacing: -.1px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h3 { margin: 0; }

/* ---------- Segment tugmalar ---------- */
.seg { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--card-b); border-radius: 16px; padding: 4px; margin: 10px 0; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 0; border-radius: 12px; font-weight: 700; cursor: pointer; color: var(--hint); transition: .2s; }
.seg button.on { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px rgba(79, 140, 255, .35); }
.seg.small button { font-size: 13px; padding: 7px 0; }

/* ---------- Bubble maydoni ---------- */
.bubbles { position: relative; height: 440px; margin: 10px -14px 8px; overflow: hidden; touch-action: none;
  background: radial-gradient(ellipse at 50% 45%, #161c2a 0%, #0b0f18 70%, #080b12 100%);
  border-top: 1px solid var(--card-b); border-bottom: 1px solid var(--card-b); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--hint); }
.bubble { --c: 125, 135, 153; position: absolute; left: 0; top: 0; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; color: #fff; cursor: grab; user-select: none; will-change: transform;
  background: radial-gradient(circle at 50% 50%, rgba(var(--c), .06) 0%, rgba(var(--c), .10) 52%, rgba(var(--c), .38) 76%, rgba(var(--c), .9) 96%, rgba(var(--c), 1) 100%);
  box-shadow: 0 0 22px rgba(var(--c), .45), inset 0 0 18px rgba(var(--c), .35);
  transition: box-shadow .2s; }
.bubble.up { --c: 34, 224, 122; }
.bubble.down { --c: 255, 77, 94; }
.bubble.flat { --c: 125, 135, 153; box-shadow: 0 0 10px rgba(var(--c), .25), inset 0 0 12px rgba(var(--c), .25); }
.bubble.cbu { --c: 255, 196, 0; }
.bubble.drag { cursor: grabbing; box-shadow: 0 0 40px rgba(var(--c), .8), inset 0 0 24px rgba(var(--c), .5); z-index: 3; }
.bubble .ico { border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; margin-bottom: 3%;
  background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.06)); border: 1px solid rgba(255,255,255,.25); }
.bubble .bn { font-weight: 800; line-height: 1.05; max-width: 86%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.2px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.bubble .bv { font-weight: 600; line-height: 1.15; opacity: .85; font-variant-numeric: tabular-nums; }
.bubble .bc { font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.bubble.pop { animation: pop .4s ease; }
@keyframes pop { 40% { filter: brightness(1.6); } }

.legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; flex-wrap: wrap; color: var(--hint); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot.up { background: var(--up); box-shadow: 0 0 8px var(--up); } .dot.down { background: var(--down); box-shadow: 0 0 8px var(--down); }
.dot.flat { background: var(--flat); }

.cbu { display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, rgba(255,196,0,.12), rgba(255,196,0,.03)); border-color: rgba(255,196,0,.25); }
.cbu b { font-size: 20px; }
.up-t { color: var(--up); font-weight: 700; } .down-t { color: var(--down); font-weight: 700; }

.rate-row { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06); cursor: pointer; }
.rate-row:last-child { border-bottom: 0; }
.rate-row .av { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; }
.rate-row .nm { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rate-row .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.rate-row .c { font-size: 12px; min-width: 52px; text-align: right; }
.rate-row.best .v { color: var(--up); }
.badge { font-size: 10px; background: rgba(34,224,122,.15); color: var(--up); border: 1px solid rgba(34,224,122,.35); border-radius: 8px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }

/* ---------- Formalar ---------- */
input, select, textarea { width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 12px 14px; outline: none; transition: .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.2); }
input::placeholder, textarea::placeholder { color: #69738a; }
input[type=datetime-local], input[type=time] { color-scheme: dark; }
select { width: auto; padding: 8px 12px; color-scheme: dark; }
select option { background: #151b28; }
textarea { resize: none; }
.row { display: flex; gap: 8px; margin: 10px 0; }
.row input { flex: 1; min-width: 0; }
.primary { width: 100%; border: 0; color: #fff; border-radius: 16px; padding: 14px; font-weight: 800; margin-top: 8px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 10px 24px rgba(79,140,255,.35); transition: transform .1s; }
.primary:active { transform: scale(.98); }
.primary:disabled { opacity: .6; }
.ghost { border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); border-radius: 14px; padding: 0 16px; cursor: pointer; }
.hint { color: var(--hint); font-size: 12px; margin: 8px 0; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0; }
.chips button { border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); border-radius: 20px; padding: 7px 13px; font-size: 13px; cursor: pointer; transition: .2s; }
.chips button.on { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* ---------- Ro'yxatlar ---------- */
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.item:last-child { border-bottom: 0; }
.item .ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; font-size: 18px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 600; word-break: break-word; }
.item .tx span { color: var(--hint); font-size: 12px; }
.item .am { font-weight: 800; white-space: nowrap; color: #ff8a95; }
.del { border: 0; background: none; color: #5d677b; font-size: 16px; padding: 6px; cursor: pointer; border-radius: 10px; }
.del:hover { color: var(--down); background: rgba(255,77,94,.1); }
.empty { color: var(--hint); text-align: center; padding: 14px 0; font-size: 14px; }
.soon { color: #ffb020 !important; }
details summary { list-style: none; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary h3 { margin: 0; display: inline; }
details summary::after { content: " ▾"; color: var(--hint); }
details[open] summary { margin-bottom: 10px; }
.day-h { font-size: 11px; color: var(--hint); margin: 12px 0 2px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Xarajat statistikasi ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.stat { border-radius: 18px; padding: 12px; border: 1px solid var(--card-b); background: var(--card); }
.stat:nth-child(1) { background: linear-gradient(135deg, rgba(79,140,255,.22), rgba(79,140,255,.05)); }
.stat:nth-child(2) { background: linear-gradient(135deg, rgba(138,92,255,.22), rgba(138,92,255,.05)); }
.stat:nth-child(3) { background: linear-gradient(135deg, rgba(34,224,122,.2), rgba(34,224,122,.04)); }
.stat span { display: block; color: var(--hint); font-size: 12px; }
.stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; gap: 16px; align-items: center; }
#donut { width: 136px; height: 136px; flex: none; filter: drop-shadow(0 0 10px rgba(79,140,255,.2)); }
.dlegend { flex: 1; font-size: 13px; min-width: 0; }
.dlegend div { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.dlegend i { width: 10px; height: 10px; border-radius: 4px; flex: none; }
.dlegend span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Namoz ---------- */
.next { text-align: center; padding: 22px 16px; border: 0; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0f766e, #14b8a6 55%, #2dd4bf); box-shadow: 0 14px 30px rgba(20,184,166,.3); }
.next::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; right: -70px; top: -90px; background: rgba(255,255,255,.12); }
.next .muted { color: rgba(255,255,255,.85); }
.next-name { font-size: 28px; font-weight: 800; margin: 4px 0; letter-spacing: -.4px; }
.next-left { font-size: 16px; font-variant-numeric: tabular-nums; display: inline-block; padding: 4px 12px; border-radius: 12px; background: rgba(0,0,0,.18); }
.pr { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px; border-radius: 14px; margin: 2px 0; }
.pr b { font-variant-numeric: tabular-nums; font-size: 18px; }
.pr.cur { background: rgba(20,184,166,.16); border: 1px solid rgba(45,212,191,.35); }
.pr.past { opacity: .45; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; }
.switch-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.switch-row input[type=time] { width: auto; }

/* ---------- Pastki menyu ---------- */
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; padding: 6px; z-index: 5;
  background: rgba(16, 21, 33, .82); border: 1px solid rgba(255,255,255,.08); border-radius: 22px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--hint);
  gap: 2px; cursor: pointer; padding: 6px 0; border-radius: 16px; transition: .2s; }
.tabs button i { font-style: normal; font-size: 20px; filter: grayscale(1); opacity: .6; transition: .2s; }
.tabs button.on { color: #fff; font-weight: 700; background: linear-gradient(135deg, rgba(79,140,255,.25), rgba(138,92,255,.25)); }
.tabs button.on i { filter: none; opacity: 1; transform: translateY(-1px); }

/* ---------- Pastdan chiquvchi oyna ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: flex-end; z-index: 10; backdrop-filter: blur(4px); }
.sheet-bg.show { display: flex; }
.sheet { background: #121826; border-top: 1px solid rgba(255,255,255,.1); width: 100%; border-radius: 26px 26px 0 0;
  padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet h2 { margin: 0 0 4px; font-size: 21px; display: flex; align-items: center; gap: 10px; }
.sheet h2 .av { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.sheet .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.sheet .grid div { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.07); border-radius: 16px; padding: 12px; }
.sheet .grid span { display: block; color: var(--hint); font-size: 12px; }
.sheet .grid b { font-size: 19px; }

.toast { position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%) translateY(20px); background: rgba(22,28,42,.95); color: #fff;
  border: 1px solid rgba(255,255,255,.1); padding: 11px 18px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 20; max-width: 90%; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: rgba(255,77,94,.95); }
