/* bRain — neo-brutalism tokens & komponen dasar.
   Satu sumber kebenaran desain: ubah token di :root, bukan nilai lepas. */

:root {
    /* Warna */
    --bg: #F5F1E7;
    --bg-deep: #EDE7D8;
    --surface: #FFFDF8;
    --ink: #16150F;
    --ink-soft: #565244;
    --line: #16150F;
    --green-600: #2E7D5B;
    --green-500: #3E9C72;
    --green-200: #CBE8D6;
    --green-50: #E9F4EC;
    --amber: #E9B93C;
    --salmon: #E0705E;
    --sky: #8FC4E8;
    --sand: #E4DCC8;
    --done: #C9CFC4;

    /* Border */
    --bw-1: 2px;
    --bw-2: 3px;

    /* Radius */
    --r-card: 8px;
    --r-input: 6px;
    --r-btn: 6px;
    --r-chip: 4px;
    --r-pill: 999px;

    /* Shadow keras tanpa blur */
    --sh-xs: 2px 2px 0 var(--ink);
    --sh-sm: 3px 3px 0 var(--ink);
    --sh-md: 4px 4px 0 var(--ink);
    --sh-lg: 6px 6px 0 var(--ink);

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    --pad-screen: 16px;
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
}

h1, h2, h3 {
    margin: 0 0 var(--sp-3);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

p { margin: 0 0 var(--sp-3); }

a {
    color: var(--green-600);
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}

code, .mono {
    font-family: var(--mono);
    font-size: 0.9em;
}

:focus-visible {
    outline: 3px solid var(--green-500);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--sp-2);
    z-index: 100;
    padding: var(--sp-2) var(--sp-4);
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    box-shadow: var(--sh-sm);
    color: var(--ink);
    font-weight: 700;
}

.skip-link:focus {
    left: var(--sp-2);
}

/* ---------- Header ---------- */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    min-height: 60px;
    padding: 8px var(--pad-screen);
    background: var(--surface);
    border-bottom: var(--bw-2) solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: block;
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    box-shadow: var(--sh-xs);
}

.header-user {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    min-width: 0;
}

.header-user-name {
    font-weight: 700;
    font-size: 14px;
    max-width: 45vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Layout ---------- */

.app-main {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--sp-6) var(--pad-screen) var(--sp-12);
}

.auth-body .app-main {
    max-width: none;
    padding: 0;
}

.page-head {
    margin-bottom: var(--sp-6);
}

.eyebrow {
    margin: 0 0 var(--sp-2);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--green-600);
}

.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

h1 + .muted,
.page-head .muted {
    max-width: 60ch;
    font-size: 16px;
}

/* ---------- Komponen ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px;
    padding: 10px 18px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-btn);
    box-shadow: var(--sh-sm);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
    background: var(--green-50);
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: var(--sh-xs);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: var(--sh-sm);
    transform: none;
}

.btn-primary {
    background: var(--green-600);
    color: #fff;
}

.btn-primary:hover {
    background: var(--green-500);
}

.btn-ghost {
    background: transparent;
    box-shadow: none;
}

.btn-ghost:hover {
    background: var(--green-50);
}

.btn-ghost:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

.btn-destructive {
    background: var(--salmon);
    color: var(--ink);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 14px;
}

.card {
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-md);
    padding: var(--sp-4);
}

.card-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-3);
    font-size: 18px;
    font-weight: 800;
}

.alert {
    padding: 10px 12px;
    margin-bottom: var(--sp-4);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    box-shadow: var(--sh-xs);
    font-size: 14px;
    font-weight: 600;
}

.alert-error {
    background: #F7D8D2;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: var(--sand);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--green-200);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    font-size: 12px;
    font-weight: 700;
}

.hint {
    margin: var(--sp-4) 0 0;
    color: var(--ink-soft);
    font-size: 13px;
}

.input,
.textarea,
.select {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 16px;
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: 3px solid var(--green-500);
    outline-offset: 2px;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: var(--sp-4);
}

.field label {
    font-size: 14px;
    font-weight: 700;
}

/* ---------- Auth ---------- */

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: var(--sp-6) var(--pad-screen) var(--sp-10);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: var(--sp-6);
    box-shadow: var(--sh-lg);
}

.auth-card h1 {
    font-size: 28px;
}

.account-list {
    display: grid;
    gap: var(--sp-3);
    margin: var(--sp-5) 0 0;
    padding: 0;
    list-style: none;
}

.account-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-3);
    background: var(--bg);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-sm);
    text-decoration: none;
    transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.account-card:hover {
    background: var(--green-50);
}

.account-card:active {
    transform: translate(2px, 2px);
    box-shadow: var(--sh-xs);
}

.avatar {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    background: var(--green-600);
    color: #fff;
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    font-size: 20px;
    font-weight: 800;
}

.account-info {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.account-info strong {
    font-size: 15px;
    font-weight: 800;
}

.account-info small {
    color: var(--ink-soft);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-arrow {
    font-size: 20px;
    font-weight: 800;
}

/* ---------- Beranda ---------- */

.home-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-4);
}

.meta-list {
    display: grid;
    gap: var(--sp-2);
    margin: 0;
}

.meta-list > div {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-bottom: var(--sp-2);
    border-bottom: 1px dashed var(--ink-soft);
}

.meta-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.meta-list dt {
    color: var(--ink-soft);
    font-size: 14px;
}

.meta-list dd {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.check-list {
    display: grid;
    gap: var(--sp-2);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    font-weight: 600;
}

.check-list li {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.status-dot {
    display: inline-block;
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
}

.status-dot--green { background: var(--green-500); }
.status-dot--amber { background: var(--amber); }
.status-dot--salmon { background: var(--salmon); }

.next-card {
    margin-top: var(--sp-4);
}

.next-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-3);
}

.next-item {
    display: grid;
    gap: 4px;
    align-content: start;
    padding: var(--sp-3);
    background: var(--bg);
    border: var(--bw-1) dashed var(--ink-soft);
    border-radius: var(--r-card);
}

.next-item strong {
    font-size: 15px;
    font-weight: 800;
}

.next-item span:last-child {
    color: var(--ink-soft);
    font-size: 13px;
}

.next-item .badge {
    justify-self: start;
    margin-bottom: 2px;
}

/* ---------- Toast ---------- */

.toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 60;
    display: grid;
    gap: var(--sp-2);
    width: min(92vw, 420px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    padding: 10px 12px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    box-shadow: var(--sh-sm);
    font-size: 14px;
    font-weight: 600;
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast--error { background: #F7D8D2; }
.toast--success { background: var(--green-200); }
.toast--out { opacity: 0; transform: translateY(6px); }

/* ---------- Responsif ---------- */

@media (min-width: 768px) {
    :root {
        --pad-screen: 32px;
    }

    .auth-card {
        padding: var(--sp-8);
    }

    .home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--sp-5);
    }

    .next-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .card {
        padding: var(--sp-5);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0ms !important;
        animation-duration: 0ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Part 3 — Quick Capture & Inbox
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.inbox-shell {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

/* ---------- Header / nav ---------- */

.app-nav {
    display: none;
    align-items: center;
    gap: var(--sp-2);
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: var(--ink);
    border: var(--bw-1) solid transparent;
    border-radius: var(--r-btn);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.app-nav-link.is-active {
    background: var(--green-200);
    border-color: var(--line);
    box-shadow: var(--sh-xs);
}

.app-nav-link.is-disabled {
    color: var(--ink-soft);
    cursor: default;
}

.soon {
    padding: 1px 5px;
    background: var(--bg-deep);
    border: 1px solid var(--ink-soft);
    border-radius: var(--r-chip);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 64px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: var(--bw-2) solid var(--line);
}

.bottom-nav-item {
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 8px 4px;
    color: var(--ink);
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav-item.is-active {
    background: var(--green-200);
    box-shadow: inset 0 3px 0 var(--green-600);
}

.bottom-nav-item.is-disabled {
    color: var(--ink-soft);
    opacity: 0.6;
}

/* ---------- Quick capture ---------- */

.capture-section {
    margin-bottom: var(--sp-6);
}

.capture-head {
    margin-bottom: var(--sp-4);
}

.capture-head h1 {
    font-size: 28px;
}

.capture-head .muted {
    font-size: 15px;
}

.capture-card {
    padding: 12px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-md);
}

.capture-input {
    display: block;
    width: 100%;
    min-height: 112px;
    max-height: 40vh;
    padding: 14px 16px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 18px;
    line-height: 1.45;
    resize: none;
    overflow-y: auto;
}

.capture-input::placeholder {
    color: var(--ink-soft);
    opacity: 0.8;
}

.capture-input:focus {
    outline: 3px solid var(--green-500);
    outline-offset: 2px;
}

.capture-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.capture-tags:empty {
    display: none;
}

.chip-more {
    background: var(--bg-deep);
    color: var(--ink-soft);
}

.capture-actions {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.capture-hint {
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.4;
}

.capture-hint kbd {
    padding: 1px 5px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--ink);
    font-family: var(--mono);
    font-size: 11px;
}

.capture-send {
    width: 100%;
    min-height: 56px;
    font-size: 17px;
    font-weight: 800;
}

/* ---------- Inbox ---------- */

.inbox-panel {
    display: grid;
    gap: var(--sp-3);
}

.inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    padding-bottom: var(--sp-2);
    border-bottom: var(--bw-2) solid var(--line);
}

.inbox-header h2 {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: 0;
    font-size: 20px;
}

.count-pill {
    display: inline-flex;
    min-width: 28px;
    justify-content: center;
    padding: 1px 8px;
    background: var(--green-200);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
    box-shadow: var(--sh-xs);
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.inbox-tz {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.inbox-tools {
    margin-top: 2px;
}

.inbox-search {
    box-shadow: var(--sh-xs);
}

.tag-filters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: none;
}

.tag-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    min-height: 34px;
    padding: 3px 10px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.filter-chip:hover {
    background: var(--green-50);
}

.filter-chip.is-active {
    background: var(--green-600);
    color: #fff;
}

.filter-chip .filter-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

.tag-filters:empty {
    display: none;
}

.inbox-list {
    display: grid;
    gap: var(--sp-4);
    min-height: 120px;
}

.day-group {
    display: grid;
    gap: 10px;
}

.day-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.day-sep::after {
    content: "";
    flex: 1;
    height: 2px;
    background: var(--ink-soft);
    opacity: 0.25;
}

.item-card {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-md);
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.item-card:hover {
    background: #FFFEFB;
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--ink);
}

.item-card:active {
    transform: translate(2px, 2px);
    box-shadow: var(--sh-xs);
}

.item-card.is-pending {
    opacity: 0.65;
    border-style: dashed;
}

.item-content {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.item-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.item-chips .chip,
.filter-chip .chip {
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font);
}

.item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
}

.item-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-variant-numeric: tabular-nums;
}

.due {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    background: var(--bg-deep);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.due-soon { background: var(--amber); }
.due-overdue { background: var(--salmon); }
.due-done { background: var(--done); color: var(--ink-soft); }

.empty-state {
    margin: 0;
    padding: var(--sp-8) var(--sp-4);
    background: var(--bg);
    border: var(--bw-1) dashed var(--ink-soft);
    border-radius: var(--r-card);
    color: var(--ink-soft);
    font-size: 14px;
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-top: 2px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

/* ---------- Modal editor ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: var(--sp-4);
    background: rgba(22, 21, 15, 0.55);
    overflow-y: auto;
}

.modal {
    width: min(100%, 480px);
    max-height: calc(100vh - 32px);
    padding: var(--sp-5);
    background: var(--surface);
    border: var(--bw-2) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-lg);
    overflow-y: auto;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.modal-sub {
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 12px;
}

.modal-close {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-btn);
    box-shadow: var(--sh-xs);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

.modal-body .field:last-child {
    margin-bottom: 0;
}

.field-hint {
    color: var(--ink-soft);
    font-size: 12px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
}

.field-row .field {
    min-width: 0;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: var(--bw-1) dashed var(--ink-soft);
}

.row-actions {
    display: flex;
    gap: var(--sp-2);
}

/* ---------- Toast action (undo) ---------- */

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    pointer-events: auto;
}

.toast-action {
    padding: 2px 0;
    background: none;
    border: 0;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ---------- Responsif ---------- */

@media (max-width: 767px) {
    .app-main {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .capture-head h1 {
        font-size: 24px;
    }

    .inbox-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .toast-host {
        bottom: calc(76px + env(safe-area-inset-bottom));
    }
}

@media (min-width: 768px) {
    .app-nav {
        display: flex;
        margin-left: auto;
    }

    .bottom-nav {
        display: none;
    }

    .capture-card {
        padding: 14px;
    }

    .capture-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .capture-send {
        width: auto;
        min-width: 148px;
        min-height: 48px;
        font-size: 15px;
    }

    .item-card {
        padding: 14px 16px;
    }

    .toast-host {
        bottom: 16px;
    }

    .modal {
        padding: var(--sp-6);
    }
}

/* ==========================================================================
   Part 4 — Papan Kanban (split-view desktop, tab kolom di mobile)
   ========================================================================== */

.page-workspace.view-board .app-main {
    max-width: 1560px;
}

.workspace {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

body.view-board .workspace {
    max-width: none;
}

.board-panel {
    display: none;
    min-width: 0;
}

body.view-board .board-panel {
    display: block;
}

/* ---------- Kartu: tombol buka + tombol pindah ---------- */

.card-open {
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.card-open:focus-visible {
    outline: 3px solid var(--green-500);
    outline-offset: 3px;
    border-radius: 4px;
}

.item-content {
    display: block;
}

.item-meta {
    flex-wrap: wrap;
    gap: 6px 12px;
}

.item-meta .item-time {
    margin-right: auto;
}

.card-move {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 2px 10px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.card-move:hover {
    background: var(--green-50);
}

.card-move:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

/* ---------- Header papan + tab mobile ---------- */

.board-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-3);
}

.board-head .eyebrow {
    margin-bottom: 4px;
}

.board-head h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.1;
}

.board-hint {
    margin: 0;
    max-width: 34ch;
    color: var(--ink-soft);
    font-size: 12px;
    text-align: right;
}

.board-hint kbd {
    padding: 1px 5px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: 4px;
    box-shadow: var(--sh-xs);
    font-family: var(--font);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.board-tabs {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    padding: 2px 2px 8px;
    margin-bottom: var(--sp-3);
    scrollbar-width: none;
}

.board-tabs::-webkit-scrollbar {
    display: none;
}

.board-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 6px 12px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-btn);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.board-tab[aria-selected="true"] {
    background: var(--green-200);
    box-shadow: var(--sh-sm);
    transform: translate(-1px, -1px);
}

/* ---------- Kolom ---------- */

.board-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: var(--sp-4);
    align-items: start;
    overflow-x: auto;
    padding: 3px 3px var(--sp-3);
}

.board-columns > .empty-state {
    grid-column: 1 / -1;
}

.board-column {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: calc(100dvh - 230px);
    background: var(--bg-deep);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-sm);
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.board-column-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 10px 12px;
    background: var(--surface);
    border-bottom: var(--bw-1) solid var(--line);
    border-radius: 6px 6px 0 0;
}

.board-column-head h2 {
    flex: 1;
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.board-column-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    overflow-y: auto;
}

.board-empty {
    margin: 0;
    padding: var(--sp-6) var(--sp-3);
    font-size: 12.5px;
}

.board-count {
    display: inline-flex;
    min-width: 24px;
    justify-content: center;
    padding: 1px 7px;
    background: var(--green-200);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.col-dot {
    flex: 0 0 auto;
    width: 11px;
    height: 11px;
    background: var(--sand);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
}

.col-dot--todo { background: var(--amber); }
.col-dot--doing { background: var(--sky); }
.col-dot--done { background: var(--done); }
.col-dot--inbox { background: var(--sand); }

/* ---------- State drag & drop ---------- */

.board-column.drop-active {
    background: var(--green-50);
    border-color: var(--green-600);
    box-shadow: var(--sh-md);
}

.board-column.drop-active .board-column-head {
    background: var(--green-50);
}

.inbox-panel.drop-active {
    background: var(--green-50);
    outline: 3px dashed var(--green-600);
    outline-offset: 4px;
    border-radius: var(--r-card);
}

.item-card.is-dragging {
    opacity: 0.45;
    transform: rotate(-0.6deg);
}

body.view-board .board-card[draggable="true"] {
    cursor: grab;
}

body.view-board .board-card[draggable="true"]:active {
    cursor: grabbing;
}

.inbox-drop-hint {
    display: none;
    margin: 0;
    padding: 6px 8px;
    background: var(--green-200);
    border: var(--bw-1) dashed var(--green-600);
    border-radius: var(--r-chip);
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 700;
}

body.view-board.is-dragging .inbox-drop-hint {
    display: block;
}

/* ---------- Modal pindah ---------- */

.modal-sm {
    width: min(100%, 400px);
}

.move-list {
    display: grid;
    gap: var(--sp-2);
}

.move-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 9px 12px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-btn);
    box-shadow: var(--sh-xs);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.move-option:hover {
    background: var(--green-50);
}

.move-option:active {
    transform: translate(1px, 1px);
    box-shadow: none;
}

.move-option.is-current {
    background: var(--green-200);
    cursor: default;
}

.move-label {
    flex: 1;
}

.move-current {
    padding: 1px 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-chip);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---------- Split-view desktop ---------- */

@media (min-width: 1024px) {
    .board-tabs {
        display: none;
    }

    body.view-board .workspace {
        display: grid;
        grid-template-columns: 360px minmax(0, 1fr);
        gap: var(--sp-5);
        align-items: start;
    }

    body.view-board .workspace-side {
        position: sticky;
        top: var(--sp-4);
        max-height: calc(100dvh - 32px);
        padding: 0 6px 8px 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    body.view-board .board-panel {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    body.view-board .capture-head {
        margin-bottom: var(--sp-3);
    }

    body.view-board .capture-head h1 {
        font-size: 22px;
    }

    body.view-board .capture-head .muted {
        display: none;
    }

    body.view-board .capture-card {
        padding: 12px;
    }

    body.view-board .capture-input {
        min-height: 84px;
        font-size: 16px;
    }

    body.view-board .capture-actions {
        flex-wrap: wrap;
        gap: var(--sp-2);
    }

    body.view-board .capture-send {
        min-height: 44px;
    }

    body.view-board .inbox-panel {
        margin-top: var(--sp-5);
    }
}

/* ---------- Mobile: satu kolom aktif ---------- */

@media (max-width: 1023px) {
    body.view-board .workspace-side {
        display: none;
    }

    .board-columns {
        display: block;
        overflow: visible;
        padding: 3px 3px var(--sp-3);
    }

    .board-column {
        display: none;
        max-height: none;
    }

    .board-column.is-mobile-active {
        display: flex;
    }

    .board-column-body {
        overflow: visible;
    }

    .board-hint {
        display: none;
    }

    .board-head h1 {
        font-size: 24px;
    }
}

/* ==========================================================================
   Part 5 — Kalender & Pengaturan (Telegram)
   ========================================================================== */

.page-calendar .app-main,
.page-settings .app-main {
    max-width: 1280px;
}

/* ---------- Kalender: kepala & toolbar ---------- */

.calendar-app {
    display: grid;
    gap: var(--sp-4);
}

.cal-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.cal-head h1 {
    margin-bottom: var(--sp-1);
}

.cal-head .muted {
    margin: 0;
    max-width: 56ch;
    font-size: 14px;
}

.cal-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 10px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    box-shadow: var(--sh-xs);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-sm);
}

.cal-month {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cal-sub {
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
}

.cal-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-icon {
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
}

.cal-status {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}

.cal-status.is-error {
    color: var(--ink);
}

.cal-status .btn {
    margin-left: var(--sp-2);
}

/* ---------- Kalender: grid ---------- */

.cal-layout {
    display: grid;
    gap: var(--sp-4);
    align-items: start;
}

.cal-card {
    min-width: 0;
    padding: var(--sp-3);
    background: var(--surface);
    border: var(--bw-2) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-lg);
}

.cal-dow-row {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 2px;
}

.cal-dow-row span {
    padding: 6px 2px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    background: var(--line);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    overflow: hidden;
}

.cal-day {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    min-height: 96px;
    padding: 4px;
    background: var(--surface);
    transition: background-color 120ms ease, box-shadow 120ms ease;
}

.cal-day.is-outside {
    background: #F0EBDD;
}

.cal-day.is-outside .cal-day-num {
    color: var(--ink-soft);
    opacity: 0.7;
}

.cal-day.is-today {
    box-shadow: inset 0 0 0 3px var(--green-600);
}

.cal-day.is-drop {
    background: var(--green-200);
    box-shadow: inset 0 0 0 3px var(--green-600);
}

.cal-day-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
}

.cal-day-num {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: var(--r-chip);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.cal-day.is-today .cal-day-num {
    background: var(--green-200);
    border: var(--bw-1) solid var(--line);
    box-shadow: var(--sh-xs);
}

.cal-add {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    opacity: 0.6;
}

.cal-add:hover,
.cal-add:focus-visible {
    background: var(--green-200);
    box-shadow: var(--sh-xs);
    opacity: 1;
}

.cal-chips {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.cal-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
    padding: 2px 4px;
    background: var(--sand);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    cursor: grab;
    overflow: hidden;
}

.cal-chip:active {
    cursor: grabbing;
}

.cal-chip-time {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.cal-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-chip.is-todo { background: var(--amber); }
.cal-chip.is-doing { background: var(--sky); }
.cal-chip.is-done { background: var(--done); color: var(--ink-soft); }
.cal-chip.is-inbox { background: var(--sand); }

.cal-chip.is-overdue {
    border-color: var(--ink);
    box-shadow: inset 3px 0 0 var(--salmon);
}

.cal-chip.is-dragging {
    opacity: 0.45;
}

.cal-more {
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: var(--sp-3) 0 0;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
}

.cal-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cal-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--line);
    border-radius: 3px;
}

/* ---------- Kalender: panel belum terjadwal ---------- */

.cal-side {
    display: grid;
    gap: var(--sp-3);
    align-content: start;
    padding: var(--sp-4);
    background: var(--bg-deep);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-md);
}

.cal-side-head .eyebrow {
    margin-bottom: 2px;
}

.cal-side-head h2 {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: 0;
    font-size: 18px;
}

.cal-side .hint {
    margin: 0;
    font-size: 12px;
}

.cal-unscheduled {
    display: grid;
    gap: 10px;
    min-height: 80px;
}

.cal-unscheduled .empty-state {
    padding: var(--sp-5) var(--sp-3);
    background: var(--surface);
    font-size: 13px;
}

.cal-unscheduled-card {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-sm);
    cursor: grab;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.cal-unscheduled-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: var(--sh-md);
}

.cal-unscheduled-card.is-dragging {
    opacity: 0.45;
}

.cal-unscheduled-open {
    padding: 0;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.cal-unscheduled-open .item-content {
    font-size: 14px;
}

.cal-unscheduled-card .item-meta {
    font-size: 11px;
}

.cal-drag-hint {
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1;
    letter-spacing: -2px;
}

/* ---------- Kalender: modal pemilih item ---------- */

.picker-list {
    display: grid;
    gap: 8px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 2px;
}

.picker-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--ink);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    box-shadow: var(--sh-xs);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.picker-item:hover {
    background: var(--green-50);
}

.picker-item .item-content {
    font-size: 14px;
}

/* ---------- Pengaturan ---------- */

.settings-page {
    display: grid;
    gap: var(--sp-4);
}

.settings-grid {
    display: grid;
    gap: var(--sp-4);
    align-items: start;
}

.settings-card {
    display: grid;
    gap: var(--sp-3);
    align-content: start;
    box-shadow: var(--sh-md);
}

.settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
}

.settings-card-head .card-title {
    margin: 0;
    font-size: 18px;
}

.settings-sub {
    margin: 2px 0 0;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.profile-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.profile-email {
    color: var(--ink-soft);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.tz-preview {
    margin-bottom: var(--sp-3);
    padding: 8px 10px;
    background: var(--green-50);
    border: var(--bw-1) dashed var(--green-600);
    border-radius: var(--r-input);
    font-size: 13px;
    font-weight: 700;
}

.conn-status {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin: 0;
    padding: 8px 10px;
    background: var(--bg);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    font-size: 13px;
    font-weight: 700;
}

.conn-status.is-on {
    background: var(--green-50);
}

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

.field-label {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.link-box {
    padding: 10px 12px;
    background: var(--bg);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    overflow-x: auto;
    white-space: nowrap;
    font-size: 12px;
}

.link-box code {
    font-size: 12px;
}

.tg-link-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: var(--sp-2);
}

.countdown {
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--green-600);
}

.countdown.is-expired {
    color: var(--salmon);
}

.settings-result {
    padding: 8px 10px;
    background: var(--green-50);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-input);
    font-size: 13px;
    font-weight: 600;
}

.settings-result[data-tone="error"] {
    background: #F7D8D2;
}

.settings-result[data-tone="info"] {
    background: var(--bg);
}

.setup-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.setup-steps li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.step-num {
    display: inline-grid;
    place-items: center;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    background: var(--green-200);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 800;
}

.outbox {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 2px;
}

.outbox .empty-state {
    padding: var(--sp-6) var(--sp-3);
}

.outbox-msg {
    padding: 10px 12px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-xs);
}

.outbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.outbox-msg p {
    margin: 0;
    font-size: 13px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.code-block {
    margin: 0;
    padding: 10px 12px;
    background: var(--ink);
    color: #F5F1E7;
    border-radius: var(--r-input);
    overflow-x: auto;
    font-size: 12px;
}

.code-block code {
    color: inherit;
    font-size: 12px;
}

.alert-success {
    background: var(--green-200);
}

@media (min-width: 900px) {
    .settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-card--wide {
        grid-column: span 2;
    }
}

@media (min-width: 1080px) {
    .cal-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }

    .cal-side {
        position: sticky;
        top: var(--sp-4);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
    }
}

@media (max-width: 767px) {
    .cal-head h1 {
        font-size: 26px;
    }

    .cal-month {
        font-size: 18px;
    }

    .cal-toolbar {
        padding: var(--sp-3);
    }

    .cal-card {
        padding: 6px;
        box-shadow: var(--sh-md);
    }

    .cal-day {
        min-height: 72px;
        padding: 3px;
    }

    .cal-add {
        width: 18px;
        height: 18px;
        font-size: 12px;
    }

    .cal-chip {
        padding: 1px 3px;
        font-size: 9.5px;
    }

    .cal-dow-row span {
        font-size: 10px;
    }

    .cal-side {
        box-shadow: var(--sh-sm);
    }

    .settings-card {
        box-shadow: var(--sh-sm);
    }
}

@media (max-width: 460px) {
    .cal-chip-text {
        display: none;
    }

    .cal-chip {
        justify-content: center;
        padding: 2px 0;
    }

    .cal-day {
        min-height: 64px;
    }
}

/* ---------- Halaman mock Telegram ---------- */

.mock-tg-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--sp-5) var(--sp-4);
    background:
        radial-gradient(circle at 1px 1px, rgba(22, 21, 15, 0.08) 1px, transparent 0) 0 0 / 12px 12px,
        var(--bg);
}

.mock-tg-wrap {
    width: 100%;
    max-width: 420px;
    display: grid;
    gap: var(--sp-3);
}

.mock-tg-badge {
    justify-self: center;
    margin: 0;
    padding: 4px 10px;
    background: var(--amber);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-chip);
    box-shadow: var(--sh-xs);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mock-tg-phone {
    background: var(--surface);
    border: var(--bw-2) solid var(--line);
    border-radius: var(--r-card);
    box-shadow: var(--sh-lg);
    overflow: hidden;
}

.mock-tg-head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--green-600);
    color: #fff;
    border-bottom: var(--bw-2) solid var(--line);
}

.mock-tg-head img {
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-pill);
    padding: 2px;
}

.mock-tg-head strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
}

.mock-tg-head small {
    font-size: 11px;
    opacity: 0.85;
}

.mock-tg-chat {
    display: grid;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--bg);
    min-height: 220px;
    align-content: start;
}

.mock-tg-bubble {
    justify-self: start;
    max-width: 92%;
    padding: 10px 12px;
    background: var(--surface);
    border: var(--bw-1) solid var(--line);
    border-radius: var(--r-card) var(--r-card) var(--r-card) 2px;
    box-shadow: var(--sh-xs);
    font-size: 14px;
}

.mock-tg-bubble--error {
    background: #F7D8D2;
    font-weight: 600;
}

.mock-tg-meta {
    margin: 0;
    color: var(--ink-soft);
    font-size: 11px;
    text-align: center;
}

.mock-tg-foot {
    margin: 0;
    color: var(--ink-soft);
    font-size: 12px;
    text-align: center;
}

.cal-grid:empty {
    position: relative;
    min-height: 320px;
}

.cal-grid:empty::after {
    content: "Memuat kalender…";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--ink-soft);
    font-size: 14px;
}
