:root {
    --am-primary: #2563eb;
    --am-primary-soft: rgba(37, 99, 235, .08);
    --am-bg: #f5f7fb;
    --am-surface: #ffffff;
    --am-border: #e5e7eb;
    --am-text: #111827;
    --am-muted: #6b7280;
    --am-radius: 12px;
    --am-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

* {
    box-sizing: border-box;
}

body.am-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--am-bg);
    color: var(--am-text);
    margin: 0;
    padding: 0;
    padding-bottom: 76px;
}

@media (min-width: 992px) {
    body.am-body { padding-bottom: 0; }
}

/* Top bar */
.am-topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; border-bottom: 1px solid var(--am-border);
    padding: 10px 16px; min-height: 56px;
}
.am-topbar-left { display: flex; align-items: center; gap: 10px; }
.am-topbar-right { display: flex; align-items: center; gap: 8px; }
.am-burger {
    border: 0; background: transparent; font-size: 22px;
    width: 38px; height: 38px; border-radius: 8px;
}
.am-burger:hover { background: var(--am-primary-soft); }
.am-brand {
    display: inline-flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: 18px; text-decoration: none; color: var(--am-text);
}
.am-logo-dot {
    width: 22px; height: 22px; border-radius: 7px;
    background: linear-gradient(135deg, var(--am-primary), #7c3aed);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
}
.am-ws-switch select {
    border-radius: 8px; border: 1px solid var(--am-border);
    max-width: 180px;
}
.am-user-btn {
    border: 0; background: transparent; padding: 4px 8px; border-radius: 8px;
    display: inline-flex; align-items: center;
}
.am-user-btn:hover { background: var(--am-primary-soft); }
.am-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--am-primary), #7c3aed);
    color: #fff; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
}

/* Shell */
.am-shell { display: flex; min-height: calc(100vh - 56px); }
.am-sidebar {
    width: 240px; background: #fff; border-right: 1px solid var(--am-border);
    padding: 14px 12px; flex-shrink: 0;
    position: fixed; top: 56px; left: -260px; bottom: 0;
    transition: left .25s ease; z-index: 1020;
    overflow-y: auto;
}
.am-sidebar.open { left: 0; }
.am-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, .35);
    z-index: 1015; display: none;
}
.am-overlay.show { display: block; }
.am-main {
    flex: 1; padding: 20px 16px 24px; min-width: 0;
}
@media (min-width: 992px) {
    .am-sidebar { position: sticky; top: 56px; left: 0; height: calc(100vh - 56px); }
    .am-overlay { display: none !important; }
    .am-main { padding: 24px 28px; }
}

.am-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 2px;
    border-radius: 10px; text-decoration: none; color: var(--am-text);
    font-size: 14.5px; font-weight: 500;
}
.am-nav-item i { font-size: 17px; width: 22px; text-align: center; color: var(--am-muted); }
.am-nav-item:hover { background: var(--am-primary-soft); }
.am-nav-item.active { background: var(--am-primary); color: #fff; }
.am-nav-item.active i { color: #fff; }

/* Bottom nav */
.am-bottom {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--am-border);
    display: flex; justify-content: space-around;
    padding: 6px 0 8px; z-index: 1025;
}
.am-bottom-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; text-decoration: none; color: var(--am-muted);
    font-size: 11px; flex: 1; padding: 4px;
}
.am-bottom-item i { font-size: 22px; }
.am-bottom-item.active { color: var(--am-primary); }
.am-bottom-item:nth-child(3) i {
    background: var(--am-primary); color: #fff;
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    margin-top: -10px; box-shadow: 0 6px 14px rgba(37, 99, 235, .35);
}
.am-bottom-item:nth-child(3).active i { background: var(--am-primary); }

/* Cards & components */
.am-card {
    background: var(--am-surface); border: 1px solid var(--am-border);
    border-radius: var(--am-radius); padding: 18px;
    box-shadow: var(--am-shadow); margin-bottom: 16px;
}
.am-card-h {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.am-card-h h2 {
    font-size: 16px; margin: 0; font-weight: 600;
}

.am-stat {
    background: #fff; border: 1px solid var(--am-border);
    border-radius: var(--am-radius); padding: 14px 16px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--am-shadow);
}
.am-stat-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: var(--am-primary-soft); color: var(--am-primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.am-stat-num { font-size: 22px; font-weight: 700; line-height: 1; }
.am-stat-label { font-size: 12.5px; color: var(--am-muted); margin-top: 4px; }

.btn-am {
    background: var(--am-primary); border-color: var(--am-primary); color: #fff;
}
.btn-am:hover, .btn-am:focus { background: #1d4fd0; border-color: #1d4fd0; color: #fff; }

.btn-am-outline {
    background: transparent; border: 1px solid var(--am-primary); color: var(--am-primary);
}
.btn-am-outline:hover { background: var(--am-primary); color: #fff; }

/* Status badges */
.bg-purple { background: #8b5cf6 !important; color: #fff; }
.bg-purple-dark { background: #6d28d9 !important; color: #fff; }
.bg-warning-strong { background: #f59e0b !important; }
.am-badge { font-size: 11.5px; padding: 4px 9px; border-radius: 999px; font-weight: 500; }

/* Tables */
.am-table { width: 100%; border-collapse: collapse; }
.am-table th, .am-table td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--am-border); font-size: 14px;
}
.am-table th { background: #fafbfc; font-weight: 600; color: var(--am-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
.am-table tbody tr:hover { background: #fafbfc; }

/* Mobile post cards */
.am-post-card {
    background: #fff; border: 1px solid var(--am-border);
    border-radius: var(--am-radius); padding: 14px; margin-bottom: 10px;
}
.am-post-card-title { font-weight: 600; margin-bottom: 4px; }
.am-post-card-meta { font-size: 12.5px; color: var(--am-muted); }

/* Filter bar */
.am-filter-bar {
    background: #fff; border: 1px solid var(--am-border);
    border-radius: var(--am-radius); padding: 14px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px; margin-bottom: 16px;
}

/* Forms */
.form-control, .form-select { border-radius: 8px; }
.form-label { font-size: 14px; font-weight: 500; margin-bottom: 6px; }

/* Login page */
.am-login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
}
.am-login-card {
    background: #fff; border-radius: 20px; padding: 32px 28px;
    width: 100%; max-width: 420px;
    box-shadow: 0 20px 50px rgba(37, 99, 235, .12);
}
.am-login-logo {
    width: 56px; height: 56px; border-radius: 14px;
    background: linear-gradient(135deg, var(--am-primary), #7c3aed);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 26px; margin-bottom: 18px;
}

/* FB preview */
.fb-preview {
    background: #fff; border: 1px solid var(--am-border);
    border-radius: 10px; overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: #050505;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.fb-head { display: flex; gap: 10px; padding: 12px 14px; align-items: center; }
.fb-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: #1877f2; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.fb-page-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.fb-time { font-size: 12px; color: #65676b; }
.fb-body { padding: 0 14px 12px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.45; }
.fb-image { width: 100%; max-height: 400px; object-fit: cover; background: #f0f2f5; display: block; }
.fb-actions {
    display: flex; padding: 6px; border-top: 1px solid #ced0d4;
}
.fb-action {
    flex: 1; text-align: center; padding: 8px;
    color: #65676b; font-weight: 600; font-size: 14px;
    border-radius: 6px;
}

/* Calendar */
.am-cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    background: var(--am-border); border: 1px solid var(--am-border);
    border-radius: 10px; overflow: hidden;
}
.am-cal-cell {
    background: #fff; min-height: 96px; padding: 8px; font-size: 12.5px;
}
.am-cal-cell.head { background: #f9fafb; font-weight: 600; min-height: auto; padding: 8px; text-align: center; color: var(--am-muted); text-transform: uppercase; font-size: 11px; }
.am-cal-cell.muted { background: #fafbfc; color: #c7c9cc; }
.am-cal-day { font-weight: 600; margin-bottom: 4px; }
.am-cal-event {
    display: block; background: var(--am-primary-soft);
    color: var(--am-primary); padding: 3px 6px;
    border-radius: 5px; margin-bottom: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-decoration: none; font-size: 11.5px;
}

/* Helper utilities */
.text-muted-2 { color: var(--am-muted); }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
hr.am-soft { border-color: var(--am-border); opacity: 1; margin: 14px 0; }

@media (max-width: 575px) {
    .am-card { padding: 14px; }
    .am-stat-num { font-size: 18px; }
}
