/* =====================================================
   MY GALLERY - macOS Style Theme
   Colors Badalne Hain To Sirf :root Me Badlo
   ===================================================== */
:root {
  --accent: #007AFF;
  --accent-soft: rgba(0, 122, 255, .13);
  --win: #FFFFFF;
  --side: rgba(238, 238, 243, .66);
  --line: rgba(0, 0, 0, .1);
  --text: #1D1D1F;
  --muted: #6E6E73;
  --hover: rgba(0, 0, 0, .05);
  --select: rgba(0, 0, 0, .08);
  --ctrl: rgba(0, 0, 0, .06);
  --ctrl-on: #FFFFFF;
  --tile: #EFEFF2;
  --glass: rgba(248, 248, 250, .82);
  --danger: #FF3B30;
  --ok: #34C759;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0A84FF;
    --accent-soft: rgba(10, 132, 255, .24);
    --win: #1E1E20;
    --side: rgba(42, 42, 46, .62);
    --line: rgba(255, 255, 255, .1);
    --text: #F5F5F7;
    --muted: #98989D;
    --hover: rgba(255, 255, 255, .06);
    --select: rgba(255, 255, 255, .1);
    --ctrl: rgba(255, 255, 255, .09);
    --ctrl-on: #5A5A5F;
    --tile: #2C2C2E;
    --glass: rgba(38, 38, 42, .84);
    --danger: #FF453A;
    --ok: #30D158;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }

/* ---------- Desktop Wallpaper ---------- */
body {
  font: 13px/1.45 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background-color: #1C2B52;
  background-image:
    radial-gradient(70% 60% at 12% 8%, rgba(124, 92, 255, .95), transparent 70%),
    radial-gradient(55% 50% at 92% 18%, rgba(255, 122, 156, .8), transparent 70%),
    radial-gradient(80% 60% at 60% 105%, rgba(31, 182, 201, .85), transparent 70%),
    linear-gradient(160deg, #26407A, #111B38);
  background-attachment: fixed;
}
body.no-scroll { overflow: hidden; }
.ic { width: 16px; height: 16px; flex: none; }
.logo { width: 18px; height: 18px; flex: none; display: block; }

/* ---------- Menu Bar ---------- */
.menubar {
  position: fixed; inset: 0 0 auto 0; height: 26px; z-index: 50;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: rgba(20, 22, 40, .28);
  -webkit-backdrop-filter: blur(30px) saturate(160%); backdrop-filter: blur(30px) saturate(160%);
  color: #fff; font-size: 13px;
}
.menubar .logo { width: 15px; height: 15px; }
.menubar b { font-weight: 700; }
.menubar .mb-right { margin-left: auto; opacity: .9; }
.menubar [data-clock] { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Window ---------- */
body.app { display: flex; align-items: center; justify-content: center; padding: 42px 28px 28px; min-height: 100vh; }
.window {
  width: min(1320px, 100%); height: min(880px, calc(100vh - 70px));
  display: flex; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .4), inset 0 0 0 .5px rgba(255, 255, 255, .15), 0 30px 90px rgba(0, 0, 0, .5);
}

/* ---------- Sidebar (Glass) ---------- */
.sidebar {
  width: 238px; flex: none; display: flex; flex-direction: column; padding: 14px 10px 12px;
  background: var(--side);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  border-right: .5px solid var(--line);
}
.lights { display: flex; gap: 8px; padding: 1px 8px 16px; }
.lights a, .lights i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2); }
.l-red { background: #FF5F57; } .l-yel { background: #FEBC2E; } .l-grn { background: #28C840; }
.side-scroll { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side-h { font-size: 11px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; }
.side-h:first-child { padding-top: 0; }
.side-link {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px; margin: 1px 0;
  border-radius: 6px; color: var(--text); text-decoration: none;
}
.side-link .ic { color: var(--accent); }
.side-link .count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-link:hover { background: var(--hover); }
.side-link.active { background: var(--select); font-weight: 500; }
.side-foot { border-top: .5px solid var(--line); padding: 12px 6px 0; display: grid; gap: 8px; }
.id-chip span { display: block; font-size: 11px; color: var(--muted); }
.id-chip b { font-size: 14px; letter-spacing: .3px; }
.usage { font-size: 12px; color: var(--muted); }

/* ---------- Content ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--win); }
.toolbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  border-bottom: .5px solid var(--line);
}
.tb-title { min-width: 0; }
.tb-title h1 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { margin: 0; font-size: 11.5px; color: var(--muted); }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.scroll { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 28px; padding: 0 12px; border: 0; border-radius: 7px; cursor: pointer;
  font: 500 13px var(--font); color: var(--text); background: var(--ctrl); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--select); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.1); }
.btn-sm { height: 24px; padding: 0 9px; font-size: 12px; }
.icon-btn { width: 30px; padding: 0; }
.btn:focus-visible, .side-link:focus-visible, .seg a:focus-visible, .month-card:focus-visible, .copy:focus-visible {
  outline: 3px solid var(--accent-soft); outline-offset: 1px; box-shadow: 0 0 0 1px var(--accent);
}
.only-mobile { display: none; }

.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--ctrl); }
.seg a { padding: 3px 13px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 12.5px; }
.seg a.on { background: var(--ctrl-on); box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .06); }

.field {
  height: 28px; padding: 0 10px; min-width: 220px; border-radius: 7px;
  border: .5px solid var(--line); background: var(--win); color: var(--text); font: 13px var(--font);
  box-shadow: inset 0 .5px 1.5px rgba(0, 0, 0, .08);
}
.field:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- Library (Saal / Mahine) ---------- */
.year { margin-bottom: 36px; }
.year h2 { margin: 0 0 14px; font-size: 30px; font-weight: 700; letter-spacing: -.6px; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px 20px; }
.month-card { display: block; color: inherit; text-decoration: none; border-radius: 10px; }
.cover {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px;
  background: var(--tile); box-shadow: 0 0 0 .5px var(--line);
}
.cover img, .cover video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .45s ease; }
.month-card:hover .cover img, .month-card:hover .cover video { transform: scale(1.035); }
.mc-title { margin: 9px 0 1px; font-size: 15px; font-weight: 600; }
.mc-meta { font-size: 12px; color: var(--muted); }

/* ---------- Month Grid ---------- */
.day { margin-bottom: 26px; }
.day h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.day h3 span { margin-left: 8px; font-weight: 400; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px; }
.tile {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; margin: 0; border: 0;
  overflow: hidden; cursor: pointer; background: var(--tile);
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile::after { content: ""; position: absolute; inset: 0; transition: background .15s; }
.tile:hover::after { background: rgba(0, 0, 0, .1); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.badge {
  position: absolute; right: 7px; bottom: 6px; z-index: 1; display: flex; align-items: center; gap: 4px;
  color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .7);
}
.badge .ic { width: 10px; height: 10px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }

/* ---------- Empty ---------- */
.empty { height: 100%; min-height: 320px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.em-icon { width: 64px; height: 64px; margin: 0 auto 14px; opacity: .55; }
.em-icon .ic { width: 64px; height: 64px; stroke-width: 1.2; }
.empty h2 { margin: 0 0 6px; font-size: 20px; color: var(--text); }
.empty p { margin: 0 0 18px; }

/* ---------- Viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; color: #fff;
  background: rgba(8, 8, 10, .94);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.viewer.open { display: flex; animation: fade .18s ease; }
.v-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.v-bar .btn { background: rgba(255, 255, 255, .12); color: #fff; }
.v-bar .btn:hover { background: rgba(255, 255, 255, .2); }
.v-info { min-width: 0; }
.v-info b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-info span { font-size: 11.5px; color: rgba(255, 255, 255, .6); }
.v-count { font-size: 12px; color: rgba(255, 255, 255, .6); font-variant-numeric: tabular-nums; }
.v-stage { position: relative; flex: 1; min-height: 0; display: flex; padding: 0 70px 24px; }
.v-media { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.v-media img, .v-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 12px 50px rgba(0, 0, 0, .5); }
.v-nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%);
  width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
}
.v-nav:hover { background: rgba(255, 255, 255, .22); }
.v-nav:disabled { opacity: .2; cursor: default; }
.v-nav .ic { width: 20px; height: 20px; }
.v-prev { left: 16px; } .v-next { right: 16px; }

/* ---------- Upload ---------- */
.drop {
  position: fixed; inset: 0; z-index: 95; display: none; align-items: center; justify-content: center;
  background: rgba(0, 122, 255, .14); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.drop.show { display: flex; }
.drop > div {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 64px;
  border: 2px dashed var(--accent); border-radius: 18px; background: var(--glass);
  font-size: 17px; font-weight: 600; color: var(--text);
}
.drop .ic { width: 40px; height: 40px; color: var(--accent); }
.up-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 340px; max-height: 60vh;
  display: none; flex-direction: column; overflow: hidden; border-radius: 12px; color: var(--text);
  background: var(--glass); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--line), 0 18px 50px rgba(0, 0, 0, .3);
}
.up-panel.show { display: flex; animation: pop .18s ease; }
.up-head { display: flex; justify-content: space-between; padding: 12px 14px; font-weight: 600; border-bottom: .5px solid var(--line); }
.up-head span:last-child { font-weight: 400; color: var(--muted); }
.up-list { overflow-y: auto; padding: 6px 0; }
.up-row { padding: 8px 14px; }
.up-name { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.up-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { flex: none; font-size: 11.5px; color: var(--muted); }
.up-bar { height: 4px; margin-top: 6px; overflow: hidden; border-radius: 2px; background: var(--ctrl); }
.up-bar i { display: block; width: 0; height: 100%; background: var(--accent); transition: width .15s; }
.up-row.done .up-bar i { background: var(--ok); width: 100%; }
.up-row.err .up-bar i { background: var(--danger); width: 100%; }
.up-row.err .up-state { color: var(--danger); }

/* ---------- Confirm Dialog ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 120; display: none; justify-content: center; background: rgba(0, 0, 0, .28); }
.sheet-bg.show { display: flex; }
.sheet {
  align-self: flex-start; margin-top: 18vh; width: 272px; padding: 20px 16px 16px; text-align: center;
  border-radius: 12px; color: var(--text); background: var(--glass);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--line), 0 24px 60px rgba(0, 0, 0, .4); animation: pop .16s ease;
}
.sheet .logo { width: 52px; height: 52px; margin: 0 auto; }
.sheet h4 { margin: 12px 0 4px; font-size: 13px; }
.sheet p { margin: 0 0 16px; font-size: 11.5px; color: var(--muted); }
.sheet .row { display: flex; gap: 8px; }
.sheet .row .btn { flex: 1; }

/* ---------- Lock Screen (Login) ---------- */
body.lock-page { min-height: 100vh; }
.lock {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 7vh 20px 12vh; color: #fff; text-align: center; text-shadow: 0 1px 12px rgba(0, 0, 0, .25);
}
.lock-date { font-size: 20px; font-weight: 600; opacity: .9; }
.lock-clock { font-size: clamp(72px, 14vw, 128px); font-weight: 700; line-height: 1; letter-spacing: -3px; font-variant-numeric: tabular-nums; }
.lock-box { width: 280px; }
.avatar {
  width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .22); box-shadow: 0 10px 30px rgba(0, 0, 0, .25), inset 0 0 0 .5px rgba(255, 255, 255, .4);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.avatar .logo { width: 56px; height: 56px; }
.lock-box h1 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }
.pill {
  display: flex; align-items: center; padding: 4px 4px 4px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .2); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .4);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.pill:focus-within { background: rgba(255, 255, 255, .28); }
.pill input {
  flex: 1; min-width: 0; height: 30px; border: 0; outline: 0; background: none;
  color: #fff; font: 15px var(--font); letter-spacing: .4px;
}
.pill input::placeholder { color: rgba(255, 255, 255, .72); letter-spacing: 0; }
.pill button {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .32); color: #fff; cursor: pointer;
}
.pill button:hover { background: rgba(255, 255, 255, .45); }
.pill button:focus-visible { outline: 2px solid #fff; }
.lock-err { display: inline-block; margin-top: 12px; padding: 5px 12px; border-radius: 8px; font-size: 12.5px; background: rgba(255, 59, 48, .6); text-shadow: none; }
.lock-hint { margin-top: 12px; font-size: 12px; opacity: .75; }
.shake { animation: shake .45s; }

/* ---------- Admin ---------- */
.notice { margin-bottom: 16px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.notice-err { background: rgba(255, 59, 48, .14); color: var(--danger); }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.table-wrap { overflow-x: auto; border-radius: 10px; box-shadow: 0 0 0 .5px var(--line); }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.table th { padding: 8px 12px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); border-bottom: .5px solid var(--line); }
.table td { padding: 9px 12px; }
.table tbody tr:nth-child(even) { background: var(--hover); }
.table .right { text-align: right; }
.table .muted { color: var(--muted); text-align: center; padding: 30px; }
.copy { vertical-align: middle; margin-left: 4px; padding: 3px; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.copy:hover { background: var(--hover); color: var(--accent); }
.copy .ic { width: 13px; height: 13px; display: block; }
.copy.done { color: var(--ok); }

/* ---------- Animations (Neeche) ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }


/* =====================================================
   NEW FEATURES
   ===================================================== */

/* ---------- Sidebar Extras ---------- */
.side-h-row { display: flex; align-items: center; justify-content: space-between; }
.side-add { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; }
.side-add:hover { background: var(--hover); color: var(--accent); }
.side-add .ic { width: 14px; height: 14px; }
.side-empty { padding: 3px 10px; font-size: 12px; color: var(--muted); }
.side-btns { display: flex; gap: 6px; }
.side-btns .btn:first-child { flex: 1; }

/* ---------- Common ---------- */
.muted { color: var(--muted); }
.flex { flex: 1; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--ctrl); color: var(--muted); }
.tag-ok { background: rgba(52, 199, 89, .16); color: var(--ok); }
.tag-off { background: rgba(255, 59, 48, .14); color: var(--danger); }
.btn.on { color: var(--danger); }
.btn.on .ic { fill: currentColor; }
.field-sm { min-width: 150px; width: 150px; }
.field-xs { min-width: 0; width: 80px; height: 24px; }
select.field { padding-right: 6px; }
textarea.field { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.actions { white-space: nowrap; }
.actions > * { margin-left: 4px; }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Tile Badges + Select Mode ---------- */
.fav-dot { position: absolute; left: 6px; bottom: 5px; z-index: 1; color: #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.fav-dot .ic { width: 13px; height: 13px; fill: currentColor; }
.left-badge { position: absolute; left: 6px; top: 6px; z-index: 1; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600; color: #fff; background: rgba(0, 0, 0, .5); }
.sel-mark {
  position: absolute; right: 6px; top: 6px; z-index: 2; display: none; width: 22px; height: 22px; place-items: center;
  border-radius: 50%; border: 1.5px solid #fff; background: rgba(0, 0, 0, .2); color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.sel-mark .ic { width: 13px; height: 13px; opacity: 0; stroke-width: 3; }
body.selecting .sel-mark { display: grid; }
.tile.selected .sel-mark { background: var(--accent); border-color: var(--accent); }
.tile.selected .sel-mark .ic { opacity: 1; }
.tile.selected img, .tile.selected video { transform: scale(.9); border-radius: 6px; transition: transform .15s; }
.tile.selected { background: var(--accent-soft); }

.select-bar {
  position: fixed; left: 50%; bottom: 22px; z-index: 80; transform: translate(-50%, 140%); display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 24px); padding: 8px 10px; border-radius: 14px; overflow-x: auto;
  background: var(--glass); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--line), 0 18px 50px rgba(0, 0, 0, .3); transition: transform .25s ease;
}
.select-bar.show { transform: translate(-50%, 0); }
#selCount { padding: 0 8px; font-weight: 600; white-space: nowrap; }

/* ---------- Viewer Extras ---------- */
.v-mark { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.v-bar .btn.on { color: #FF6B6B; }
.v-bar .btn[data-v="slideshow"].on { color: #4DA3FF; }
.v-bar .btn-danger { background: var(--danger); }

/* ---------- Dialog Extras ---------- */
.sheet .field { width: 100%; min-width: 0; margin-bottom: 12px; }
.s-list { max-height: 260px; overflow-y: auto; margin: 0 -6px 12px; text-align: left; }
.s-item { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer; }
.s-item:hover, .s-item:focus-visible { background: var(--accent); color: #fff; outline: 0; }
.s-none { margin: 8px 10px; color: var(--muted); font-size: 12px; }

/* ---------- Privacy Blur ---------- */
.privacy-cover { position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff; font-size: 15px; font-weight: 600; text-shadow: 0 1px 8px rgba(0, 0, 0, .4); pointer-events: none; }
.privacy-cover .ic { width: 44px; height: 44px; }
body.privacy .window, body.privacy .viewer, body.privacy .up-panel, body.privacy .select-bar { filter: blur(30px); }
body.privacy .privacy-cover { display: flex; }

/* ---------- Split Layout (Notes / Contacts) ---------- */
.split { flex: 1; min-height: 0; display: flex; }
.list-pane { width: 300px; flex: none; display: flex; flex-direction: column; border-right: .5px solid var(--line); }
.search { display: flex; align-items: center; gap: 6px; margin: 12px; padding: 0 10px; height: 30px; border-radius: 8px; background: var(--ctrl); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 13px var(--font); }
.list { flex: 1; overflow-y: auto; padding: 0 8px 20px; }
.list-h { padding: 12px 8px 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.list-item { display: grid; width: 100%; gap: 1px; padding: 9px 10px; margin: 1px 0; border: 0; border-radius: 8px; background: none; color: var(--text); font: 13px var(--font); text-align: left; cursor: pointer; }
.list-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item:hover { background: var(--hover); }
.list-item.active { background: var(--accent); color: #fff; }
.list-item.active span { color: rgba(255, 255, 255, .8); }
.list-none { margin: 20px 10px; color: var(--muted); text-align: center; }
.detail-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.detail-pane[hidden], .detail-empty[hidden] { display: none; }
.detail-bar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px; border-bottom: .5px solid var(--line); flex: none; }
.detail-bar .muted { font-size: 12px; }
.save-state { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.detail-scroll { flex: 1; overflow-y: auto; padding: 22px 28px 40px; }
.detail-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); }
.detail-empty h2 { margin: 0 0 6px; font-size: 18px; color: var(--text); }

/* ---------- Notes ---------- */
.note-title { width: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 700 24px/1.3 var(--font); letter-spacing: -.3px; margin-bottom: 10px; }
.note-body { width: 100%; min-height: 260px; border: 0; outline: 0; resize: vertical; background: none; color: var(--text); font: 15px/1.6 var(--font); }
.checklist { margin-top: 18px; padding-top: 14px; border-top: .5px solid var(--line); }
.cl-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cl-row, .cl-add { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.cl-check { width: 18px; height: 18px; flex: none; padding: 0; border: 1.5px solid var(--muted); border-radius: 50%; background: none; cursor: pointer; }
.cl-row.done .cl-check { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--win); }
.cl-row input, .cl-add input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 14px var(--font); padding: 3px 0; }
.cl-row.done input { color: var(--muted); text-decoration: line-through; }
.cl-x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; opacity: 0; }
.cl-row:hover .cl-x, .cl-x:focus-visible { opacity: 1; }
.cl-add { color: var(--muted); }
.cl-add .ic { width: 18px; height: 18px; }

/* ---------- Contacts ---------- */
.contact-row { grid-template-columns: 32px 1fr; align-items: center; column-gap: 10px; }
.contact-row span:not(.avatar-sm) { grid-column: 2; }
.avatar-sm, .avatar-lg { display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; background: linear-gradient(145deg, #A2A2AA, #6E6E76); }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; grid-row: span 2; }
.list-item.active .avatar-sm { background: rgba(255, 255, 255, .25); }
.avatar-lg { width: 88px; height: 88px; margin: 0 auto 12px; font-size: 32px; }
.c-head { text-align: center; margin-bottom: 20px; }
.c-head h2 { margin: 0; font-size: 22px; }
.c-head p { margin: 2px 0 0; }
.c-fields { max-width: 560px; margin: 0 auto; }
.c-field { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 9px 0; border-bottom: .5px solid var(--line); }
.c-label { font-size: 12px; color: var(--muted); text-align: right; padding-top: 2px; }
.c-value { white-space: pre-wrap; word-break: break-word; }
.c-field a { color: var(--accent); text-decoration: none; word-break: break-all; }
.c-photos { max-width: 760px; margin: 28px auto 0; }
.c-photos h3 { margin: 0 0 10px; font-size: 13px; }
.c-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.c-photo { cursor: pointer; }
.c-unlink { position: absolute; right: 5px; top: 5px; z-index: 2; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; }
.c-photo:hover .c-unlink, .c-unlink:focus-visible { opacity: 1; }
.c-form { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.c-row, .c-multi { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.c-row .field, .c-multi .field { width: 100%; min-width: 0; }
.c-multi > div, .c-multi > .btn { grid-column: 2; }
.c-multi > .btn { justify-self: start; }
.c-multi-row { display: grid; grid-template-columns: 96px 1fr 30px; gap: 6px; margin-bottom: 6px; }
.c-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Reminders ---------- */
.r-wrap { max-width: 760px; margin: 0 auto; }
.r-add { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--ctrl); flex-wrap: wrap; }
.r-add-title { flex: 1 1 200px; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 14px var(--font); }
.r-add .field { min-width: 0; width: auto; }
.r-row { display: flex; gap: 12px; padding: 10px 6px; border-bottom: .5px solid var(--line); transition: opacity .3s; }
.r-circle { width: 20px; height: 20px; flex: none; margin-top: 1px; padding: 0; border: 1.5px solid var(--muted); border-radius: 50%; background: none; cursor: pointer; }
.r-add .r-circle { cursor: default; border-style: dashed; }
.r-row.done .r-circle { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--win); }
.r-row.done .r-title { color: var(--muted); }
.r-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.r-title { width: 100%; border: 0; outline: 0; background: none; color: var(--text); font: 14px var(--font); padding: 0; }
.r-due { font-size: 12px; color: var(--muted); }
.r-due.late { color: var(--danger); }
.r-notes-prev { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-edit { display: none; gap: 8px; margin-top: 8px; }
.r-row.open .r-edit { display: grid; }
.r-edit .field { width: 100%; min-width: 0; }
.r-edit-line { display: flex; gap: 6px; flex-wrap: wrap; }
.r-edit-line .field { width: auto; }

/* ---------- Settings ---------- */
.settings { max-width: 760px; margin: 0 auto; display: grid; gap: 16px; }
.panel { padding: 16px 18px; border-radius: 12px; box-shadow: 0 0 0 .5px var(--line); }
.panel h2 { margin: 0 0 10px; font-size: 15px; }
.panel p { margin: 0; }
.panel .form-row { margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { margin: 0; }
.panel-head form { margin: 0; }
.device, .act-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: .5px solid var(--line); }
.panel-head + .device { margin-top: 10px; }
.device .muted { display: block; font-size: 12px; margin-top: 2px; }
.act-row { font-size: 12.5px; flex-wrap: wrap; }
.meter { height: 8px; margin-top: 10px; border-radius: 4px; background: var(--ctrl); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter i.w0 { width: 0%; }
.meter i.w5 { width: 5%; }
.meter i.w10 { width: 10%; }
.meter i.w15 { width: 15%; }
.meter i.w20 { width: 20%; }
.meter i.w25 { width: 25%; }
.meter i.w30 { width: 30%; }
.meter i.w35 { width: 35%; }
.meter i.w40 { width: 40%; }
.meter i.w45 { width: 45%; }
.meter i.w50 { width: 50%; }
.meter i.w55 { width: 55%; }
.meter i.w60 { width: 60%; }
.meter i.w65 { width: 65%; }
.meter i.w70 { width: 70%; }
.meter i.w75 { width: 75%; }
.meter i.w80 { width: 80%; }
.meter i.w85 { width: 85%; }
.meter i.w90 { width: 90%; }
.meter i.w95 { width: 95%; }
.meter i.w100 { width: 100%; }

/* ---------- Lock Screen Extras ---------- */
.pill + .pill { margin-top: 10px; }
.lock-back { display: inline-block; margin-top: 14px; font-size: 12.5px; color: #fff; opacity: .8; text-decoration: none; }
.lock-back:hover { opacity: 1; text-decoration: underline; }

/* ---------- Protection (Save/Drag Band) ---------- */
.tile img, .tile video, .cover img, .cover video, .v-media img, .v-media video {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none;
}
.v-media { color: rgba(255, 255, 255, .6); }
.v-media.loading::after {
  content: ""; width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .15); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mobile ---------- */
.scrim { display: none; }
@media (max-width: 820px) {
  body.app { display: block; padding: 0; }
  .menubar { display: none; }
  .window { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: 270px; background: var(--glass);
    transform: translateX(-100%); transition: transform .25s ease; padding-top: max(14px, env(safe-area-inset-top));
  }
  body.side-open .sidebar { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .3); }
  .only-mobile { display: inline-flex; }
  .toolbar { gap: 8px; padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .tb-title p { display: none; }
  .btn .lbl { display: none; }
  .btn:has(.lbl) { width: 30px; padding: 0; }
  .seg a { padding: 3px 8px; }
  .scroll { padding: 16px 12px 90px; }
  .months { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 12px; }
  .year h2 { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 2px; }
  .v-stage { padding: 0 0 16px; }
  .v-nav { display: none; }
  .v-bar { flex-wrap: wrap; }
  .up-panel { left: 12px; right: 12px; width: auto; bottom: 12px; }
  .field { min-width: 0; flex: 1 1 100%; }
  .list-pane { width: 100%; border-right: 0; }
  .split.show-detail .list-pane { display: none; }
  .split:not(.show-detail) .detail-pane, .split:not(.show-detail) .detail-empty { display: none; }
  .detail-scroll { padding: 16px; }
  .c-field, .c-row, .c-multi { grid-template-columns: 1fr; gap: 4px; }
  .c-label { text-align: left; }
  .c-multi > div, .c-multi > .btn { grid-column: 1; }
  .select-bar { bottom: 12px; }
  .tb-actions { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =====================================================
   PRIVATE + HIDDEN DATA
   ===================================================== */
.seg-full { display: flex; margin: 12px 12px 0; }
.seg-full a { flex: 1; text-align: center; }
.form-row-top { margin-top: 10px !important; }
.tag-priv { background: rgba(94, 92, 230, .16); color: #5E5CE6; }
.p-cards { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
.p-card { padding: 14px 16px; border-radius: 12px; box-shadow: 0 0 0 .5px var(--line); }
.p-card h3 { margin: 0; font-size: 15px; }
.p-card > .muted { margin: 2px 0 0; font-size: 12px; }
.p-body { margin-top: 8px; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.p-item { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.p-item .cl-check { cursor: default; }
.p-item.done { color: var(--muted); text-decoration: line-through; }
.p-item.done .cl-check { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--win); }
.p-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.a-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.a-media { display: grid; gap: 4px; min-width: 0; font-size: 12px; }
.a-media .tile { display: block; border-radius: 10px; overflow: hidden; }
.a-media b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-media .tag { justify-self: start; }
.a-media .btn { justify-self: start; }
.a-video { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.a-video .ic { width: 34px; height: 34px; }
