/* MailSync – clean, professional UI */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --ink: #172033;
    --ink-soft: #5a667a;
    --line: #e3e8f1;
    --brand: #2b59e0;
    --brand-dark: #1b3fae;
    --brand-tint: #eaf0ff;
    --ok: #137a4b;
    --ok-tint: #e6f6ee;
    --bad: #b42318;
    --bad-tint: #fdecea;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(23, 32, 51, .06), 0 8px 24px rgba(23, 32, 51, .06);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-soft); }
.right { text-align: right; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    font: inherit; font-weight: 600; font-size: 14px;
    border: 1px solid transparent; border-radius: 10px;
    cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(27, 63, 174, .3); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f1f4fa; }
.btn-ghost.danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:focus-visible, input:focus-visible { outline: 3px solid rgba(43, 89, 224, .35); outline-offset: 1px; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input:not([type]), .field input[type=search] {
    width: 100%; height: 44px; padding: 0 14px;
    font: inherit; color: var(--ink);
    background: #fff; border: 1px solid #cfd7e6; border-radius: 10px;
}
.field input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(43, 89, 224, .18); }
.field-error { display: block; color: var(--bad); font-size: 13px; margin-top: 4px; }
.field-error:empty { display: none; }
.code-input { text-align: center; font-size: 28px; font-weight: 700; letter-spacing: 10px; height: 56px !important; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 20px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.check-inline { margin: 0; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert:empty { display: none; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--bad-tint); color: var(--bad); }
.alert-ok { background: var(--ok-tint); color: var(--ok); }

/* ---------- Sign-in screens ---------- */
body.auth { background: var(--surface); }
.auth-grid { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; }
.auth-brand {
    background: radial-gradient(1200px 600px at 0% 0%, #3b6cf0 0%, transparent 60%), linear-gradient(160deg, #1b3fae, #0f2468);
    color: #fff; display: flex; align-items: center; padding: 48px;
}
.auth-brand-inner { max-width: 420px; }
.auth-brand h1 { font-size: 40px; margin: 18px 0 12px; font-weight: 600; }
.auth-brand h1 b { font-weight: 800; }
.auth-brand p { color: rgba(255, 255, 255, .85); font-size: 17px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; }
.auth-points li { padding: 8px 0 8px 30px; position: relative; color: rgba(255, 255, 255, .92); }
.auth-points li::before {
    content: ""; position: absolute; left: 0; top: 12px; width: 16px; height: 16px; border-radius: 50%;
    background: rgba(255, 255, 255, .22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;
}
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px; box-shadow: var(--shadow); }
.auth-card h2 { margin-bottom: 8px; }
.auth-card .muted { margin-bottom: 24px; }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: 14px; }
.auth-foot { margin-top: 20px; color: var(--ink-soft); font-size: 13px; }

.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(145deg, #4f7bff, #1f3fae); color: #fff; font-weight: 800; font-size: 18px;
    box-shadow: 0 2px 6px rgba(27, 63, 174, .35);
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; background: rgba(255, 255, 255, .18); box-shadow: none; }

/* ---------- App shell ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10; height: 64px;
    display: grid; grid-template-columns: 240px 1fr auto; align-items: center; gap: 16px;
    padding: 0 20px 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 500; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 800; color: var(--brand); }
.topbar-search input {
    width: 100%; max-width: 560px; height: 40px; padding: 0 16px; font: inherit;
    background: var(--bg); border: 1px solid transparent; border-radius: 10px;
}
.topbar-user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; }
.who { display: flex; flex-direction: column; line-height: 1.2; }
.who-name { font-weight: 600; font-size: 14px; }
.who-mail { font-size: 12px; color: var(--ink-soft); }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 64px); }
.sidebar { padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.nav-list { list-style: none; margin: 18px 0 0; padding: 0; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
    border-radius: 10px; color: var(--ink); font-weight: 500;
}
.nav-item:hover { background: #f1f4fa; text-decoration: none; }
.nav-item.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; }
.nav-item.disabled { color: #98a2b3; cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-section { margin: 22px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #98a2b3; }

.content { padding: 28px 32px 48px; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head .muted { margin: 4px 0 0; }

/* ---------- Cards, tables, lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 16px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; align-items: end; }
.form-grid .alert { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); background: #fafbfe; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.inline { display: inline-block; margin-left: 6px; }
.table th.right, .table td.right { text-align: right; white-space: nowrap; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f6; color: var(--ink-soft); }
.badge-blue { background: var(--brand-tint); color: var(--brand-dark); }
.badge-green { background: var(--ok-tint); color: var(--ok); }
.badge-grey { background: #eef1f6; color: #6b7587; }

.empty { text-align: center; padding: 72px 24px; background: var(--surface); border: 1px dashed #cfd7e6; border-radius: var(--radius); color: #98a2b3; }
.empty h3 { color: var(--ink); margin: 16px 0 6px; }
.empty .muted { max-width: 420px; margin: 0 auto; }

.mail-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.mail-row { display: grid; grid-template-columns: 220px 1fr 80px; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: #fafbfe; }
.mail-row.unread { font-weight: 700; background: #fcfdff; }
.mail-row .mail-from, .mail-row .mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { text-align: right; color: var(--ink-soft); font-weight: 500; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .auth-grid { grid-template-columns: 1fr; }
    .auth-brand { padding: 32px 24px; }
    .auth-brand h1 { font-size: 30px; }
    .auth-points { display: none; }
    .shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
    .nav-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
    .nav-section { display: none; }
    .topbar { grid-template-columns: auto 1fr auto; }
    .topbar-search, .who { display: none; }
    .content { padding: 20px 16px 40px; }
    .form-grid { grid-template-columns: 1fr; }
    .mail-row { grid-template-columns: 1fr 70px; }
    .mail-row .mail-from { grid-column: 1 / -1; }
}

/* ---------- Phase 2: inbox and message view ---------- */
.small { font-size: 13px; }
.count { margin-left: auto; min-width: 22px; padding: 1px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.nav-item.active .count { background: var(--brand-dark); }

a.mail-row { color: inherit; }
a.mail-row:hover { text-decoration: none; }
.mail-row .clip { margin-left: 8px; font-size: 13px; opacity: .7; }
.mail-row:not(.unread) .mail-from, .mail-row:not(.unread) .mail-subject { color: var(--ink-soft); }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar-actions .inline { margin-left: 0; }

.message-head { padding: 24px 28px 18px; border-bottom: 1px solid var(--line); }
.message-head h1 { font-size: 22px; margin-bottom: 16px; overflow-wrap: anywhere; }
.message-meta { display: flex; align-items: center; gap: 14px; }
.message-meta-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar-lg { width: 44px; height: 44px; font-size: 18px; flex: none; }
.message-body { padding: 22px 28px; }
.mailframe { width: 100%; min-height: 120px; border: 0; display: block; background: #fff; }
.mail-text { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }

.notice { padding: 10px 28px; background: #fff8e6; color: #7a5a00; border-bottom: 1px solid #f3e3b3; font-size: 14px; }

.attachments { padding: 18px 28px 24px; border-top: 1px solid var(--line); background: #fafbfe; }
.attachments-title { font-size: 14px; margin-bottom: 12px; }
.attachment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attachment { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.attachment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

@media (max-width: 900px) {
    .message-head, .message-body, .attachments, .notice { padding-left: 16px; padding-right: 16px; }
    .message-meta { flex-wrap: wrap; }
    .topbar-search { display: none; }
}

/* ---- Phase 3: compose and sent mail ---- */
.mail-to-label { color: var(--ink-soft); font-weight: 500; }

.compose { padding: 0; overflow: hidden; }
.compose .alert { margin: 16px 20px 0; }
.compose-row { display: grid; grid-template-columns: 72px 1fr auto; align-items: start; gap: 12px; padding: 6px 20px; border-bottom: 1px solid var(--line); }
.compose-row[hidden] { display: none; }
.compose-row > label { padding-top: 11px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.compose-input input[type=text] { width: 100%; height: 40px; border: 0; background: transparent; font: inherit; color: var(--ink); }
.compose-input input[type=text]:focus { outline: none; box-shadow: none; }
.compose-input .field-error { padding-bottom: 8px; }
.compose-toggles { display: flex; gap: 10px; padding-top: 10px; }
.compose-toggles [hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 2px 4px; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.compose-body textarea { display: block; width: 100%; min-height: 340px; padding: 18px 20px; border: 0; background: transparent; font: inherit; line-height: 1.55; color: var(--ink); resize: vertical; }
.compose-body textarea:focus { outline: none; box-shadow: none; }
.compose-body-error { padding: 0 20px 12px; }

.compose-attach { padding: 14px 20px 18px; border-top: 1px solid var(--line); background: #fafbfe; }
.compose-attach .attachment-list { margin-top: 10px; }
.compose-attach .attachment-list:empty { display: none; }
.compose-kept { margin-bottom: 12px; }
.compose-attach-bar { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
label.btn { cursor: pointer; }
.compose-footer { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.attach-warn { color: var(--bad); font-weight: 600; }

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

@media (max-width: 860px) {
    .compose-row { grid-template-columns: 56px 1fr; }
    .compose-toggles { grid-column: 2; padding-top: 0; padding-bottom: 8px; }
}

/* ---- Phase 4: address book, suggestions, conversation, help ---- */
.page-head-actions { margin: 0; }
.page-search input {
    height: 38px; width: 260px; max-width: 100%; padding: 0 12px; border: 1px solid var(--line);
    border-radius: 10px; background: var(--surface); font: inherit; color: var(--ink);
}
.page-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 89, 224, .18); }
.field textarea, .field input[type=email] { width: 100%; }

.suggest {
    position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 0; padding: 4px; list-style: none;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(23, 32, 51, .14);
    max-height: 320px; overflow-y: auto;
}
.suggest[hidden] { display: none; }
.suggest li { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest li.active, .suggest li:hover { background: var(--brand-tint); }
.suggest-main { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-sub { flex: 1; min-width: 0; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-kind { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #98a2b3; }

.message-meta-text .link-btn { margin-left: 8px; }
.message-meta-text .inline { margin-left: 0; }

.conversation { margin-top: 24px; }
.conversation-title { font-size: 14px; padding: 14px 20px; margin: 0; background: #fafbfe; border-bottom: 1px solid var(--line); }
.conversation-list { list-style: none; margin: 0; padding: 0; }
.conversation-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.conversation-list li:last-child .conversation-row { border-bottom: 0; }
.conversation-row:hover { background: #fafbfe; text-decoration: none; }
.conversation-dir { width: 18px; text-align: center; color: var(--brand); font-weight: 700; }
.conversation-from { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-folder { font-size: 12px; color: var(--ink-soft); background: #eef1f6; border-radius: 999px; padding: 1px 10px; }

.guide { display: grid; gap: 0; max-width: 820px; }
.guide h2 { font-size: 18px; margin: 0 0 10px; }
.guide p, .guide li, .guide dd { line-height: 1.6; }
.guide ul, .guide ol { margin: 8px 0 0; padding-left: 22px; }
.guide li { margin-bottom: 6px; }
.guide-toc ol { columns: 2; column-gap: 32px; }
.guide section[id] { scroll-margin-top: 80px; }
.guide-faq dt { font-weight: 700; margin-top: 14px; }
.guide-faq dt:first-child { margin-top: 0; }
.guide-faq dd { margin: 4px 0 0; color: var(--ink-soft); }

@media (max-width: 860px) {
    .page-head { flex-wrap: wrap; gap: 12px; }
    .guide-toc ol { columns: 1; }
}

/* ---- Calendar (phase 5) ---- */
.badge-red { background: var(--bad-tint); color: var(--bad); }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-actions .inline { margin-left: 0; }

.field input[type=date], .field input[type=time], .field select, .field textarea {
    width: 100%; height: 42px; padding: 0 12px; font: inherit; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input[type=date]:focus, .field input[type=time]:focus, .field select:focus, .field textarea:focus {
    border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(43, 89, 224, .18);
}
.field input[hidden], .field [hidden] { display: none; }
.field[hidden] { display: none; }

.event-form { padding: 24px; max-width: 760px; }
.event-form .compose-footer { padding: 8px 0 0; border: 0; }
.event-when { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.event-pair { display: flex; gap: 8px; }
.event-pair input[type=date] { flex: 1; min-width: 0; }
.event-pair input[type=time] { width: 130px; flex: none; }
.suggest-host { display: block; position: relative; }

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-size: 18px; margin: 0 0 0 8px; }
.cal-views { display: flex; gap: 6px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line);
       border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal-dow { background: #fafbfe; padding: 8px; font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.cal-day { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-week .cal-day { min-height: 280px; }
.cal-day.outside { background: #fafbfe; }
.cal-day.outside .cal-date a { color: #9aa4b5; }
.cal-date { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.cal-date a { color: var(--ink); width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.cal-date a:hover { background: var(--brand-tint); text-decoration: none; }
.cal-date-dow { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; }
.cal-day.today .cal-date a { background: var(--brand); color: #fff; }

.cal-chip { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 6px; font-size: 12px; line-height: 1.4;
            border-left: 3px solid var(--brand); background: var(--brand-tint); color: var(--brand-dark); overflow: hidden; }
.cal-chip:hover { text-decoration: none; filter: brightness(.96); }
.cal-chip-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-time { font-weight: 400; white-space: nowrap; }
.cal-repeat { font-size: 11px; opacity: .7; }
.cal-chip.mine { border-left-color: var(--brand); }
.cal-chip.invited { background: #fff7e0; border-left-color: #e0a100; color: #7a5a00; border-style: dashed; border-left-style: solid; }
.cal-chip.accepted { background: var(--ok-tint); border-left-color: var(--ok); color: var(--ok); }
.cal-chip.tentative { background: #f1ecfb; border-left-color: #7a56c4; color: #5b3da0; }
.cal-chip.declined { background: #f2f4f7; border-left-color: #b5bdca; color: #8a94a6; }
.cal-chip.declined .cal-chip-title { text-decoration: line-through; }
.cal-more { font-size: 12px; color: var(--ink-soft); padding: 0 6px; }
.cal-empty { font-size: 12px; color: #aab2c0; padding: 0 6px; }

.pending-invites { padding: 16px 20px; margin-bottom: 16px; border-left: 4px solid #e0a100; }
.pending-invites .card-title { margin-bottom: 10px; }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pending-list li { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }

.event-details, .event-guests { padding: 20px 24px; max-width: 760px; margin-bottom: 16px; }
.detail-list { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; margin: 0; }
.detail-list dt { color: var(--ink-soft); font-size: 13px; font-weight: 600; padding-top: 2px; }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.event-description { white-space: pre-wrap; }
.rsvp { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.rsvp-buttons { display: flex; gap: 6px; }
.rsvp p { flex-basis: 100%; margin: 0; }
.guest-list { list-style: none; margin: 0 0 8px; padding: 0; }
.guest-list li { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.guest-list li:last-child { border-bottom: 0; }
.guest-name { font-weight: 600; }
.guest-list .badge { margin-left: auto; }

.reminders:empty { display: none; }
.reminder { display: flex; align-items: center; gap: 6px; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
            background: #fff7e0; border: 1px solid #f0d98a; color: #5c4400; font-size: 14px; }
.reminder a { font-weight: 700; color: inherit; }
.reminder .link-btn { margin-left: auto; color: #5c4400; }

@media (max-width: 860px) {
    .event-when { grid-template-columns: 1fr; }
    .cal-day { min-height: 76px; padding: 4px; }
    .cal-time { display: none; }
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 10px; }
}

/* ---- Meetings (phase 6) ---- */
.meet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; max-width: 900px; }
.meet-card { padding: 20px 24px; }
.meet-card p { margin: 0 0 14px; }
.meet-join { display: flex; gap: 8px; }
.meet-join input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; }
.meet-join input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(43, 89, 224, .18); }
.meet-upcoming { padding: 20px 24px; max-width: 900px; }
.meet-list { list-style: none; margin: 0; padding: 0; }
.meet-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.meet-list li:last-child { border-bottom: 0; }
.meet-info { flex: 1; min-width: 0; display: grid; }

.room { padding: 28px; max-width: 760px; margin-bottom: 16px; }
.room-prejoin { text-align: center; }
.room-prejoin p { margin: 0 0 16px; color: var(--ink-soft); }
.room-status { text-align: center; color: var(--ink-soft); margin-bottom: 18px; }
.room-people { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.person { display: flex; align-items: center; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.person.speaking { border-color: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .22); }
.person-avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 999px; background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; }
.person.muted .person-avatar { background: #eef1f6; color: #8a94a6; }
.person-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-state { font-size: 12px; color: var(--ink-soft); }
.person.speaking .person-state { color: var(--ok); font-weight: 600; }
.room-controls { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.room-invite { padding: 20px 24px; max-width: 760px; }
.room-link { display: flex; gap: 8px; }
.room-link input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; font: inherit; font-size: 13px; color: var(--ink-soft); background: #fafbfe; border: 1px solid var(--line); border-radius: 10px; }


.room-stage { display: grid; gap: 14px; margin-bottom: 20px; }
.stage-tile { margin: 0; background: #0f172a; border-radius: 12px; overflow: hidden; }
.stage-tile video { display: block; width: 100%; max-height: 70vh; background: #000; object-fit: contain; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; color: #e2e8f0; font-size: 13px; }
.stage-bar .btn-ghost { color: #e2e8f0; border-color: rgba(255, 255, 255, .25); }
.stage-bar .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.room-controls { flex-wrap: wrap; }

@media (max-width: 860px) {
    .meet-actions { grid-template-columns: 1fr; }
}
