/* ==========================================================================
   SMM Studio — design system
   Derived from the ATS reference design (indigo/violet brand, Inter + Plus
   Jakarta Sans, Bootstrap 5 base) and extended for social content work.
   1 tokens · 2 base · 3 shell · 4 page header · 5 cards & stats · 6 buttons
   7 forms · 8 tables · 9 status & badges · 10 feedback · 11 overlays & tabs
   12 content components (preview, calendar, timeline, platforms)
   13 auth & public pages · 14 utilities · 15 responsive
   ========================================================================== */

/* 1. TOKENS */
:root {
    --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe; --brand-400: #818cf8;
    --brand-500: #6366f1; --brand-600: #4f46e5; --brand-700: #4338ca; --brand-900: #1e1b4b;
    --violet-600: #7c3aed; --teal-600: #0d9488;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%);
    --gradient-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    --gradient-sidebar: linear-gradient(180deg, #111034 0%, #1e1b4b 55%, #2e1065 100%);

    --canvas: #f4f6fb; --surface: #fff; --surface-2: #f8fafc;
    --border: #e6e9f2; --border-strong: #d4d9e6;
    --text: #0f172a; --text-2: #334155; --muted: #64748b; --subtle: #94a3b8;

    --success: #059669; --success-bg: #ecfdf5;
    --warning: #b45309; --warning-bg: #fffbeb;
    --danger: #dc2626; --danger-bg: #fef2f2;
    --info: #0369a1; --info-bg: #f0f9ff;

    --linkedin: #0a66c2; --facebook: #1877f2; --instagram: #e4405f; --twitter: #111;

    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-display: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
    --radius-sm: 8px; --radius: 12px; --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 48px -16px rgba(30, 27, 75, .25);
    --ring: 0 0 0 4px rgba(99, 102, 241, .18);
    --sidebar-w: 264px; --sidebar-w-collapsed: 76px; --topbar-h: 64px;
    --t: .2s cubic-bezier(.2, .8, .2, 1);

    --bs-primary: #4f46e5; --bs-primary-rgb: 79, 70, 229;
    --bs-body-font-family: var(--font); --bs-body-color: var(--text); --bs-body-bg: var(--canvas);
    --bs-border-color: var(--border); --bs-link-color: var(--brand-600); --bs-link-hover-color: var(--brand-700);
    --bs-border-radius: var(--radius-sm);
}

/* 2. BASE */
body { font-family: var(--font); font-size: .875rem; line-height: 1.55; color: var(--text); background: var(--canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4, h5 { font-size: 1rem; } h6 { font-size: .875rem; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
.text-muted { color: var(--muted) !important; }
::selection { background: var(--brand-200); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* 3. SHELL */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; width: var(--sidebar-w); display: flex; flex-direction: column; background: var(--gradient-sidebar); color: #c7d2fe; transition: width var(--t), transform var(--t); }
.app-brand { display: flex; align-items: center; gap: .75rem; height: var(--topbar-h); padding: 0 1.2rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-shrink: 0; }
.app-brand:hover { color: #fff; }
.app-brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--gradient); box-shadow: 0 6px 16px -4px rgba(124, 58, 237, .6); font-size: 1.05rem; flex-shrink: 0; }
.app-brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.02rem; line-height: 1.1; white-space: nowrap; }
.app-brand-name small { display: block; font-family: var(--font); font-weight: 500; font-size: .66rem; color: #a5b4fc; letter-spacing: .06em; text-transform: uppercase; }
.app-nav { flex: 1; overflow-y: auto; padding: .9rem .7rem 1.4rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent; }
.nav-group + .nav-group { margin-top: .9rem; }
.nav-heading { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; padding: .3rem .75rem; color: #818cf8; font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav-heading .bi { font-size: .65rem; transition: transform var(--t); }
.nav-group.collapsed .nav-heading .bi { transform: rotate(-90deg); }
.nav-group.collapsed .nav-list { display: none; }
.nav-list { list-style: none; margin: .2rem 0 0; padding: 0; }
.nav-link-app { position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; margin: 1px 0; border-radius: 10px; color: #c7d2fe; font-weight: 500; font-size: .84rem; white-space: nowrap; transition: background var(--t), color var(--t); }
.nav-link-app .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; flex-shrink: 0; }
.nav-link-app:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link-app.active { background: rgba(129, 140, 248, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .15); }
.nav-link-app.active::before { content: ""; position: absolute; left: -.7rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: #a5b4fc; }
.app-sidebar-footer { padding: .8rem 1rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .75rem; }
.role-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #e0e7ff; font-weight: 600; }
.org-chip { display: block; color: #a5b4fc; margin-top: .45rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin var(--t); }
.app-topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--text-2); font-size: 1.1rem; transition: background var(--t); }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.icon-btn .dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin: 0; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.user-btn { display: flex; align-items: center; gap: .6rem; padding: .25rem .6rem .25rem .25rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; }
.user-btn:hover { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gradient); color: #fff; font-weight: 700; font-size: .75rem; flex-shrink: 0; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.user-meta { line-height: 1.15; text-align: left; }
.user-meta strong { display: block; font-size: .8rem; }
.user-meta span { font-size: .68rem; color: var(--muted); }
.app-content { flex: 1; width: 100%; max-width: 1560px; margin: 0 auto; padding: 1.6rem; }
.app-footer { padding: .9rem 1.6rem; font-size: .72rem; color: var(--subtle); border-top: 1px solid var(--border); background: #fff; }
.app-backdrop { display: none; }
body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-brand-name, body.sidebar-collapsed .nav-heading, body.sidebar-collapsed .nav-link-app span, body.sidebar-collapsed .app-sidebar-footer { display: none; }
body.sidebar-collapsed .nav-group.collapsed .nav-list { display: block; }
body.sidebar-collapsed .nav-link-app { justify-content: center; }

/* 4. PAGE HEADER */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-title { font-size: 1.55rem; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.page-subtitle { color: var(--muted); margin: .2rem 0 0; }
.breadcrumb { font-size: .78rem; margin-bottom: .35rem; --bs-breadcrumb-divider: "›"; }
.breadcrumb-item a { color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* 5. CARDS & STATS */
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .95rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.card-header h2, .card-header h3, .card-header h5 { font-size: .95rem; margin: 0; }
.card-body { padding: 1.2rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); }
.section-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--brand-50); color: var(--brand-600); font-size: 1rem; flex-shrink: 0; }
.stat { display: flex; gap: .9rem; align-items: center; padding: 1.05rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-sm); height: 100%; transition: transform var(--t), box-shadow var(--t); color: inherit; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; color: #fff; background: var(--gradient); flex-shrink: 0; box-shadow: 0 8px 16px -8px rgba(79, 70, 229, .7); }
.stat-label { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-sub { font-size: .72rem; color: var(--muted); }
.stat--teal .stat-icon { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.stat--amber .stat-icon { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat--sky .stat-icon { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.stat--rose .stat-icon { background: linear-gradient(135deg, #f43f5e, #ec4899); }
.stat--green .stat-icon { background: linear-gradient(135deg, #059669, #10b981); }
.stat--slate .stat-icon { background: linear-gradient(135deg, #475569, #64748b); }
.hero { position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 1.5rem 1.6rem; background: var(--gradient); color: #fff; box-shadow: var(--shadow-lg); }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.hero h1 { color: #fff; font-size: 1.45rem; margin: 0 0 .3rem; }
.hero p { margin: 0; color: rgba(255, 255, 255, .86); }
.hero .btn { position: relative; z-index: 1; }
.kv { display: grid; grid-template-columns: 38% 1fr; gap: .45rem .9rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }

/* 6. BUTTONS */
.btn { --bs-btn-padding-x: 1rem; --bs-btn-padding-y: .5rem; --bs-btn-font-size: .84rem; --bs-btn-font-weight: 600; --bs-btn-border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: all var(--t); }
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .32rem; --bs-btn-font-size: .76rem; --bs-btn-border-radius: 8px; }
.btn-primary { background: var(--gradient); border: 0; box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7); }
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(135deg, #4338ca, #6d28d9 60%, #9333ea); box-shadow: 0 10px 20px -8px rgba(79, 70, 229, .8); }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); border: 0; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); border: 0; }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #f97316); border: 0; color: #fff; }
.btn-warning:hover { color: #fff; }
.btn-light, .btn-outline-secondary { --bs-btn-color: var(--text-2); --bs-btn-bg: #fff; --bs-btn-border-color: var(--border-strong); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--brand-200); --bs-btn-hover-color: var(--brand-700); --bs-btn-active-bg: var(--brand-50); --bs-btn-active-color: var(--brand-700); }
.btn-outline-primary { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-200); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); }
.btn-outline-danger { --bs-btn-border-color: #fecaca; }
.btn-ai { background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; border: 0; }
.btn-ai:hover { color: #fff; filter: brightness(1.07); }
.row-actions { display: inline-flex; gap: .2rem; }
.row-actions a, .row-actions button { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--muted); border: 0; background: transparent; }
.row-actions a:hover, .row-actions button:hover { background: var(--brand-50); color: var(--brand-700); }
.row-actions .danger:hover { background: var(--danger-bg); color: var(--danger); }

/* 7. FORMS */
.form-label { font-weight: 600; font-size: .8rem; color: var(--text-2); margin-bottom: .35rem; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control, .form-select { border: 1px solid var(--border-strong); border-radius: 10px; padding: .52rem .8rem; font-size: .86rem; color: var(--text); background-color: #fff; transition: border-color var(--t), box-shadow var(--t); }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.form-control::placeholder { color: var(--subtle); }
.form-control[readonly], .form-control:disabled { background: var(--surface-2); color: var(--muted); }
.form-control.is-invalid, .input-validation-error { border-color: var(--danger) !important; }
.field-validation-error, .text-danger.small { display: block; margin-top: .25rem; font-size: .76rem; font-weight: 500; color: var(--danger); }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.form-text { color: var(--muted); font-size: .76rem; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { box-shadow: var(--ring); }
.form-section { padding: 1.2rem; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; padding: 1rem 1.2rem; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.check-card { display: flex; align-items: center; gap: .6rem; padding: .65rem .8rem; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; background: #fff; transition: all var(--t); user-select: none; }
.check-card:hover { border-color: var(--brand-400); }
.check-card input { margin: 0; }
.check-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--ring); }
.check-card.disabled { opacity: .5; cursor: not-allowed; }
.char-count { font-size: .72rem; color: var(--muted); text-align: right; }
.char-count.over { color: var(--danger); font-weight: 700; }
.secret-hint { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px dashed var(--border-strong); padding: .2rem .5rem; border-radius: 6px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; }
.search-box { position: relative; }
.search-box .bi { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--subtle); }
.search-box .form-control { padding-left: 2.2rem; min-width: 240px; }

/* 8. TABLES */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f8f9ff; margin: 0; color: var(--text-2); vertical-align: middle; }
.table > thead > tr > th { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); padding: .7rem 1rem; white-space: nowrap; }
.table > tbody > tr > td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.cell-primary strong { display: block; color: var(--text); font-weight: 600; }
.cell-primary span, .cell-sub { display: block; font-size: .75rem; color: var(--muted); }
.cell-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1.2rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }
.pagination { gap: .25rem; margin: 0; }
.page-link { border: 0; border-radius: 8px !important; color: var(--text-2); font-weight: 600; font-size: .78rem; padding: .35rem .65rem; }
.page-item.active .page-link { background: var(--gradient); color: #fff; }
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .bi { font-size: 2.4rem; color: var(--brand-400); display: block; margin-bottom: .6rem; }
.empty h3 { font-size: 1rem; color: var(--text); }

/* 9. STATUS & BADGES */
.badge { font-weight: 600; font-size: .7rem; padding: .35em .65em; border-radius: 999px; }
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; background: #f1f5f9; color: #475569; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-draft { background: #f1f5f9; color: #475569; }
.st-ai { background: #f5f3ff; color: #6d28d9; }
.st-pending { background: #fffbeb; color: #b45309; }
.st-approved { background: #eef2ff; color: #4338ca; }
.st-scheduled { background: #f0f9ff; color: #0369a1; }
.st-publishing { background: #ecfeff; color: #0e7490; }
.st-published { background: #ecfdf5; color: #047857; }
.st-partial { background: #fff7ed; color: #c2410c; }
.st-failed { background: #fef2f2; color: #b91c1c; }
.st-changes { background: #fefce8; color: #a16207; }
.st-muted { background: #f1f5f9; color: #64748b; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.chip-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.pf { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: #fff; font-size: .78rem; flex-shrink: 0; }
.pf-lg { width: 40px; height: 40px; border-radius: 11px; font-size: 1.15rem; }
.pf-LINKEDIN { background: var(--linkedin); }
.pf-FACEBOOK { background: var(--facebook); }
.pf-INSTAGRAM { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.pf-TWITTER { background: var(--twitter); }

/* 10. FEEDBACK */
.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: .85rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-success { background: var(--success-bg); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-bg); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-bg); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--info-bg); border-color: #bae6fd; color: #075985; }
.toast-stack { position: fixed; right: 1rem; top: calc(var(--topbar-h) + .75rem); z-index: 1090; display: flex; flex-direction: column; gap: .5rem; max-width: 420px; }
.toast-stack .alert { box-shadow: var(--shadow-lg); animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.progress { height: 8px; border-radius: 999px; background: #eef1f6; }
.progress-bar { background: var(--gradient); border-radius: 999px; }
.sim-banner { background: repeating-linear-gradient(45deg, #fffbeb, #fffbeb 10px, #fef3c7 10px, #fef3c7 20px); border-bottom: 1px solid #fde68a; color: #92400e; font-size: .75rem; font-weight: 600; text-align: center; padding: .3rem 1rem; }
.spinner-overlay { position: fixed; inset: 0; z-index: 2000; display: none; place-items: center; background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
.spinner-overlay.show { display: grid; }
.spinner-card { background: #fff; padding: 1.4rem 1.8rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: .9rem; font-weight: 600; }

/* 11. OVERLAYS & TABS */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-footer { background: var(--surface-2); }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; font-size: .84rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; display: flex; align-items: center; gap: .55rem; }
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }
.nav-tabs { border-bottom: 1px solid var(--border); gap: .2rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; padding: .6rem .9rem; border-radius: 0; }
.nav-tabs .nav-link.active { color: var(--brand-700); border-bottom-color: var(--brand-600); background: transparent; }
.nav-pills .nav-link { color: var(--text-2); font-weight: 600; border-radius: 999px; padding: .38rem .9rem; font-size: .8rem; }
.nav-pills .nav-link.active { background: var(--gradient); }

/* 12. CONTENT COMPONENTS */
.post-preview { border: 1px solid var(--border); border-radius: 14px; background: #fff; overflow: hidden; }
.post-preview-head { display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem; }
.post-preview-head strong { display: block; font-size: .82rem; }
.post-preview-head small { color: var(--muted); font-size: .7rem; }
.post-preview-body { padding: 0 .9rem .8rem; white-space: pre-wrap; font-size: .84rem; color: var(--text); word-break: break-word; }
.post-preview img { width: 100%; max-height: 360px; object-fit: cover; display: block; background: var(--surface-2); }
.post-preview-foot { display: flex; gap: 1.2rem; padding: .55rem .9rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .75rem; }
.blog-body { font-size: .92rem; line-height: 1.7; }
.blog-body h2, .blog-body h3 { margin-top: 1.2rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.media-tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1; background: var(--surface-2); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-tile .media-badge { position: absolute; left: 6px; top: 6px; }
.media-tile form { position: absolute; right: 6px; top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 1rem 2.1rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot { position: absolute; left: 4px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-400); }
.timeline .tl-title { font-weight: 600; color: var(--text); font-size: .84rem; }
.timeline .tl-meta { font-size: .72rem; color: var(--muted); }
.timeline .tl-note { font-size: .8rem; color: var(--text-2); margin-top: .15rem; }
.workflow-steps { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.workflow-steps .ws { font-size: .7rem; font-weight: 600; padding: .25rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--subtle); border: 1px solid var(--border); }
.workflow-steps .ws.done { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.workflow-steps .ws.current { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.workflow-steps .sep { color: var(--subtle); font-size: .7rem; }

.calendar { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.calendar th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .55rem; text-align: left; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.calendar td { vertical-align: top; height: 124px; padding: .4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; }
.calendar td:last-child { border-right: 0; }
.calendar td.other { background: var(--surface-2); }
.calendar td.other .day-num { color: var(--subtle); }
.calendar td.today .day-num { background: var(--gradient); color: #fff; }
.calendar .day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.calendar .day-num { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 7px; font-size: .75rem; font-weight: 700; color: var(--text-2); }
.calendar .day-add { opacity: 0; color: var(--brand-600); font-size: .9rem; }
.calendar td:hover .day-add { opacity: 1; }
.cal-item { display: flex; align-items: center; gap: .3rem; font-size: .7rem; padding: .18rem .35rem; border-radius: 6px; margin-bottom: 3px; background: var(--brand-50); color: var(--brand-900); border-left: 3px solid var(--brand-500); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.cal-item:hover { color: var(--brand-900); filter: brightness(.97); }
.cal-item.st-published { border-left-color: #10b981; background: #ecfdf5; }
.cal-item.st-failed { border-left-color: #ef4444; background: #fef2f2; }
.cal-item.st-pending, .cal-item.st-changes { border-left-color: #f59e0b; background: #fffbeb; }
.cal-item.st-scheduled { border-left-color: #0ea5e9; background: #f0f9ff; }
.cal-item.st-partial { border-left-color: #f97316; background: #fff7ed; }
.cal-item .t { font-weight: 700; flex-shrink: 0; }
.cal-slot { font-size: .66rem; color: var(--subtle); border: 1px dashed var(--border-strong); border-radius: 6px; padding: .1rem .35rem; margin-bottom: 3px; }
.cal-more { font-size: .68rem; color: var(--muted); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .6rem; }
.week-col { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); min-height: 360px; display: flex; flex-direction: column; }
.week-col-head { padding: .6rem .7rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .8rem; }
.week-col-head small { display: block; color: var(--muted); font-weight: 500; }
.week-col.today .week-col-head { background: var(--gradient-soft); color: var(--brand-700); }
.week-col-body { padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.week-card { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .55rem; font-size: .75rem; background: var(--surface-2); color: var(--text); }
.week-card:hover { border-color: var(--brand-300, #a5b4fc); color: var(--text); box-shadow: var(--shadow-sm); }
.week-card .time { font-weight: 700; color: var(--brand-700); }
.legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .72rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; background: var(--c); }
.platform-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; padding: 1.1rem; height: 100%; display: flex; flex-direction: column; gap: .7rem; }
.platform-card.connected { border-color: #a7f3d0; }
.platform-card.problem { border-color: #fecaca; }
.ai-panel { border: 1px solid #e9d5ff; background: linear-gradient(180deg, #faf5ff, #fff 45%); border-radius: var(--radius-lg); }
.ai-result-block { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: .8rem .9rem; background: #fff; }
.ai-result-block .label { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.ai-result-block .copy-btn { position: absolute; right: .5rem; top: .45rem; }
.perm-matrix th:first-child, .perm-matrix td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.perm-module { background: var(--surface-2) !important; font-weight: 700; color: var(--text); }
.chart-box { min-height: 260px; }

/* 13. AUTH & PUBLIC */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-aside { position: relative; overflow: hidden; background: var(--gradient-sidebar); color: #e0e7ff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside::before { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; right: -160px; top: -120px; background: radial-gradient(circle, rgba(168, 85, 247, .45), transparent 70%); }
.auth-aside h1 { color: #fff; font-size: 2.1rem; font-weight: 800; line-height: 1.15; max-width: 460px; }
.auth-aside p { color: #c7d2fe; max-width: 460px; }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; position: relative; }
.auth-feature .bi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; flex-shrink: 0; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 1.55rem; font-weight: 800; }
.public-page { min-height: 100vh; background: var(--canvas); padding: 2rem 1rem; }
.public-card { max-width: 760px; margin: 0 auto; }

/* 14. UTILITIES */
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-xs { font-size: .72rem; } .fs-sm { font-size: .8rem; }
.gap-2 { gap: .5rem; }
.min-w-0 { min-width: 0; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .76rem; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.divider { border-top: 1px solid var(--border); margin: 1rem 0; }

/* 15. RESPONSIVE */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    body.sidebar-open .app-sidebar { transform: none; }
    body.sidebar-open .app-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .45); }
    .app-main, body.sidebar-collapsed .app-main { margin-left: 0; }
    .app-content { padding: 1rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .week-grid { grid-template-columns: 1fr; }
    .calendar td { height: 90px; }
    .sticky-side { position: static; }
}
@media (max-width: 575.98px) {
    .user-meta { display: none; }
    .page-title { font-size: 1.3rem; }
    .kv { grid-template-columns: 1fr; gap: .1rem; }
    .kv dd { margin-bottom: .5rem; }
    .calendar th { font-size: .6rem; padding: .3rem; }
    .calendar td { height: 70px; padding: .2rem; }
    .cal-item span.title { display: none; }
}
@media print {
    .app-sidebar, .app-topbar, .app-footer, .page-actions, .btn { display: none !important; }
    .app-main { margin: 0 !important; }
}

/* Required-field marker for tag-helper labels */
.required-mark::after { content: " *"; color: var(--danger); font-weight: 700; }
