/* ============ Tokens ============ */
:root {
    --bg: #F4F6FB;
    --bg-2: #E9EEF9;
    --surface: #FFFFFF;
    --surface-2: #F7F9FE;
    --surface-3: #EEF2FB;
    --text: #0F172A;
    --text-2: #334155;
    --muted: #6B7A93;
    --line: #E3E9F3;
    --accent: #2563EB;
    --accent-2: #4F46E5;
    --accent-soft: #E4EDFF;
    --ok: #16A34A;
    --ok-soft: #DCFCE7;
    --warn: #D97706;
    --warn-soft: #FEF3C7;
    --danger: #DC2626;
    --danger-soft: #FEE2E2;
    --low: #64748B;
    --r-xl: 26px;
    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;
    --shadow-1: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px -4px rgba(15, 23, 42, .10);
    --shadow-2: 0 12px 34px -16px rgba(15, 23, 42, .35);
    --shadow-3: 0 22px 60px -24px rgba(15, 23, 42, .55);
    --tab-h: 66px;
}

[data-theme="dark"] {
    --bg: #0B1220;
    --bg-2: #0E1728;
    --surface: #131D2F;
    --surface-2: #16223a;
    --surface-3: #1B2942;
    --text: #E8EEF9;
    --text-2: #C3D0E4;
    --muted: #8FA1BC;
    --line: #223049;
    --accent: #4C86FF;
    --accent-2: #7C6BFF;
    --accent-soft: #17294b;
    --ok: #34D399;
    --ok-soft: #12301f;
    --warn: #FBBF24;
    --warn-soft: #33260c;
    --danger: #F87171;
    --danger-soft: #3a1618;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 14px 40px -18px rgba(0, 0, 0, .8);
    --shadow-3: 0 26px 70px -26px rgba(0, 0, 0, .9);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

body { user-select: none; }
input, textarea { user-select: text; }

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

svg { display: block; }

.app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(120% 55% at 12% -8%, rgba(37, 99, 235, .13), transparent 62%),
        radial-gradient(90% 45% at 96% 2%, rgba(79, 70, 229, .10), transparent 60%),
        var(--bg);
}

/* ============ Topbar ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(140deg, #2563EB, #4F46E5 60%, #7C3AED);
    box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .9);
    flex: 0 0 auto;
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: -.2px; }
.brand-text span {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions { display: flex; gap: 8px; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-1);
    transition: transform .14s ease, background .2s ease;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }

/* ============ Search ============ */
.searchwrap { padding: 0 18px 10px; }

.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 6px 0 12px;
    box-shadow: var(--shadow-1);
}
.search-ico { color: var(--muted); display: grid; place-items: center; }
.search-ico svg { width: 18px; height: 18px; }
.search-field input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    padding: 13px 0;
    min-width: 0;
}
.search-field input::placeholder { color: var(--muted); }
.search-cancel {
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 10px;
    border-radius: 10px;
}

/* ============ View ============ */
.view {
    flex: 1;
    padding: 4px 18px calc(var(--tab-h) + 96px + env(safe-area-inset-bottom));
    animation: fade-in .22s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.section { margin-top: 22px; }
.section:first-child { margin-top: 8px; }

.section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 4px 10px;
}
.section-head h2 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}
.section-head .count {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-2);
    background: var(--surface-3);
    border-radius: 999px;
    padding: 2px 8px;
}
.section-head .line { flex: 1; height: 1px; background: var(--line); }
.section-head.danger h2 { color: var(--danger); }
.section-head.danger .count { color: var(--danger); background: var(--danger-soft); }

/* ============ Hero ============ */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    padding: 20px;
    color: #fff;
    background: linear-gradient(135deg, #1D4ED8 0%, #4F46E5 55%, #6D28D9 100%);
    box-shadow: 0 20px 40px -22px rgba(37, 99, 235, .85);
}
.hero::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -80px;
    top: -110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 68%);
}
.hero-top { display: flex; align-items: flex-start; gap: 16px; }
.hero-copy { flex: 1; min-width: 0; }
.hero-eyebrow {
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .78;
    font-weight: 700;
}
.hero-title { font-size: 20px; font-weight: 800; letter-spacing: -.4px; margin: 4px 0 2px; }
.hero-sub { font-size: 12.5px; opacity: .82; }

.ring {
    --p: 0;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    background:
        conic-gradient(#A5F3FC calc(var(--p) * 1%), rgba(255, 255, 255, .22) 0);
    transition: background .4s ease;
}
.ring-inner {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(15, 23, 42, .28);
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.4px;
    backdrop-filter: blur(4px);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}
.hero-stat {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 15px;
    padding: 10px 11px;
}
.hero-stat b { display: block; font-size: 18px; letter-spacing: -.5px; }
.hero-stat span { font-size: 11px; opacity: .86; }

/* ============ Banner peringatan ============ */
.alert-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--r-lg);
    background: var(--warn-soft);
    border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
}
.alert-card .alert-ico {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--warn) 20%, transparent);
    color: var(--warn);
    flex: 0 0 auto;
}
.alert-card .alert-ico svg { width: 18px; height: 18px; }
.alert-card .alert-body { flex: 1; min-width: 0; }
.alert-card .alert-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.alert-card .alert-text { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.alert-card .alert-actions { display: flex; gap: 8px; margin-top: 10px; }
.alert-card .alert-actions .btn {
    padding: 8px 12px;
    font-size: 12.5px;
    background: color-mix(in srgb, var(--warn) 22%, transparent);
    color: color-mix(in srgb, var(--warn) 80%, #000);
}
[data-theme="dark"] .alert-card .alert-actions .btn { color: var(--warn); }

/* ============ Task card ============ */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px 14px 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
    transition: transform .14s ease, box-shadow .2s ease, border-color .2s ease;
    overflow: hidden;
}
.task-card:active { transform: scale(.988); }
.task-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--p-color, var(--accent));
}
.task-card.overdue { border-color: color-mix(in srgb, var(--danger) 38%, var(--line)); }
.task-card.overdue::before { background: var(--danger); }
.task-card.done { opacity: .62; }
.task-card.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-card.done::before { background: var(--ok); }

.check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--p-color, var(--accent)) 55%, var(--line));
    flex: 0 0 auto;
    margin-top: 1px;
    display: grid;
    place-items: center;
    color: transparent;
    background: transparent;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.check svg { width: 14px; height: 14px; }
.check.is-done {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

.task-body { flex: 1; min-width: 0; }

.task-title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.15px;
    color: var(--text);
    margin: 0 0 6px;
    word-break: break-word;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--muted);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    white-space: nowrap;
    max-width: 100%;
}
.meta-item svg { width: 12px; height: 12px; opacity: .85; }
.meta-item.late { color: var(--danger); background: var(--danger-soft); border-color: transparent; font-weight: 600; }
.meta-item.soon { color: var(--warn); background: var(--warn-soft); border-color: transparent; font-weight: 600; }
.meta-item.cat { color: var(--p-color, var(--accent)); border-color: color-mix(in srgb, var(--p-color, var(--accent)) 26%, var(--line)); background: color-mix(in srgb, var(--p-color, var(--accent)) 9%, transparent); font-weight: 600; }
.meta-item.loc { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }

.task-note {
    margin: 7px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
}

.prio-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--p-color); }
.prio-label { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--p-color); }

.sub-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--muted);
}

/* ============ Beranda ringkas ============ */
.view.home .section { margin-top: 15px; }
.view.home .task-list { gap: 7px; }
.view.home .task-card {
    gap: 9px;
    padding: 9px 10px 10px;
    border-radius: 13px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.view.home .task-card::before { width: 3px; }
.view.home .check { width: 21px; height: 21px; border-width: 1.8px; margin-top: 0; }
.view.home .check svg { width: 11px; height: 11px; }
.view.home .task-title { font-size: 13px; margin: 0 0 3px; }
.view.home .task-meta { font-size: 10px; gap: 4px; }
.view.home .meta-item { padding: 1px 5px; border-radius: 6px; }
.view.home .meta-item svg { width: 10px; height: 10px; }
.view.home .task-note { font-size: 11px; margin-top: 4px; -webkit-line-clamp: 1; }
.view.home .prio-label { font-size: 8.5px; }
.view.home .prio-dot { width: 6px; height: 6px; }
.view.home .sub-count { font-size: 9.5px; }

.more-link {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px dashed var(--line);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 650;
    text-align: center;
}
.more-link:active { background: var(--accent-soft); }

/* ============ Chips / filters ============ */
.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    margin: 0 -2px;
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .18s, color .18s, border-color .18s, transform .14s;
}
.chip:active { transform: scale(.96); }
.chip.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--accent) 90%, transparent);
}
.chip.soft.is-active { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); box-shadow: none; }

/* ============ Empty state ============ */
.empty {
    text-align: center;
    padding: 34px 20px;
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px dashed var(--line);
}
.empty-ico {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-soft);
}
.empty-ico svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; font-size: 15px; }
.empty p { margin: 0; font-size: 13px; color: var(--muted); }

/* ============ Stats ============ */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 14px;
    box-shadow: var(--shadow-1);
}
.stat-card .k { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.stat-card .v { font-size: 25px; font-weight: 800; letter-spacing: -.8px; margin-top: 3px; }
.stat-card .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat-card.accent .v { color: var(--accent); }
.stat-card.ok .v { color: var(--ok); }
.stat-card.danger .v { color: var(--danger); }
.stat-card.warn .v { color: var(--warn); }

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--shadow-1);
}
.panel h3 { margin: 0 0 14px; font-size: 13.5px; letter-spacing: -.1px; }

.bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 132px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-track {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
    border-radius: 10px;
    background: var(--surface-2);
    overflow: hidden;
}
.bar-fill {
    width: 100%;
    border-radius: 10px;
    background: linear-gradient(180deg, #60A5FA, #2563EB);
    min-height: 4px;
    transition: height .5s cubic-bezier(.2, .8, .2, 1);
}
.bar-col.today .bar-fill { background: linear-gradient(180deg, #34D399, #059669); }
.bar-label { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.bar-value { font-size: 10.5px; color: var(--text-2); font-weight: 700; }

.dist-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.dist-name { width: 96px; font-size: 12.5px; font-weight: 600; color: var(--text-2); flex: 0 0 auto; }
.dist-track { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.dist-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.dist-val { width: 30px; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); }

/* ============ Laporan ============ */
.rep-period {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 12px;
    box-shadow: var(--shadow-1);
}
.rep-arrow {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--text-2);
    transition: transform .14s ease;
}
.rep-arrow:active { transform: scale(.92); }
.rep-arrow svg { width: 18px; height: 18px; }
.rep-center { flex: 1; text-align: center; min-width: 0; }
.rep-period-label { font-size: 14.5px; font-weight: 750; letter-spacing: -.2px; }
.rep-period-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.rep-range { display: block; }
.rep-range-head { margin-bottom: 10px; }
.rep-range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rep-range-field { display: block; min-width: 0; }
.rep-range-field > span {
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 6px 2px;
}
.rep-date { padding: 11px 12px; font-size: 14px; }
.rep-apply { margin-top: 10px; }

.rep-quickrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 0 2px; }
.rep-count { font-size: 11.5px; color: var(--muted); }

.rep-cat-head, .rep-cat-row {
    display: grid;
    grid-template-columns: 1fr 56px 56px 56px;
    gap: 6px;
    align-items: center;
    font-size: 12.5px;
    padding: 9px 2px;
}
.rep-cat-head {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 7px;
}
.rep-cat-head span:not(:first-child), .rep-cat-row span:not(.name) { text-align: right; }
.rep-cat-row { border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.rep-cat-row:last-child { border-bottom: 0; }
.rep-cat-row .name { font-weight: 600; color: var(--text-2); }
.rep-cat-row .ok { color: var(--ok); font-weight: 700; }
.rep-cat-row .late { color: var(--danger); font-weight: 700; }

.rep-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.rep-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
}
.rep-item:last-child { border-bottom: 0; }
.rep-item-time {
    width: 52px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}
.rep-item-time b { font-size: 13px; letter-spacing: -.2px; }
.rep-item-time span { font-size: 10px; color: var(--muted); }
.rep-item-body { flex: 1; min-width: 0; }
.rep-item-title { font-size: 13.5px; font-weight: 650; word-break: break-word; }
.rep-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rep-status {
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--muted);
    white-space: nowrap;
}
.rep-status.ok { background: var(--ok-soft); color: var(--ok); }
.rep-status.late { background: var(--danger-soft); color: var(--danger); }
.rep-status.warn { background: var(--warn-soft); color: var(--warn); }

/* ============ Settings ============ */
.settings-group {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    margin-bottom: 12px;
}
.settings-group > .row + .row { border-top: 1px solid var(--line); }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}
.row .row-ico {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    flex: 0 0 auto;
}
.row .row-ico svg { width: 17px; height: 17px; }
.row .row-main { flex: 1; min-width: 0; }
.row .row-title { font-size: 14px; font-weight: 600; }
.row .row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .row-end { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }

.pill {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }

.switch {
    width: 46px;
    height: 27px;
    border-radius: 999px;
    background: var(--surface-3);
    position: relative;
    transition: background .2s ease;
    flex: 0 0 auto;
}
.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .3);
    transition: transform .2s cubic-bezier(.3, .9, .2, 1);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(19px); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 16px;
    border-radius: 13px;
    font-size: 13.5px;
    font-weight: 650;
    background: var(--surface-3);
    color: var(--text-2);
    transition: transform .14s ease, filter .2s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn.primary {
    background: linear-gradient(135deg, #2563EB, #4F46E5);
    color: #fff;
    box-shadow: 0 12px 24px -14px rgba(37, 99, 235, .95);
}
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ok { background: var(--ok-soft); color: var(--ok); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

.field { padding: 0 16px 14px; }
.field-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 7px;
}
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* Ringkasan tugas di form penyelesaian */
.complete-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--r-md);
    padding: 13px 15px;
    margin-bottom: 18px;
}
.complete-title { font-size: 15.5px; font-weight: 700; color: var(--text); line-height: 1.4; }
.complete-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.seg {
    display: flex;
    gap: 4px;
    background: var(--surface-3);
    border-radius: 13px;
    padding: 4px;
}
.seg button {
    flex: 1;
    padding: 9px 6px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--muted);
    transition: background .18s, color .18s;
}
.seg button.on {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-1);
}

.about {
    text-align: center;
    padding: 16px 10px 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}
.about b { color: var(--text-2); }

/* ============ Kartu pengembang ============ */
.dev-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-1);
}
.dev-top { display: flex; align-items: center; gap: 12px; }
.dev-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(140deg, #2563EB, #4F46E5 70%, #7C3AED);
    flex: 0 0 auto;
    box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .9);
}
.dev-logo svg { width: 22px; height: 22px; }
.dev-name { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.2px; }
.dev-role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dev-bio {
    margin: 12px 0 0;
    font-size: 13px;
    font-style: italic;
    color: var(--text-2);
    line-height: 1.6;
    background: var(--surface-2);
    border-radius: 12px;
    padding: 10px 12px;
}
.dev-rows { margin-top: 12px; }
.dev-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: inherit;
}
.dev-row:last-child { border-bottom: 0; }
.dev-row .k { width: 86px; flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.dev-row .v { flex: 1; color: var(--text-2); font-weight: 600; word-break: break-word; }
.dev-row .v.link { color: var(--accent); text-decoration: underline; }
.dev-foot {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.7;
    text-align: center;
}

/* ============ FAB & tabbar ============ */
.fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom));
    width: 58px;
    height: 58px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(140deg, #2563EB, #4F46E5 65%, #7C3AED);
    box-shadow: 0 18px 34px -14px rgba(37, 99, 235, .95);
    z-index: 25;
    transition: transform .16s cubic-bezier(.3, 1.4, .4, 1);
}
.fab:active { transform: scale(.9) rotate(90deg); }
.fab svg { width: 26px; height: 26px; }

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: stretch;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
}
.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 0;
    border-radius: 14px;
    color: var(--muted);
    font-size: 9.8px;
    font-weight: 650;
    white-space: nowrap;
    transition: color .18s ease;
}
.tab .ti { display: grid; place-items: center; height: 22px; }
.tab .ti svg { width: 21px; height: 21px; }
.tab.is-active { color: var(--accent); }
.tab.is-active .ti svg { stroke-width: 2.3; }

/* ============ Sheet ============ */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet[hidden] { display: none; }
.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 14, 26, .5);
    backdrop-filter: blur(2px);
    animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-panel {
    position: relative;
    max-height: 93vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-radius: 26px 26px 0 0;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-3);
    animation: sheet-up .28s cubic-bezier(.2, .9, .25, 1);
}
@keyframes sheet-up {
    from { transform: translateY(24px); opacity: .6; }
    to { transform: none; opacity: 1; }
}
.sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: var(--line);
    margin: 10px auto 4px;
}
.sheet-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px 12px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 16.5px; letter-spacing: -.2px; }
.sheet-head .sub { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--text-2);
}
.sheet-close svg { width: 16px; height: 16px; }
.sheet-body { padding: 16px 18px 4px; }
.sheet-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 10px;
    padding: 12px 18px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--surface) 72%, transparent);
}
.sheet-foot .btn { flex: 1; padding: 14px; }

/* ============ Pratinjau laporan ============ */
.report-preview {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px 16px;
}
.rp-title { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.rp-sub { font-size: 12px; color: #334155; margin-top: 3px; }
.rp-meta { font-size: 10.5px; color: #6b7a93; margin-top: 2px; }
.rp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 14px; }
.rp-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 10.5px; }
.rp-table th {
    background: #1c4fda;
    color: #ffffff;
    text-align: left;
    padding: 7px 8px;
    font-weight: 700;
    white-space: nowrap;
}
.rp-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #e3e9f3;
    vertical-align: top;
    color: #1e293b;
    word-break: break-word;
}
.rp-table tbody tr:nth-child(even) td { background: #f6f8fc; }
.rp-table td.rp-empty { text-align: center; color: #6b7a93; padding: 16px; }
.rp-note { margin-top: 12px; font-size: 9.5px; line-height: 1.55; color: #6b7a93; }
.rp-table td.rp-photo { min-width: 88px; }
.rp-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    margin: 1px;
    vertical-align: middle;
    background: #eef2f8;
}

/* ============ Foto pekerjaan ============ */
.field-label .opt { font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 10px; }
.photo-grid:empty { display: none; }
.photo-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 11px;
    overflow: hidden;
    background: var(--surface-3);
    border: 1px solid var(--line);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .rm {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(9, 14, 26, .72);
    color: #fff;
}
.photo-thumb .rm svg { width: 12px; height: 12px; }
.detail-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.detail-photos img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-3);
}

/* ============ Form ============ */
.input, .textarea, .select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px 14px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: 0;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
    background: var(--surface);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.input-lg { font-size: 17px; font-weight: 650; letter-spacing: -.2px; padding: 14px; }

.form-block { margin-bottom: 18px; }
.form-block > .field-label { margin-left: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pick-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    transition: all .16s ease;
}
.pick .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.pick.on {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    color: var(--accent);
}
.pick.on[data-color] {
    background: color-mix(in srgb, var(--pick-color) 14%, transparent);
    border-color: color-mix(in srgb, var(--pick-color) 48%, var(--line));
    color: var(--pick-color);
}
.pick svg { width: 14px; height: 14px; }

.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 11px;
    font-size: 13.5px;
}
.check-item .mark {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--line);
    display: grid;
    place-items: center;
    color: transparent;
    flex: 0 0 auto;
}
.check-item .mark svg { width: 12px; height: 12px; }
.check-item.on .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item.on .txt { text-decoration: line-through; color: var(--muted); }
.check-item .txt { flex: 1; word-break: break-word; }
.check-item .del { color: var(--muted); padding: 4px; }
.check-item .del svg { width: 15px; height: 15px; }

.add-line { display: flex; gap: 8px; margin-top: 8px; }
.add-line .input { padding: 11px 13px; font-size: 14px; }
.add-line .btn { padding: 0 15px; flex: 0 0 auto; }

/* ============ Detail ============ */
.detail-title { font-size: 21px; font-weight: 800; letter-spacing: -.5px; margin: 0 0 10px; word-break: break-word; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.badge {
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--text-2);
}
.badge.prio { color: var(--p-color); background: color-mix(in srgb, var(--p-color) 14%, transparent); }
.badge.late { color: var(--danger); background: var(--danger-soft); }
.badge.done { color: var(--ok); background: var(--ok-soft); }

.detail-note {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 13px;
    margin-bottom: 16px;
}

.kv { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { width: 96px; color: var(--muted); flex: 0 0 auto; }
.kv .v { flex: 1; color: var(--text-2); font-weight: 600; word-break: break-word; }

.actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }

/* ============ Toast ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tab-h) + 92px + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(10px);
    background: #0B1220;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: 999px;
    box-shadow: var(--shadow-2);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 90;
    max-width: 86vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* Blok tanda tangan laporan */
.rp-sign { margin: 18px 10px 4px auto; width: 240px; text-align: center; }
.rp-sign-label { font-size: 12px; color: var(--muted); }
.rp-sign-img { display: block; max-height: 90px; max-width: 220px; margin: 6px auto; object-fit: contain; }
.rp-sign-space { height: 62px; }
.rp-sign-name { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 700; font-size: 13px; }

/* Pratinjau tanda tangan di setelan */
.sign-box { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.sign-box img { max-height: 70px; max-width: 200px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; }
