/* ============================================================
   Pin Scheduler — design system
   ============================================================ */
:root {
    --bg: #f4f5f9;
    --surface: #ffffff;
    --border: #e6e8ef;
    --border-strong: #d5d8e2;
    --text: #171a26;
    --text-secondary: #4b5166;
    --muted: #8b90a3;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef0fe;
    --success: #10b981;
    --success-soft: #e7f8f1;
    --danger: #ef4444;
    --danger-soft: #fdecec;
    --warning: #f59e0b;
    --warning-soft: #fef5e3;
    --info: #3b82f6;
    --info-soft: #e8f1fe;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 10px 25px rgba(16, 24, 40, .12);
    --topbar-h: 60px;
    --sidebar-w: 236px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: var(--primary-dark); }
img { max-width: 100%; }

.muted { color: var(--muted); }
.text-danger { color: var(--danger); }

/* ---------- Layout ---------- */
.app-body { min-height: 100vh; }

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    z-index: 40;
}
.topbar-spacer { flex: 1; }

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }

.icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary);
    padding: 6px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--bg); color: var(--text); transform: translateY(-1px); }

.app-shell {
    padding-top: var(--topbar-h);
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 18px 12px;
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: transform .2s ease;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.sidebar-link:hover { background: var(--bg); color: var(--text); transform: translateX(2px); }
.sidebar-link.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-section-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--muted); margin: 16px 12px 6px;
}
.sidebar-footer { padding: 12px 2px 2px; }
.sidebar-backdrop { display: none; }
.sidebar-backdrop[hidden] { display: none; }

.content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 26px 30px 60px;
    width: 100%;
}

/* ---------- Buttons ---------- */
.btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease;
    text-decoration: none;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99, 102, 241, .35); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, .10); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(239, 68, 68, .30); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }

.ripple {
    position: absolute; border-radius: 50%;
    background: rgba(99, 102, 241, .18);
    transform: scale(0);
    animation: ripple .55s ease-out;
    pointer-events: none;
    z-index: 1;
}
.btn-primary .ripple, .btn-danger .ripple { background: rgba(255, 255, 255, .35); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
    animation: rise-in .35s ease both;
}
.card-narrow { max-width: 640px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
}
.card-head-tabs { flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 700; margin: 0; }
.subtitle { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 10px; }

/* ---------- Page header ---------- */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
    margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.4px; }
.page-subtitle { color: var(--text-secondary); margin: 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stats-grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card { padding: 18px 20px; margin-bottom: 0; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.stat-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -1px; }
.stat-hint { font-size: 12px; color: var(--muted); }

/* ---------- Quick actions ---------- */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.quick-action {
    display: flex; align-items: center; gap: 13px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1; min-width: 220px;
    color: var(--text);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.quick-action:hover { transform: translateY(-3px); border-color: var(--primary); color: var(--text); box-shadow: var(--shadow-lg); }
.quick-action small { display: block; color: var(--muted); }
.quick-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    border-radius: 10px;
    background: var(--primary-soft); color: var(--primary-dark);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label, .field-label-row label { font-weight: 600; font-size: 13.5px; }
.field-label-row { display: flex; justify-content: space-between; align-items: center; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="date"],
.field input[type="time"],
.field input[type="file"],
.field input[type="search"],
.field select,
.field textarea,
.search-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .search-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.field textarea { resize: vertical; }
.field-hint { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.slug-input { display: flex; align-items: center; }
.slug-prefix { padding: 9px 0 9px 12px; border: 1px solid var(--border-strong); border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg); color: var(--muted); font-weight: 600; }
.slug-input input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.checkbox input { accent-color: var(--primary); width: 15px; height: 15px; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 14px; }
.alert-danger { background: var(--danger-soft); color: #b91c1c; border: 1px solid #f5c6c6; }
.alert-success { background: var(--success-soft); color: #047857; border: 1px solid #bfe9d8; }
.alert-info { background: var(--info-soft); color: #1d4ed8; border: 1px solid #bcd7fc; }
.alert-warning { background: var(--warning-soft); color: #b45309; border: 1px solid #f3d9a4; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: #047857; }
.badge-danger { background: var(--danger-soft); color: #b91c1c; }
.badge-info { background: var(--info-soft); color: #1d4ed8; }
.badge-warning { background: var(--warning-soft); color: #b45309; }
.badge-brand { background: var(--primary-soft); color: var(--primary-dark); }
.badge-muted { background: #eef0f4; color: var(--text-secondary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left;
    font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--muted); font-weight: 600;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbff; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.cell-thumb { width: 52px; }
.thumb { width: 42px; height: 56px; object-fit: cover; border-radius: 7px; display: block; }
.thumb-empty { background: var(--bg); border: 1px dashed var(--border-strong); }
.col-actions { text-align: right; white-space: nowrap; }
.col-check { width: 34px; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; margin-top: 16px; }
.page-link {
    min-width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    font-size: 13px; color: var(--text-secondary); padding: 0 8px;
    transition: transform .12s ease, background-color .12s ease, color .12s ease, border-color .12s ease;
}
.page-link:hover { transform: translateY(-1px); border-color: var(--primary); color: var(--primary-dark); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.empty-text { color: var(--muted); margin: 0 0 16px; }

/* ---------- Feeds list ---------- */
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.feed-card { margin-bottom: 0; display: flex; flex-direction: column; gap: 13px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.feed-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow-lg); }
.feed-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.feed-card-name { font-size: 16px; font-weight: 700; color: var(--text); }
.feed-card-name:hover { color: var(--primary); }
.feed-card-slug { font-size: 12px; color: var(--muted); }
.feed-url {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
}
.feed-url-text {
    flex: 1; min-width: 0;
    font-size: 12px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer;
}
.feed-card-stats { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }
.feed-card-stats strong { color: var(--text); }
.feed-next { font-size: 12px; color: var(--muted); }
.feed-card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.feed-card-meta { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------- Feed detail ---------- */
.feed-url-inline { font-size: 13px; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-left: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    color: var(--text-secondary);
    transition: background-color .15s ease, color .15s ease;
}
.tab:hover { background: var(--bg); color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); }

.bulk-bar {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
}
.bulk-bar select, .bulk-bar input { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 7px; font-size: 13px; background: var(--surface); }

/* ---------- Image ---------- */
.image-source-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.image-source-tab {
    padding: 7px 13px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    cursor: pointer; color: var(--text-secondary);
}
.image-source-tab.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.image-preview { margin-top: 10px; }
.image-preview img { max-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.current-image { max-height: 160px; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-bottom: 8px; }

/* ---------- Pin preview (Pinterest-style) ---------- */
.edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 640px) minmax(280px, 360px);
    gap: 26px;
    align-items: start;
}
.pin-preview-pane { position: sticky; top: 80px; }
.pin-preview {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .12);
    overflow: hidden;
    max-width: 420px;
    animation: rise-in .35s ease both;
}
.pin-preview-img-wrap {
    position: relative;
    aspect-ratio: 2 / 3;
    background: var(--bg);
    overflow: hidden;
}
.pin-preview-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.pin-preview-img-wrap::after {
    content: '';
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, .25);
    opacity: 0;
    transition: opacity .18s ease;
}
.pin-preview-img-wrap:hover::after { opacity: 1; }
.pin-preview-save {
    position: absolute; top: 10px; right: 10px; z-index: 1;
    background: #e60023; color: #fff;
    font-size: 13px; font-weight: 700;
    padding: 9px 20px; border-radius: 24px;
    box-shadow: 0 4px 12px rgba(230, 0, 35, .35);
    opacity: 0; transform: translateY(-4px);
    transition: opacity .18s ease, transform .18s ease;
}
.pin-preview-img-wrap:hover .pin-preview-save { opacity: 1; transform: translateY(0); }
.pin-preview-img-placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    color: var(--muted); font-size: 13px;
}
.pin-preview-body { padding: 12px 14px 14px; }
.pin-preview-title {
    margin: 0 0 6px;
    font-size: 14px; font-weight: 700; color: #111;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.pin-preview-desc {
    margin: 0 0 10px;
    font-size: 13px; color: #575757;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    white-space: pre-line;
}
.pin-preview-desc.empty { color: #a8a8a8; font-style: italic; }
.pin-preview-link {
    display: flex; align-items: center; gap: 7px;
    font-size: 12.5px; color: #8a8a8a;
    min-width: 0;
}
.pin-preview-dot {
    width: 16px; height: 16px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    flex-shrink: 0;
}
.pin-preview-link a {
    color: #8a8a8a; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: color .12s ease;
}
.pin-preview-link a:hover { color: #111; }

/* ---------- Code ---------- */
.code-block {
    background: #161a2b;
    color: #d6d9ef;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.6;
}

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.card-danger-zone { border-color: #f5c6c6; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.user-menu {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 6px 8px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 14px; font-weight: 500;
}
.user-menu:hover { background: var(--bg); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 60;
}
.dropdown-menu.open { display: block; animation: menu-in .16s ease both; transform-origin: top right; }
.dropdown-menu a, .dropdown-menu button {
    display: block; width: 100%;
    text-align: left;
    padding: 8px 11px;
    border: none; background: none; cursor: pointer;
    font-size: 13.5px; color: var(--text-secondary);
    border-radius: 6px;
    transition: background-color .12s ease, color .12s ease;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); color: var(--text); }
.dropdown-menu .dropdown-item-danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #e7e9ff 0%, var(--bg) 55%);
}
.auth-shell { width: 100%; max-width: 420px; text-align: center; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 34px 34px 26px;
    text-align: left;
    margin-bottom: 16px;
}
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; }
.auth-title { font-size: 22px; font-weight: 800; margin: 0 0 5px; letter-spacing: -.4px; }
.auth-subtitle { color: var(--text-secondary); margin: 0 0 20px; font-size: 14px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--text-secondary); margin: 18px 0 0; }
.auth-footnote { color: var(--muted); font-size: 12px; margin: 0; }
.link-sm { font-size: 12.5px; font-weight: 600; }

/* ---------- Installer ---------- */
.auth-card-wide { max-width: none; }
.install-heading { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin: 22px 0 10px; color: var(--text-secondary); }
.install-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.install-checks li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.install-checks li.fail { border-color: #f5c6c6; background: var(--danger-soft); }
.install-check-mark { font-weight: 800; }
.install-checks li.ok .install-check-mark { color: #047857; }
.install-checks li.fail .install-check-mark { color: #b91c1c; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) {
    .install-checks, .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Calendar ---------- */
.calendar-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.calendar-toolbar select { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13.5px; background: var(--surface); }
.calendar-nav { display: flex; align-items: center; gap: 6px; }
.calendar-title { font-weight: 700; min-width: 150px; text-align: center; font-size: 14px; }
.view-toggle { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle-btn {
    padding: 7px 13px;
    border: none; background: var(--surface);
    font-size: 13px; font-weight: 600; cursor: pointer;
    color: var(--text-secondary);
}
.view-toggle-btn.active { background: var(--primary); color: #fff; }
.calendar-container { overflow-x: auto; }

.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; min-width: 760px; }
.cal-weekday { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 6px 0; }
.cal-day {
    min-height: 96px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px;
    background: var(--surface);
    display: flex; flex-direction: column; gap: 4px;
}
.cal-day.other-month { opacity: .45; }
.cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cal-day-num { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding: 2px 4px; }
.cal-day.today .cal-day-num { color: var(--primary); }
.cal-event {
    display: block;
    font-size: 11.5px;
    padding: 3px 6px;
    border-radius: 5px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, color .12s ease;
}
.cal-event:hover { background: var(--primary); color: #fff; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(16, 24, 40, .15); }
.cal-event.draft { background: #eef0f4; color: var(--text-secondary); }
.cal-event.rss_available { background: #e8f1fe; color: #1d4ed8; }
.cal-event.published { background: var(--success-soft); color: #047857; }
.cal-event.cancelled { background: var(--danger-soft); color: #b91c1c; text-decoration: line-through; }

.cal-week-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); min-width: 820px; }
.cal-week-time { text-align: right; font-size: 11px; color: var(--muted); padding-right: 8px; height: 44px; }
.cal-week-day { border: 1px solid var(--border); min-height: 44px; font-size: 11px; }
.cal-week-day .cal-event { margin: 2px; }
.cal-day-view { min-width: 520px; }

/* ---------- Toasts ---------- */
.toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 100;
    pointer-events: none;
}
.toast {
    position: relative;
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 12px 44px 14px 12px;
    min-width: 280px; max-width: 380px;
    font-size: 13.5px;
    overflow: hidden;
    pointer-events: auto;
    animation: toast-in .3s cubic-bezier(.21, 1.02, .73, 1) both;
}
.toast-icon { display: inline-flex; flex-shrink: 0; margin-top: 2px; }
.toast-msg { flex: 1; padding: 1px 0; word-break: break-word; }
.toast-close {
    position: absolute; top: 8px; right: 8px;
    background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 4px; border-radius: 5px;
    display: inline-flex;
    transition: background-color .12s ease, color .12s ease;
}
.toast-close:hover { color: var(--text); background: var(--bg); }
.toast-bar {
    position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    background: var(--info);
    animation: toast-bar linear forwards;
}
.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.success .toast-bar { background: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error .toast-icon { color: var(--danger); }
.toast.error .toast-bar { background: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.warning .toast-bar { background: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast.info .toast-bar { background: var(--info); }
.toast-out { animation: toast-out .24s ease both; }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(28px) scale(.97); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(28px) scale(.97); }
}
@keyframes toast-bar {
    from { width: 100%; }
    to { width: 0%; }
}

/* ---------- Diagnostics ---------- */
.info-rows { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; gap: 12px; font-size: 13.5px; }
.info-label { min-width: 170px; color: var(--muted); font-weight: 600; }
.info-value { color: var(--text); word-break: break-all; }
.diagnostics-results { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.diagnostic-row {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
}
.diagnostic-pass { border-color: #bfe9d8; background: var(--success-soft); }
.diagnostic-fail { border-color: #f5c6c6; background: var(--danger-soft); }
.diagnostic-warn { border-color: #f3d9a4; background: var(--warning-soft); }
.diagnostic-icon { font-weight: 800; }
.diagnostic-pass .diagnostic-icon { color: var(--success); }
.diagnostic-fail .diagnostic-icon { color: var(--danger); }
.diagnostic-warn .diagnostic-icon { color: var(--warning); }

/* ---------- Error pages ---------- */
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-size: 56px; font-weight: 800; color: var(--primary); letter-spacing: -2px; }
.error-title { font-size: 20px; margin: 8px 0; }
.error-text { color: var(--text-secondary); margin: 0 0 20px; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 18, 32, .5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; z-index: 90;
    animation: fade-in .18s ease both;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 520px; width: 100%;
    padding: 24px;
    animation: modal-in .24s cubic-bezier(.21, 1.02, .73, 1) both;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
.modal-text { color: var(--text-secondary); font-size: 14px; margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Motion & Effects ---------- */
html { scroll-behavior: smooth; }
body { -webkit-tap-highlight-color: transparent; }

.content { animation: page-in .32s ease both; }

a:focus-visible, button:focus-visible, select:focus-visible, .tab:focus-visible, .page-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
@keyframes rise-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modal-in {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes menu-in {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to { opacity: 1; transform: none; }
}
@keyframes ripple {
    to { transform: scale(1); opacity: 0; }
}

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

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: block; position: fixed; inset: var(--topbar-h) 0 0 0;
        background: rgba(15, 18, 32, .4);
        z-index: 29;
        animation: fade-in .2s ease both;
    }
    .content { margin-left: 0; padding: 20px 16px 60px; }
    .field-row { grid-template-columns: 1fr; }
    .user-menu-name { display: none; }
    .edit-grid { grid-template-columns: 1fr; }
    .pin-preview-pane { position: static; }
    .pin-preview-pane .pin-preview { max-width: 100%; }
}
@media (max-width: 560px) {
    .page-head { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .feed-grid { grid-template-columns: 1fr; }
}
