/* ==========================================================================
   Famlist — global styles
   Design language: floating white panels on a soft lavender-grey canvas
   (per approved mockup), Notion-like content density, Google I/O fluid
   rounding, single orange accent doing all the interactive work.
   ========================================================================== */

:root {
    /* Spec tokens (verbatim from PRD §5.1) */
    --bg-main: #FFFFFF;
    --bg-subtle: #F9F9F8;
    --border-clean: #EAEAEA;
    --text-primary: #1F1F1F;
    --text-muted: #707070;
    --accent-orange: #FF5A1F;
    --accent-orange-hover: #E04A15;
    --accent-orange-alpha: rgba(255, 90, 31, 0.1);
    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-fluid: 16px;
    --radius-pill: 9999px;
    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Mockup-derived layer */
    --canvas: #EFEFF4;
    --panel-radius: 24px;
    --strike: #E0552F;
    --shadow-soft: 0 1px 2px rgba(31, 31, 46, 0.04), 0 10px 30px rgba(31, 31, 46, 0.06);
    --shadow-pop: 0 6px 16px rgba(31, 31, 46, 0.10), 0 24px 60px rgba(31, 31, 46, 0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-stack);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text-primary); }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--accent-orange); outline-offset: 2px; border-radius: 6px; }

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

/* ==========================================================================
   Panels & app frame
   ========================================================================== */

.panel {
    background: var(--bg-main);
    border-radius: var(--panel-radius);
    box-shadow: var(--shadow-soft);
}

.app {
    display: grid;
    grid-template-columns: 256px minmax(0, 1fr) 336px;
    gap: 14px;
    padding: 14px;
    height: 100vh;
    height: 100dvh;
}

/* ---------- Sidebar ---------- */

.sidebar { display: flex; flex-direction: column; padding: 18px 14px 14px; overflow-y: auto; }

.module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
}
.module-tile {
    aspect-ratio: 1.55;
    background: #F3F3F1;
    border-radius: 18px;
    display: grid;
    place-items: center;
    transition: var(--transition-smooth);
}
.module-tile:hover { background: var(--accent-orange-alpha); transform: translateY(-1px); }
.tile-emoji { font-size: 22px; }

.side-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    padding: 0 10px 8px;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    text-align: left;
    font-weight: 500;
    position: relative;
    transition: var(--transition-smooth);
}
.nav-item:hover { background: var(--bg-subtle); }
.nav-item.active { background: #F3F3F1; }
.nav-item.active::after {
    content: '';
    position: absolute;
    right: -14px;
    top: 7px;
    bottom: 7px;
    width: 3.5px;
    border-radius: 4px 0 0 4px;
    background: var(--accent-orange);
}
.nav-emoji { font-size: 16px; width: 22px; text-align: center; }

.side-foot { margin-top: 14px; }
.account-chip {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    transition: var(--transition-smooth);
}
.account-chip:hover { background: #F0F0EE; }
.account-name { flex: 1; text-align: left; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-gear { color: var(--text-muted); }

/* ---------- Avatars ---------- */

.avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--accent-orange);
    user-select: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--bg-main); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more { margin-left: 6px; color: #B9B9C2; font-weight: 600; font-size: 13px; }

/* ---------- Main panel ---------- */

.main { overflow-y: auto; position: relative; padding: 30px 34px 110px; scroll-behavior: smooth; }

.view-eyebrow { display: flex; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 6px; }

.page-title-row { display: flex; align-items: center; gap: 10px; }
.page-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.15;
}
.page-sub { color: var(--text-muted); margin: 8px 0 22px; max-width: 52ch; }

.icon-btn {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition-smooth);
}
.icon-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.icon-btn.active { background: var(--accent-orange-alpha); color: var(--accent-orange); }

.toolbar { display: flex; align-items: center; gap: 8px; }

.seg {
    display: inline-flex;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    padding: 3px;
    gap: 2px;
}
.seg button {
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}
.seg button.on { background: var(--bg-main); color: var(--text-primary); box-shadow: 0 1px 4px rgba(31,31,46,.10); }
.seg.seg-accent button.on { background: var(--accent-orange); color: #fff; }

/* ==========================================================================
   Home dashboard — 3 fluid circular module targets (spec §6.2)
   ========================================================================== */

.home-greeting { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 18px 0 4px; }
.home-sub { color: var(--text-muted); margin: 0 0 34px; }

.home-targets { display: flex; gap: 34px; flex-wrap: wrap; }
.home-target { display: grid; justify-items: center; gap: 12px; }
.home-circle {
    width: 104px; height: 104px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 38px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-clean);
    transition: var(--transition-smooth);
}
.home-target:hover .home-circle {
    background: var(--accent-orange-alpha);
    border-color: var(--accent-orange);
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
}
.home-target-label { font-weight: 600; }
.home-target-count { font-size: 12.5px; color: var(--text-muted); }

.home-today { margin-top: 40px; }
.home-today h3 { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 10px; }

/* ==========================================================================
   Lists engine
   ========================================================================== */

.cat-section { margin-bottom: 26px; }
.cat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 4px;
    border-bottom: 1px solid var(--border-clean);
    margin-bottom: 4px;
}
.cat-name { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.cat-count { font-size: 12px; color: #B9B9C2; font-weight: 600; }
.cat-edit-input, .title-edit-input {
    border: 1px solid var(--accent-orange);
    border-radius: 8px;
    padding: 4px 8px;
    font-weight: 700;
    background: var(--bg-main);
}
.title-edit-input { font-size: 26px; letter-spacing: -0.02em; max-width: 320px; }
.cat-delete { color: #C7553B; font-size: 12px; margin-left: auto; }
.add-cat-btn { font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 8px 0; }
.add-cat-btn:hover { color: var(--accent-orange); }

/* ---------- List rows ---------- */

.item-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 2px;
    border-radius: 10px;
    transition: var(--transition-smooth);
}
.item-row:hover { background: var(--bg-subtle); }

.check {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid #DCDCE2;
    background: var(--bg-main);
    flex-shrink: 0;
    display: grid;
    place-items: center;
    transition: var(--transition-smooth);
    padding: 0;
}
.check svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; transform: scale(.5); transition: var(--transition-smooth); }
.check:hover { border-color: var(--accent-orange); }
.item-row.checked .check { background: var(--accent-orange); border-color: var(--accent-orange); }
.item-row.checked .check svg { opacity: 1; transform: scale(1); }

.item-name { flex: 1; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.item-row.checked { opacity: 0.5; }
.item-row.checked .item-name { text-decoration: line-through; color: var(--strike); }

.item-meta { display: flex; align-items: center; gap: 8px; }
.item-thumb { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border-clean); }
.scope-dot {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    letter-spacing: .03em;
}
.due-chip { font-size: 11.5px; font-weight: 600; color: var(--accent-orange); background: var(--accent-orange-alpha); border-radius: var(--radius-pill); padding: 2px 8px; }
.due-chip.overdue { color: #C0392B; background: rgba(192, 57, 43, .1); }

.info-btn {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border-clean);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    display: grid;
    place-items: center;
    transition: var(--transition-smooth);
}
.info-btn:hover { border-color: var(--accent-orange); color: var(--accent-orange); }

.empty-hint { color: #B9B9C2; font-size: 13.5px; padding: 10px 2px; }

/* ---------- Thumbnail grid view ---------- */

.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; padding-top: 6px; }
.grid-card {
    border: 1px solid var(--border-clean);
    border-radius: var(--radius-fluid);
    overflow: hidden;
    background: var(--bg-main);
    transition: var(--transition-smooth);
    position: relative;
}
.grid-card:hover { box-shadow: var(--shadow-soft); transform: translateY(-2px); }
.grid-card .gc-img { width: 100%; aspect-ratio: 1.35; object-fit: cover; display: block; background: var(--bg-subtle); }
.grid-card .gc-emoji { width: 100%; aspect-ratio: 1.35; display: grid; place-items: center; font-size: 34px; background: var(--bg-subtle); }
.grid-card .gc-body { padding: 9px 11px 11px; display: flex; align-items: center; gap: 8px; }
.grid-card .gc-name { flex: 1; font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-card .check { width: 22px; height: 22px; }
.grid-card .check svg { width: 11px; height: 11px; }
.grid-card.checked { opacity: .55; }
.grid-card.checked .gc-name { text-decoration: line-through; color: var(--strike); }
.grid-card .info-btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.92); }

/* ---------- Floating creation pill (spec §6.3) ---------- */

.fab-wrap {
    position: sticky;
    bottom: 18px;
    display: flex;
    justify-content: center;
    margin-top: 26px;
    z-index: 5;
    pointer-events: none;
}
.fab {
    pointer-events: auto;
    background: var(--text-primary);
    color: #fff;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-pop);
    transition: var(--transition-smooth);
}
.fab:hover { background: #000; transform: translateY(-2px); }

.quick-add {
    pointer-events: auto;
    background: var(--bg-main);
    border: 1.5px solid var(--accent-orange);
    border-radius: var(--radius-fluid);
    box-shadow: var(--shadow-pop);
    padding: 10px 12px;
    width: min(480px, 100%);
    display: grid;
    gap: 9px;
}
.quick-add input[type="text"] { border: 0; outline: none; font-size: 15px; font-weight: 500; padding: 4px 2px; width: 100%; background: transparent; }
.quick-add-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quick-add select {
    border: 1px solid var(--border-clean);
    border-radius: 9px;
    padding: 5px 8px;
    font-size: 13px;
    background: var(--bg-main);
    max-width: 150px;
}
.quick-add .spacer { flex: 1; }
.btn-mini { font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: var(--radius-pill); }

/* ==========================================================================
   Buttons & fields
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-fluid);
    transition: var(--transition-smooth);
}
.btn-primary { background: var(--accent-orange); color: #fff; }
.btn-primary:hover { background: var(--accent-orange-hover); }
.btn-ghost { background: var(--bg-subtle); color: var(--text-primary); }
.btn-ghost:hover { background: #F0F0EE; }
.btn-danger-ghost { background: rgba(192, 57, 43, .08); color: #C0392B; }
.btn-danger-ghost:hover { background: rgba(192, 57, 43, .14); }
.btn-block { width: 100%; }
.link-btn { color: var(--accent-orange); font-weight: 600; }
.link-btn:hover { color: var(--accent-orange-hover); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%;
    border: 1px solid var(--border-clean);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--bg-main);
    transition: var(--transition-smooth);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px var(--accent-orange-alpha);
}
.field textarea { resize: vertical; min-height: 84px; }

/* ==========================================================================
   Auth view
   ========================================================================== */

.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.auth-card { width: min(400px, 100%); padding: 34px 30px 26px; }
.auth-logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; margin-bottom: 22px; }
.logo-dot { width: 14px; height: 14px; border-radius: 5px; background: var(--accent-orange); display: inline-block; }
.auth h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
.auth-sub { color: var(--text-muted); margin: 0 0 22px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--text-muted); margin: 16px 0 0; }

/* ==========================================================================
   Chat rail
   ========================================================================== */

.rail { display: flex; flex-direction: column; overflow: hidden; }
.rail-head { padding: 22px 20px 12px; border-bottom: 1px solid var(--border-clean); }
.rail-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rail-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
.rail-hint { font-size: 12px; color: #B9B9C2; margin: 7px 0 0; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; }

.msg { max-width: 84%; display: grid; gap: 3px; }
.msg.mine { align-self: flex-end; justify-items: end; }
.msg-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); padding: 0 4px; }
.msg-bubble {
    background: var(--bg-subtle);
    border-radius: 16px 16px 16px 5px;
    padding: 8px 12px;
    font-size: 14px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.msg.mine .msg-bubble { background: var(--accent-orange-alpha); border-radius: 16px 16px 5px 16px; }
.msg-actions { display: flex; gap: 2px; opacity: 0; transition: var(--transition-smooth); }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-action { font-size: 12px; padding: 3px 6px; border-radius: 8px; color: var(--text-muted); }
.msg-action:hover { background: var(--bg-subtle); color: var(--text-primary); }
.msg-pinned { font-size: 11px; color: var(--accent-orange); font-weight: 600; }
.msg-expiry { font-size: 10.5px; color: #C5C5CD; }

.chat-composer { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--border-clean); }
.chat-composer input {
    flex: 1;
    border: 1px solid var(--border-clean);
    border-radius: var(--radius-pill);
    padding: 9px 15px;
    background: var(--bg-subtle);
}
.chat-composer input:focus { outline: none; border-color: var(--accent-orange); background: var(--bg-main); }
.btn-send {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--accent-orange);
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}
.btn-send:hover { background: var(--accent-orange-hover); }

.chat-empty { color: #B9B9C2; font-size: 13.5px; text-align: center; margin-top: 30px; padding: 0 14px; }

/* ==========================================================================
   Calendar
   ========================================================================== */

.cal-toolbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; flex-wrap: wrap; }
.cal-month-label { font-weight: 700; font-size: 16px; min-width: 150px; }
.cal-nav-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-subtle); font-weight: 700; }
.cal-nav-btn:hover { background: var(--accent-orange-alpha); color: var(--accent-orange); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 11px; font-weight: 700; color: #B9B9C2; text-transform: uppercase; letter-spacing: .04em; text-align: center; padding-bottom: 4px; }
.cal-cell {
    min-height: 86px;
    border: 1px solid var(--border-clean);
    border-radius: 13px;
    padding: 6px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: var(--transition-smooth);
    background: var(--bg-main);
    overflow: hidden;
}
.cal-cell:hover { border-color: var(--accent-orange); background: var(--bg-subtle); }
.cal-cell.dim { opacity: .42; }
.cal-cell.today { border-color: var(--accent-orange); background: var(--accent-orange-alpha); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.cal-cell.today .cal-daynum { color: var(--accent-orange); }
.cal-chip {
    font-size: 10.5px;
    font-weight: 600;
    background: var(--accent-orange-alpha);
    color: var(--accent-orange-hover);
    border-radius: 6px;
    padding: 2px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-chip.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 10.5px; color: var(--text-muted); padding-left: 2px; }

.week-list { display: grid; gap: 10px; }
.week-day { border: 1px solid var(--border-clean); border-radius: var(--radius-fluid); padding: 12px 14px; }
.week-day.today { border-color: var(--accent-orange); background: var(--accent-orange-alpha); }
.week-day-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.week-day-head .wd-date { color: var(--text-muted); font-weight: 600; }

/* ==========================================================================
   Notes board
   ========================================================================== */

.notes-board { columns: 2; column-gap: 14px; }
.note-card {
    break-inside: avoid;
    border-radius: var(--radius-fluid);
    padding: 15px 16px 12px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(31,31,46,.07);
    transform: rotate(-0.4deg);
    transition: var(--transition-smooth);
}
.note-card:nth-child(even) { transform: rotate(0.4deg); }
.note-card:hover { transform: rotate(0deg) translateY(-2px); box-shadow: var(--shadow-soft); }
.note-content { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 10px; }
.note-foot { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: rgba(31,31,31,.55); }
.note-foot .spacer { flex: 1; }
.note-from-chat { font-size: 10.5px; font-weight: 700; background: rgba(255,255,255,.55); padding: 2px 7px; border-radius: var(--radius-pill); }
.note-del { color: rgba(31,31,31,.45); font-size: 12px; padding: 2px 5px; border-radius: 6px; }
.note-del:hover { color: #C0392B; background: rgba(255,255,255,.5); }

/* ==========================================================================
   Modals & sheets
   ========================================================================== */

.backdrop {
    position: fixed; inset: 0;
    background: rgba(31, 31, 46, 0.34);
    backdrop-filter: blur(2px);
    z-index: 40;
    animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(470px, calc(100vw - 28px));
    max-height: min(86vh, 720px);
    background: var(--bg-main);
    border-radius: 22px;
    box-shadow: var(--shadow-pop);
    z-index: 50;
    display: flex;
    flex-direction: column;
    animation: popIn .2s cubic-bezier(.4, 0, .2, 1);
}
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -47%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.modal-body { padding: 6px 20px 20px; overflow-y: auto; }

/* Invitation interceptor — slides up from the viewport base (spec §6.1) */
.sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(480px, 100%);
    background: var(--bg-main);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-pop);
    z-index: 60;
    padding: 12px 24px 26px;
    animation: slideUp .28s cubic-bezier(.4, 0, .2, 1);
}
@keyframes slideUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet-grab { width: 40px; height: 4px; border-radius: var(--radius-pill); background: var(--border-clean); margin: 0 auto 16px; }
.sheet h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.sheet p { color: var(--text-muted); margin: 0 0 18px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }

/* ---------- Info modal internals ---------- */

.img-frame {
    width: 100%;
    aspect-ratio: 1.9;
    border: 1.5px dashed var(--border-clean);
    border-radius: var(--radius-fluid);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    font-size: 13.5px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    margin-bottom: 14px;
    transition: var(--transition-smooth);
    background: var(--bg-subtle);
}
.img-frame:hover { border-color: var(--accent-orange); color: var(--accent-orange); }
.img-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-remove {
    position: absolute; top: 8px; right: 8px;
    background: rgba(31,31,31,.62);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
}
.img-uploading { font-size: 13px; color: var(--accent-orange); font-weight: 600; }

.detail-list { display: grid; gap: 7px; margin-top: 10px; }
.detail-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    background: var(--bg-subtle);
    border-radius: 11px;
    padding: 8px 11px;
    font-size: 13.5px;
}
.detail-key { font-weight: 700; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.detail-val { flex: 1; overflow-wrap: anywhere; }
.detail-del { color: #B9B9C2; font-size: 12px; }
.detail-del:hover { color: #C0392B; }
.detail-add { display: flex; gap: 7px; margin-top: 11px; }
.detail-add select { max-width: 145px; border: 1px solid var(--border-clean); border-radius: 10px; padding: 8px; background: var(--bg-main); }
.detail-add input { flex: 1; border: 1px solid var(--border-clean); border-radius: 10px; padding: 8px 10px; }

.member-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.member-name { flex: 1; font-weight: 600; font-size: 14px; }
.member-role { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.modal-section-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 8px; }
.modal-actions { display: flex; gap: 9px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.color-dots { display: flex; gap: 8px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; transition: var(--transition-smooth); }
.color-dot.on { border-color: var(--text-primary); }

/* ==========================================================================
   Toasts
   ========================================================================== */

#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; justify-items: center; }
.toast {
    background: var(--text-primary);
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-pop);
    animation: toastIn .22s cubic-bezier(.4, 0, .2, 1);
    max-width: min(420px, calc(100vw - 40px));
}
.toast.err { background: #C0392B; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   Mobile tab bar & responsive frame
   ========================================================================== */

.tabbar {
    position: fixed;
    left: 12px; right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    background: var(--bg-main);
    border-radius: 20px;
    box-shadow: var(--shadow-pop);
    display: none;
    z-index: 30;
    padding: 7px 6px;
}
.tab {
    flex: 1;
    display: grid;
    justify-items: center;
    gap: 2px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    border-radius: 13px;
    transition: var(--transition-smooth);
}
.tab span { font-size: 18px; }
.tab.active { color: var(--accent-orange); background: var(--accent-orange-alpha); }

.chat-nav { display: none; }

@media (max-width: 1180px) {
    .app { grid-template-columns: 232px minmax(0, 1fr); }
    .rail { display: none; }
    .rail.as-view { display: flex; position: static; border-radius: var(--panel-radius); }
    .chat-nav { display: flex; }
}

@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 86px; }
    .sidebar { display: none; }
    .main { padding: 22px 18px 110px; max-width: 560px; width: 100%; margin: 0 auto; }
    .rail.as-view { height: calc(100dvh - 110px); max-width: 560px; width: 100%; margin: 0 auto; }
    .tabbar { display: flex; }
    .tabbar.hidden { display: none; }
    .page-title { font-size: 27px; }
    .home-targets { gap: 22px; justify-content: center; }
    .notes-board { columns: 2; }
    .cal-cell { min-height: 64px; }
    .modal { width: calc(100vw - 20px); }
}

@media (max-width: 420px) {
    .notes-board { columns: 1; }
    .home-circle { width: 92px; height: 92px; font-size: 33px; }
}
