/* ============================================================
   RemoteHub — Liquid Glass theme (RoxinStudio style)
   Near-black background · glassmorphism · violet accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --bg:            #08080b;
    --bg-2:          #0e0e13;
    --surface:       rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --border:        rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);

    --accent:        #8c15fb;
    --accent-light:  #c084fc;
    --accent-soft:   rgba(140, 21, 251, 0.18);

    --text:          #fafafa;
    --text-muted:    #a1a1aa;
    --text-dim:      #71717a;

    --ok:            #34d399;
    --warn:          #fbbf24;
    --info:          #60a5fa;
    --review:        #c084fc;
    --danger:        #fb7185;

    --radius:        16px;
    --radius-sm:     12px;
    --radius-lg:     24px;
}

* { border-color: var(--border); }

html {
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    scrollbar-width: thin;
}

body {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(600px circle at 12% 8%,  rgba(140, 21, 251, 0.16), transparent 45%),
        radial-gradient(700px circle at 88% 92%, rgba(140, 21, 251, 0.12), transparent 45%),
        radial-gradient(500px circle at 80% 5%,  rgba(192, 132, 252, 0.08), transparent 40%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ─────────────────────────────────────────── */
.font-head { font-family: 'Unbounded', sans-serif; letter-spacing: -0.02em; }
.font-dm   { font-family: 'DM Sans', sans-serif; }

.text-gradient {
    background: linear-gradient(180deg, #ffffff 0%, var(--accent) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 12px rgba(140, 21, 251, 0.35));
}
.text-gradient-h {
    background: linear-gradient(100deg, #ffffff 0%, #ffffff 45%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }

/* ── Glass surfaces ─────────────────────────────────────── */
.glass {
    position: relative;
    isolation: isolate;
    transform: translateZ(0);
    background: var(--surface);
    -webkit-backdrop-filter: blur(14px) saturate(150%) brightness(1.02);
    backdrop-filter: blur(14px) saturate(150%) brightness(1.02);
    box-shadow:
        inset 0 1px 0 0 rgba(255,255,255,0.10),
        0 0 0 1px rgba(255,255,255,0.06),
        0 18px 40px -22px rgba(0,0,0,0.7);
}

.glass-card {
    position: relative;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(165deg, rgba(24,24,28,0.72) 0%, rgba(14,14,20,0.86) 55%, rgba(18,18,22,0.78) 100%);
    -webkit-backdrop-filter: blur(20px) saturate(1.08);
    backdrop-filter: blur(20px) saturate(1.08);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.06),
        0 24px 56px -28px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.07);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.glass-card:hover.is-interactive {
    border-color: var(--border-strong);
    transform: translateY(-3px);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.12),
        0 0 26px -8px rgba(140,21,251,0.25),
        0 30px 64px -26px rgba(0,0,0,0.65),
        inset 0 1px 0 rgba(255,255,255,0.10);
}

.glass-nav {
    position: relative;
    z-index: 0;
    isolation: isolate;
    transform: translateZ(0);
    background: rgba(20,20,26,0.10);
    -webkit-backdrop-filter: blur(16px) saturate(160%) brightness(1.05);
    backdrop-filter: blur(16px) saturate(160%) brightness(1.05);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 0 rgba(255,255,255,0.22),
        inset 0 -1px 0 0 rgba(0,0,0,0.28),
        0 0 0 1px rgba(255,255,255,0.06),
        0 22px 48px -20px rgba(0,0,0,0.6);
}
.glass-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
    -webkit-box-shadow: inset 2px 2px 0px -2px rgba(255,255,255,0.32), inset 0 0 3px 1px rgba(255,255,255,0.22);
    box-shadow: inset 6px 6px 0px -6px rgba(255,255,255,0.28), inset 0 0 8px 1px rgba(255,255,255,0.18);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .glass-nav { background: rgba(18,18,24,0.92); }
}

.glass-icon {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(155deg, rgba(62,62,72,0.55) 0%, rgba(36,36,44,0.7) 100%);
    border: 1px solid var(--border-strong);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 30px -14px rgba(0,0,0,0.5);
}

.accent-icon {
    background: linear-gradient(155deg, rgba(140,21,251,0.9) 0%, rgba(109,40,217,0.9) 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 10px 30px -8px rgba(140,21,251,0.5);
    border: 1px solid rgba(192,132,252,0.4);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
    position: relative;
    overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: linear-gradient(160deg, #a855f7 0%, var(--accent) 55%, #6d28d9 100%);
    color: #fff;
    border: 1px solid rgba(192,132,252,0.5);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 28px -10px rgba(140,21,251,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    cursor: pointer;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 16px 36px -10px rgba(140,21,251,0.7), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-glass {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
    cursor: pointer;
}
.btn-glass:hover { background: var(--surface-hover); border-color: var(--border-strong); }

/* ── Inputs ─────────────────────────────────────────────── */
.field {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.65rem 0.9rem;
    font-size: 0.875rem;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field::placeholder { color: var(--text-dim); }
.field:focus {
    outline: none;
    border-color: rgba(192,132,252,0.55);
    background: rgba(255,255,255,0.05);
    box-shadow: 0 0 0 3px rgba(140,21,251,0.18);
}
.field option { background: #16161c; color: var(--text); }

/* ── Task attachments ───────────────────────────────────────── */
.att-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.att-tool {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.att-tool:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.att-tool.is-rec {
    color: #fff;
    background: linear-gradient(160deg, #fb7185, #e11d48);
    border-color: rgba(251,113,133,.45);
    box-shadow: 0 8px 22px -10px rgba(225,29,72,.55);
    animation: att-pulse 1.1s ease-in-out infinite;
}
@keyframes att-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
.att-rec-label {
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 600;
}
.att-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.5rem;
    margin-bottom: 0.85rem;
    align-items: flex-start;
}
.att-card {
    position: relative;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}
.att-card.att-image,
.att-card.att-video {
    width: 4.25rem;
    flex: 0 0 4.25rem;
}
.att-card img, .att-card video {
    display: block;
    width: 4.25rem;
    height: 4.25rem;
    object-fit: cover;
    background: #0a0a0e;
}
.att-card.att-audio {
    flex: 0 1 15rem;
    width: 100%;
    max-width: 15rem;
    padding: 0.5rem 0.6rem 0.55rem;
}
.att-card.att-audio:has(.att-remove) {
    padding-right: 2.1rem;
}
.att-audio-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    padding-right: 0.15rem;
}
.att-audio-head i { color: var(--accent-light); flex-shrink: 0; }
.att-name { flex: 1; min-width: 0; }
.att-size { opacity: 0.7; white-space: nowrap; margin-right: 0.1rem; flex-shrink: 0; }
.att-card audio { width: 100%; height: 1.85rem; max-width: 100%; }
.att-remove {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.65);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    z-index: 2;
}
.att-remove:hover { background: rgba(225,29,72,0.85); }
.att-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.35rem;
}

/* compact chips in task lists */
.att-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
    margin-bottom: 0.15rem;
    align-items: center;
}
.att-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 1.85rem;
    padding: 0 0.55rem;
    border-radius: 0.55rem;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    max-width: 9.5rem;
}
.att-chip i { color: var(--accent-light); font-size: 0.72rem; }
.att-chip-sz { opacity: 0.65; font-weight: 500; }
.att-chip:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.att-chip-img {
    padding: 0;
    width: 1.85rem;
    height: 1.85rem;
    overflow: hidden;
}
.att-chip-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.att-chip-x {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}
.att-chip-x:hover { background: rgba(225,29,72,0.9); }
.att-chip.att-chip-img .att-chip-x { top: -0.3rem; right: -0.3rem; }

/* lightbox */
.att-viewer {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(8px);
}
.att-viewer.hidden { display: none; }
.att-viewer-panel {
    width: min(560px, 100%);
    max-height: min(88dvh, 88vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.att-viewer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}
.att-viewer-title {
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
    min-width: 0;
    flex: 1;
}
.att-viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.att-viewer-nav, .att-viewer-close {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
}
.att-viewer-nav:hover, .att-viewer-close:hover { color: #fff; background: var(--surface-hover); }
.att-viewer-count {
    font-size: 0.7rem;
    color: var(--text-dim);
    min-width: 2.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.att-viewer-body {
    padding: 1rem;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
}
.att-viewer-media {
    max-width: 100%;
    max-height: min(70dvh, 70vh);
    border-radius: 0.75rem;
    background: #0a0a0e;
}
.att-viewer-audio {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.att-viewer-mic {
    font-size: 1.75rem;
    color: var(--accent-light);
}
.att-viewer-audio audio { width: min(100%, 22rem); }

/* Date input dark scheme */
input[type="date"] { color-scheme: dark; }

/* ── Nav item (sidebar) ─────────────────────────────────── */
.nav-item {
    width: 100%;
    display: flex; align-items: center; gap: .75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all .18s ease;
    cursor: pointer;
}
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active {
    color: #fff;
    background: linear-gradient(160deg, rgba(140,21,251,0.28), rgba(140,21,251,0.12));
    border-color: rgba(192,132,252,0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 8px 24px -12px rgba(140,21,251,0.5);
}

/* ── Status pills ───────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 700; border: 1px solid transparent; }
.pill-new     { background: rgba(96,165,250,0.14);  color: var(--info);   border-color: rgba(96,165,250,0.3); }
.pill-prog    { background: rgba(251,191,36,0.14);  color: var(--warn);   border-color: rgba(251,191,36,0.3); }
.pill-review  { background: rgba(192,132,252,0.16); color: var(--review); border-color: rgba(192,132,252,0.35); }
.pill-done    { background: rgba(52,211,153,0.14);  color: var(--ok);     border-color: rgba(52,211,153,0.3); }
.pill-danger  { background: rgba(251,113,133,0.14); color: var(--danger); border-color: rgba(251,113,133,0.3); }

/* Status <select> as pill */
.pill-select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 1.6rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .55rem center; }

/* ── Tables ─────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; text-align: left; }
.tbl thead tr { border-bottom: 1px solid var(--border); }
.tbl th { padding: 1rem 1.25rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.tbl td { padding: 1rem 1.25rem; font-size: .875rem; color: var(--text-muted); }
.tbl tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); transition: background .15s ease; }
.tbl tbody tr:hover { background: rgba(255,255,255,0.025); }
.tbl tbody tr:last-child { border-bottom: none; }

/* ── Avatar ─────────────────────────────────────────────── */
.avatar {
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px; font-weight: 700;
    background: linear-gradient(155deg, rgba(140,21,251,0.35), rgba(140,21,251,0.15));
    color: var(--accent-light);
    border: 1px solid rgba(192,132,252,0.3);
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes floatY { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.float { animation: floatY 3.5s ease-in-out infinite; }

@keyframes slideUp { from{opacity:0; transform:translateY(14px)} to{opacity:1; transform:translateY(0)} }
.rise { animation: slideUp .25s ease-out both; }

@keyframes modalIn { from{opacity:0; transform:scale(.96)} to{opacity:1; transform:scale(1)} }
.modal-in { animation: modalIn .15s ease-out; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

@media (prefers-reduced-motion: reduce) {
    .float, .rise, .modal-in, .spin { animation: none; }
}

/* ============================================================
   Custom UI: selects, datepicker, modal, toast (no native)
   ============================================================ */

/* ── Custom select ──────────────────────────────────────── */
.cselect { position: relative; display: inline-flex; vertical-align: middle; }
.cselect-trigger {
    display: inline-flex; align-items: center; justify-content: space-between; gap: .5rem;
    width: 100%; font: inherit; cursor: pointer; user-select: none; color: var(--text);
}
.cselect-field {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    transition: border-color .15s ease, background .15s ease;
}
.cselect-field:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.05); }
.cselect.open .cselect-field { border-color: rgba(192,132,252,0.55); box-shadow: 0 0 0 3px rgba(140,21,251,0.16); }
.cselect-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-arrow { font-size: .6rem; opacity: .55; transition: transform .18s ease; }
.cselect.open .cselect-arrow { transform: rotate(180deg); }

.cselect-menu {
    position: fixed;
    display: none;
    z-index: 200;
    min-width: 10rem;
    max-width: 20rem;
    max-height: 15rem;
    overflow-y: auto;
    padding: .35rem;
    border-radius: 14px;
    background: rgba(22,22,28,0.94);
    -webkit-backdrop-filter: blur(18px) saturate(155%);
    backdrop-filter: blur(18px) saturate(155%);
    border: 1px solid var(--border);
    box-shadow: 0 24px 50px -16px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.08);
}
.cselect-menu.open { display: block; animation: csIn .14s ease-out; }
@keyframes csIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.cselect-opt {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .7rem; border-radius: 9px;
    font-size: .8rem; color: var(--text-muted); cursor: pointer; white-space: nowrap;
    transition: background .12s ease, color .12s ease;
}
.cselect-opt:hover { background: var(--surface-hover); color: var(--text); }
.cselect-opt.is-active { color: var(--accent-light); }
.cselect-opt.is-active::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-left: auto; font-size: .68rem; }

/* pill-trigger keeps pill look but adds arrow room */
.cselect-trigger.pill { cursor: pointer; }

/* ── Custom date picker ─────────────────────────────────── */
.cdate { position: relative; display: block; }
.cdate-trigger {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    width: 100%; cursor: pointer; user-select: none;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    font-size: 0.875rem; color: var(--text);
    transition: border-color .15s ease, background .15s ease;
}
.cdate-trigger:hover { border-color: var(--border-strong); background: rgba(255,255,255,0.05); }
.cdate.open .cdate-trigger { border-color: rgba(192,132,252,0.55); box-shadow: 0 0 0 3px rgba(140,21,251,0.16); }
.cdate-trigger.placeholder .cdate-label { color: var(--text-dim); }
.cdate-ico { color: var(--accent-light); }

.cdate-pop {
    position: fixed;
    display: none;
    z-index: 210;
    width: 17.5rem;
    padding: .85rem;
    border-radius: 16px;
    background: rgba(22,22,28,0.96);
    -webkit-backdrop-filter: blur(18px) saturate(155%);
    backdrop-filter: blur(18px) saturate(155%);
    border: 1px solid var(--border);
    box-shadow: 0 26px 54px -16px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.08);
}
.cdate-pop.open { display: block; animation: csIn .14s ease-out; }
.cdate-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.cdate-title { font-weight: 600; font-size: .85rem; color: #fff; }
.cdate-nav { width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border-radius: 9px; cursor: pointer; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); transition: all .15s ease; }
.cdate-nav:hover { color: #fff; background: var(--surface-hover); }
.cdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cdate-dow { font-size: .58rem; text-align: center; color: var(--text-dim); padding-bottom: .3rem; text-transform: uppercase; letter-spacing: .04em; }
.cdate-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: .78rem; border-radius: 9px; color: var(--text-muted); cursor: pointer; transition: background .12s ease, color .12s ease; }
.cdate-cell:hover { background: var(--surface-hover); color: #fff; }
.cdate-cell.dim { color: var(--text-dim); opacity: .35; }
.cdate-cell.today { box-shadow: inset 0 0 0 1px rgba(192,132,252,0.5); }
.cdate-cell.sel { background: linear-gradient(160deg, #a855f7, var(--accent)); color: #fff; box-shadow: 0 6px 16px -6px rgba(140,21,251,0.6); }
.cdate-cell.disabled { opacity: .2; pointer-events: none; }

/* ── Toast ──────────────────────────────────────────────── */
#ui-toasts {
    position: fixed;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: min(36rem, calc(100vw - 1.5rem));
    display: flex;
    flex-direction: column;
    gap: .5rem;
    align-items: stretch;
    pointer-events: none;
}
.ui-toast {
    pointer-events: auto;
    width: 100%;
    padding: .75rem 1.1rem;
    border-radius: 14px;
    font-size: .85rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .65rem;
    background: rgba(22,22,28,0.94);
    -webkit-backdrop-filter: blur(18px) saturate(155%);
    backdrop-filter: blur(18px) saturate(155%);
    border: 1px solid var(--border);
    box-shadow: 0 24px 50px -16px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.08);
    animation: toastIn .2s ease-out;
}
.ui-toast > span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ui-toast.hide { animation: toastOut .2s ease-in forwards; }
.ui-toast .ico { font-size: 1rem; flex-shrink: 0; }
.ui-toast.ok  { border-color: rgba(52,211,153,0.35); }  .ui-toast.ok .ico  { color: var(--ok); }
.ui-toast.err { border-color: rgba(251,113,133,0.4); }  .ui-toast.err .ico { color: var(--danger); }
.ui-toast.info .ico { color: var(--accent-light); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ── Confirm / dialog modal ─────────────────────────────── */
.ui-backdrop {
    position: fixed; inset: 0; z-index: 250;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: rgba(0,0,0,0.6);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    animation: fadeIn .15s ease;
}
.ui-backdrop.hide { animation: fadeOut .15s ease forwards; }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.ui-dialog { width: 100%; max-width: 24rem; padding: 1.5rem; text-align: center; }
.ui-dialog-icon { width: 3.5rem; height: 3.5rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; font-size: 1.4rem; }
.ui-dialog-icon.danger { background: rgba(251,113,133,0.12); color: var(--danger); border: 1px solid rgba(251,113,133,0.3); }
.ui-dialog-icon.info   { background: var(--accent-soft); color: var(--accent-light); border: 1px solid rgba(192,132,252,0.3); }
.ui-dialog-title { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 1.05rem; color: #fff; margin-bottom: .4rem; }
.ui-dialog-msg { font-size: .875rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 1.4rem; }
.ui-dialog-actions { display: flex; gap: .6rem; }
.ui-dialog-actions > * { flex: 1; padding: .65rem; font-size: .875rem; font-weight: 600; }

/* ============================================================
   Mobile / Telegram WebApp
   ============================================================ */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* Mobile shell: drawer sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0,0,0,0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}
.sidebar-backdrop.open { display: block; }

/* Responsive show/hide */
.mob-only { display: none; }
.desk-only { display: block; }

.m-card {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.m-card-lg { padding: 1rem 1.1rem; }
.m-card-meta {
    display: flex; flex-wrap: wrap; gap: 0.55rem 0.85rem;
    margin-top: 0.55rem;
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Desktop: always show sidebar, never phone chrome */
@media (min-width: 768px) {
    .mob-only { display: none !important; }
    .desk-only { display: block !important; }

    aside#sidebar {
        position: relative !important;
        transform: none !important;
        width: 15rem !important;
        border-radius: 1.5rem !important;
    }
    .sidebar-backdrop,
    .sidebar-backdrop.open { display: none !important; }

    body.mgr-shell {
        flex-direction: row !important;
        padding: 1rem !important;
        gap: 1rem !important;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    body.mgr-shell > main {
        padding: 0 !important;
        gap: 1rem !important;
    }
    .mgr-header {
        flex-wrap: nowrap !important;
        height: 4rem !important;
        border-radius: 1.5rem !important;
    }
}

@media (max-width: 767px) {
    .mob-only { display: block !important; }
    .desk-only { display: none !important; }

    body.mgr-shell {
        height: 100dvh;
        height: 100vh;
        padding: 0 !important;
        gap: 0 !important;
        flex-direction: column !important;
        overflow: hidden;
    }

    aside#sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 50;
        width: min(18rem, 86vw) !important;
        max-width: 18rem;
        border-radius: 0 !important;
        transform: translateX(-105%);
        transition: transform .22s ease;
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    aside#sidebar.open { transform: translateX(0); }

    body.mgr-shell > main {
        flex: 1;
        min-height: 0;
        width: 100%;
        padding: 0.55rem;
        padding-top: calc(0.55rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
        gap: 0.55rem !important;
    }

    .mgr-header {
        height: 3.5rem !important;
        min-height: 3.5rem;
        padding: 0.5rem 0.7rem !important;
        flex-wrap: nowrap !important;
        gap: 0.45rem !important;
        border-radius: 1rem !important;
    }
    .mgr-scroll {
        padding-right: 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.55rem !important;
        margin-bottom: 0.75rem !important;
    }
    .kpi-grid .glass-card { padding: 0.8rem !important; }
    .kpi-grid .text-3xl { font-size: 1.3rem !important; }
    .kpi-grid .w-12 { width: 2.2rem; height: 2.2rem; font-size: 0.95rem; }
    .kpi-grid .text-xs { font-size: 0.62rem; }

    .dash-charts .h-56 { height: 11rem; }
    .dash-charts .p-6 { padding: 1rem !important; }
    .dash-charts h4 { font-size: 0.9rem; }

    .glass-card { border-radius: 1rem; }
    .glass-card.is-interactive:hover { transform: none; }

    .glass, .glass-card, .glass-nav {
        -webkit-backdrop-filter: blur(10px) saturate(130%);
        backdrop-filter: blur(10px) saturate(130%);
    }

    #modal-task { align-items: flex-end; padding: 0 !important; }
    #modal-task .glass-card {
        max-height: min(92dvh, 92vh);
        width: 100%;
        max-width: none;
        border-radius: 1.25rem 1.25rem 0 0;
        display: flex;
        flex-direction: column;
    }
    #modal-task form { overflow-y: auto; -webkit-overflow-scrolling: touch; }

    .cselect, .cselect-trigger { width: 100%; }
    .cselect-field { width: 100%; min-height: 2.75rem; }

    body { background-attachment: scroll; }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .login-card { padding: 1.5rem !important; }
    .login-card h1 { font-size: 1.65rem !important; }
}

/* Touch targets */
@media (hover: none) {
    .nav-item, .btn-primary, .btn-glass, .cselect-opt, .cdate-cell {
        min-height: 2.75rem;
    }
    .cselect-opt { padding: 0.65rem 0.75rem; }
}
