/* ═══════════════════════════════════════════════
   Instagram Promotion Dashboard — Main Stylesheet
   No external font dependencies. System font stack.
════════════════════════════════════════════════ */

:root {
    --ig-primary:   #E1306C;
    --ig-secondary: #F77737;
    --ig-purple:    #833AB4;
    --ig-gradient:  linear-gradient(135deg, #F58529 0%, #DD2A7B 50%, #515BD4 100%);
    --ig-gradient-soft: linear-gradient(135deg, rgba(245,133,41,0.08), rgba(221,42,123,0.08), rgba(81,91,212,0.08));

    --bg-body:    #F0F2F5;
    --bg-card:    #FFFFFF;
    --bg-soft:    #F8F9FA;

    --text-primary:   #111827;
    --text-secondary: #6B7280;
    --text-muted:     #9CA3AF;

    --border:       #E5E7EB;
    --border-light: #F3F4F6;

    --green:    #10B981;
    --green-bg: #ECFDF5;
    --amber:    #F59E0B;
    --amber-bg: #FFFBEB;
    --blue:     #3B82F6;
    --blue-bg:  #EFF6FF;
    --red:      #EF4444;
    --red-bg:   #FEF2F2;

    --radius-s:  6px;
    --radius-m:  10px;
    --radius-l:  16px;
    --radius-xl: 24px;

    --shadow-s:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-m:  0 4px 16px rgba(0,0,0,0.09);
    --shadow-l:  0 8px 32px rgba(0,0,0,0.13);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.2);

    --sidebar-w: 256px;
    --header-h:  68px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { display: block; }

/* ═══ LOGIN ═══════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px; position: relative; overflow: hidden;
    background: #0a0a0f;
}

.login-page::before {
    content: ''; position: absolute;
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(225,48,108,0.18) 0%, transparent 65%);
    top: -200px; right: -200px; border-radius: 50%; pointer-events: none;
}

.login-page::after {
    content: ''; position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(81,91,212,0.15) 0%, transparent 65%);
    bottom: -150px; left: -150px; border-radius: 50%; pointer-events: none;
}

.login-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }

.login-brand { text-align: center; margin-bottom: 32px; }

.login-brand-icon {
    width: 60px; height: 60px;
    background: var(--ig-gradient);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 8px 24px rgba(225,48,108,0.4);
}

.login-brand-icon svg { width: 30px; height: 30px; stroke: white; }
.login-brand h1 { font-size: 1.4rem; font-weight: 700; color: white; margin-bottom: 4px; }
.login-brand p  { font-size: 0.85rem; color: rgba(255,255,255,0.45); }

.login-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl); padding: 36px;
    box-shadow: var(--shadow-xl);
}

.login-label {
    display: block; font-size: 0.78rem; font-weight: 600;
    color: rgba(255,255,255,0.55); text-transform: uppercase;
    letter-spacing: 0.6px; margin-bottom: 6px;
}

.login-input-wrap { margin-bottom: 16px; }

.login-input {
    width: 100%; padding: 12px 16px;
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-m); color: white; font-size: 0.95rem;
    transition: 0.2s ease;
}

.login-input::placeholder { color: rgba(255,255,255,0.25); }
.login-input:focus {
    outline: none; border-color: rgba(225,48,108,0.7);
    background: rgba(255,255,255,0.1); box-shadow: 0 0 0 3px rgba(225,48,108,0.15);
}

.login-btn {
    width: 100%; padding: 13px;
    background: var(--ig-gradient); color: white;
    font-size: 0.95rem; font-weight: 600; border: none;
    border-radius: var(--radius-m); cursor: pointer; transition: 0.2s ease;
    margin-top: 8px; box-shadow: 0 4px 16px rgba(225,48,108,0.35);
}

.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(225,48,108,0.45); }

.login-error {
    background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
    color: #FCA5A5; border-radius: var(--radius-s);
    padding: 10px 14px; font-size: 0.84rem; margin-bottom: 16px; display: none;
}
.login-error.show { display: block; }

/* ═══ APP SHELL ════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--bg-card); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
    transition: transform 0.28s ease; overflow: hidden;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px; height: var(--header-h);
    border-bottom: 1px solid var(--border-light);
    text-decoration: none; flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px; height: 36px; background: var(--ig-gradient);
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; overflow: hidden;
}

.sidebar-brand-icon svg { width: 20px; height: 20px; stroke: white; }
.sidebar-brand-icon img { width: 100%; height: 100%; object-fit: contain; }

.sidebar-brand-text {
    font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }

.nav-group { margin-bottom: 4px; }

.nav-group-label {
    font-size: 0.65rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.8px; padding: 0 10px 6px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-m);
    color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
    cursor: pointer; transition: 0.15s ease;
    text-decoration: none; border: none; background: none; width: 100%;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-soft); color: var(--text-primary); }
.nav-item.active { background: var(--ig-gradient-soft); color: var(--ig-primary); font-weight: 600; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-light); flex-shrink: 0; }

.user-block { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-m); margin-bottom: 4px; }

.user-avatar {
    width: 32px; height: 32px; background: var(--ig-gradient);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}

.user-name { font-size: 0.83rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

.nav-item.logout { color: var(--red); }
.nav-item.logout:hover { background: var(--red-bg); color: var(--red); }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 199;
    opacity: 0; pointer-events: none; transition: opacity 0.28s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* Main */
.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h); background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 14px;
}

.topbar-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }

.mobile-toggle {
    display: none; width: 34px; height: 34px;
    border: 1.5px solid var(--border); border-radius: var(--radius-s);
    background: var(--bg-card); cursor: pointer;
    align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0;
}
.mobile-toggle svg { width: 18px; height: 18px; }

.topbar-title h1 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.topbar-title p  { font-size: 0.75rem; color: var(--text-secondary); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.page { flex: 1; padding: 24px; }

/* ═══ BUTTONS ═════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; font-size: 0.85rem; font-weight: 600;
    border-radius: var(--radius-m); border: 1.5px solid transparent;
    cursor: pointer; transition: 0.18s ease; text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary { background: var(--ig-gradient); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(225,48,108,0.35); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--bg-soft); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--border-light); border-color: #D1D5DB; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text-primary); }

.btn-danger { background: var(--red); color: white; border-color: var(--red); }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,0.35); }
.btn-danger:active { transform: translateY(0); }

.btn-danger-soft { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.25); }
.btn-danger-soft:hover { background: #FEE2E2; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 9px; font-size: 0.73rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ═══ STATS GRID ══════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px; margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-l); padding: 18px 16px;
    box-shadow: var(--shadow-s); position: relative; overflow: hidden;
    transition: 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.s-total::before   { background: #6366F1; }
.stat-card.s-active::before  { background: var(--green); }
.stat-card.s-pending::before { background: var(--amber); }
.stat-card.s-done::before    { background: var(--blue); }
.stat-card.s-spent::before   { background: var(--ig-primary); }
.stat-card.s-reach::before   { background: var(--ig-purple); }

.stat-icon {
    width: 36px; height: 36px; border-radius: var(--radius-s);
    display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.stat-card.s-total  .stat-icon { background: rgba(99,102,241,0.1);  color: #6366F1; }
.stat-card.s-active .stat-icon { background: var(--green-bg);        color: var(--green); }
.stat-card.s-pending .stat-icon { background: var(--amber-bg);       color: var(--amber); }
.stat-card.s-done   .stat-icon { background: var(--blue-bg);         color: var(--blue); }
.stat-card.s-spent  .stat-icon { background: rgba(225,48,108,0.1);   color: var(--ig-primary); }
.stat-card.s-reach  .stat-icon { background: rgba(131,58,180,0.1);   color: var(--ig-purple); }
.stat-icon svg { width: 18px; height: 18px; }

.stat-value {
    font-size: 1.65rem; font-weight: 800; line-height: 1;
    color: var(--text-primary); letter-spacing: -0.5px; margin-bottom: 4px;
}
.stat-label {
    font-size: 0.72rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.4px;
}

/* Skeleton */
.skel {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
    background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══ CHART ═══════════════════════════════════ */
.chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-l); box-shadow: var(--shadow-s);
    padding: 20px 22px; margin-bottom: 20px;
}

.chart-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}

.chart-head-left h2 { font-size: 0.95rem; font-weight: 700; }
.chart-head-left p  { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.chart-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.chart-tab {
    padding: 5px 13px; font-size: 0.75rem; font-weight: 600;
    border-radius: 20px; border: 1.5px solid var(--border);
    background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: 0.15s ease;
}
.chart-tab:hover { border-color: var(--ig-primary); color: var(--ig-primary); }
.chart-tab.active { background: var(--ig-gradient); color: white; border-color: transparent; }

.chart-wrap { position: relative; height: 200px; }

/* ═══ TABLE CARD ══════════════════════════════ */
.table-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-l); box-shadow: var(--shadow-s); overflow: hidden;
}

.table-head {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.table-head h2 { font-size: 0.95rem; font-weight: 700; }

.table-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.search-wrap { position: relative; }
.search-wrap svg {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}

.search-box {
    padding: 7px 12px 7px 32px; font-size: 0.83rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-m);
    background: var(--bg-soft); color: var(--text-primary);
    width: 200px; transition: 0.2s ease;
}
.search-box:focus { outline: none; border-color: var(--ig-primary); background: white; width: 240px; }

.filter-chips { display: flex; gap: 4px; }

.chip {
    padding: 5px 12px; font-size: 0.75rem; font-weight: 600;
    border-radius: 20px; border: 1.5px solid var(--border);
    background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: 0.15s ease;
}
.chip:hover { border-color: var(--ig-primary); color: var(--ig-primary); }
.chip.active { background: var(--ig-gradient); color: white; border-color: transparent; }

/* Bulk bar */
.bulk-bar {
    display: none; align-items: center; gap: 12px;
    padding: 10px 18px;
    background: var(--ig-gradient-soft);
    border-bottom: 1px solid var(--border); font-size: 0.83rem;
}
.bulk-bar.show { display: flex; }

/* Table */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data-tbl { width: 100%; border-collapse: collapse; min-width: 640px; }

table.data-tbl thead tr { background: var(--bg-soft); border-bottom: 1px solid var(--border); }

table.data-tbl th {
    padding: 10px 14px; font-size: 0.68rem; font-weight: 700;
    color: var(--text-secondary); text-transform: uppercase;
    letter-spacing: 0.5px; text-align: left; white-space: nowrap; user-select: none;
}

table.data-tbl th.sortable { cursor: pointer; transition: color 0.15s; }
table.data-tbl th.sortable:hover { color: var(--text-primary); }
table.data-tbl th.sort-asc::after  { content: ' ↑'; color: var(--ig-primary); }
table.data-tbl th.sort-desc::after { content: ' ↓'; color: var(--ig-primary); }

table.data-tbl td {
    padding: 12px 14px; font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
table.data-tbl tbody tr:last-child td { border-bottom: none; }
table.data-tbl tbody tr:hover td { background: rgba(225,48,108,0.02); }

.cb { width: 15px; height: 15px; cursor: pointer; accent-color: var(--ig-primary); }

/* Promo cell */
.promo-cell { display: flex; align-items: center; gap: 10px; }

.promo-thumb {
    width: 42px; height: 42px; border-radius: var(--radius-s);
    overflow: hidden; flex-shrink: 0; background: var(--bg-soft);
    border: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: center;
}
.promo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.promo-thumb svg { width: 18px; height: 18px; color: var(--text-muted); }

.promo-name {
    font-size: 0.83rem; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 200px; display: block; text-decoration: none;
}
.promo-name:hover { color: var(--ig-primary); }
.promo-date { font-size: 0.71rem; color: var(--text-muted); margin-top: 1px; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.active    { background: var(--green-bg); color: var(--green); }
.badge.pending   { background: var(--amber-bg); color: var(--amber); }
.badge.completed { background: var(--blue-bg);  color: var(--blue); }

/* Inline status select */
.status-sel {
    font-size: 0.68rem; font-weight: 700;
    padding: 3px 22px 3px 10px; border-radius: 20px;
    border: none; cursor: pointer; appearance: none; -webkit-appearance: none;
    background-repeat: no-repeat; background-position: right 6px center; background-size: 10px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    letter-spacing: 0.3px; text-transform: uppercase;
}
.status-sel.active    { background-color: var(--green-bg); color: var(--green); }
.status-sel.pending   { background-color: var(--amber-bg); color: var(--amber); }
.status-sel.completed { background-color: var(--blue-bg);  color: var(--blue); }

/* Action buttons */
.action-cell { display: flex; align-items: center; gap: 4px; }

.act-btn {
    width: 30px; height: 30px; border-radius: var(--radius-s);
    border: 1.5px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: 0.15s ease; text-decoration: none;
}
.act-btn svg { width: 13px; height: 13px; }
.act-btn:hover { background: var(--bg-soft); color: var(--text-primary); }
.act-btn.view:hover { color: var(--blue); border-color: #93C5FD; }
.act-btn.edit:hover { color: var(--amber); border-color: #FCD34D; }
.act-btn.del:hover  { color: var(--red); border-color: #FCA5A5; background: var(--red-bg); }

/* Empty state */
.empty-state { padding: 64px 24px; text-align: center; }
.empty-icon {
    width: 56px; height: 56px; background: var(--ig-gradient-soft);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; color: var(--ig-primary);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.empty-state p  { font-size: 0.84rem; color: var(--text-secondary); }

/* Pagination */
.pagination {
    padding: 12px 18px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pag-info { font-size: 0.78rem; color: var(--text-secondary); }
.pag-btns { display: flex; gap: 4px; }
.pag-btn {
    min-width: 30px; height: 30px; padding: 0 8px;
    border: 1.5px solid var(--border); border-radius: var(--radius-s);
    background: var(--bg-card); color: var(--text-secondary);
    font-size: 0.78rem; cursor: pointer; transition: 0.15s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
.pag-btn:hover:not(:disabled) { background: var(--bg-soft); color: var(--text-primary); }
.pag-btn.active { background: var(--ig-gradient); color: white; border-color: transparent; }
.pag-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ═══ MODAL ═══════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: flex-start; justify-content: center;
    z-index: 1000;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    padding: 24px; overflow-y: auto;
}
.modal-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }

.modal {
    background: var(--bg-card); border-radius: var(--radius-l);
    width: 100%; max-width: 620px; overflow: hidden;
    display: flex; flex-direction: column;
    transform: scale(0.93) translateY(20px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-xl); margin: auto; flex-shrink: 0;
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 16px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-title { font-size: 1rem; font-weight: 700; }

.modal-close {
    width: 30px; height: 30px; border-radius: var(--radius-s);
    border: 1.5px solid var(--border); background: var(--bg-card);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: 0.15s ease;
}
.modal-close:hover { background: var(--text-primary); color: white; border-color: var(--text-primary); }
.modal-close svg { width: 14px; height: 14px; }

.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* Confirm modal */
.confirm-modal { max-width: 380px; }
.confirm-body  { padding: 32px 24px; text-align: center; }
.confirm-icon {
    width: 52px; height: 52px; background: var(--red-bg); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; color: var(--red);
}
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.confirm-msg   { font-size: 0.875rem; color: var(--text-secondary); }

/* ═══ FORM ELEMENTS ═══════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.form-label .req { color: var(--ig-primary); }

.form-control {
    width: 100%; padding: 9px 12px; font-size: 0.875rem;
    border: 1.5px solid var(--border); border-radius: var(--radius-m);
    background: var(--bg-card); color: var(--text-primary); transition: 0.15s ease;
}
.form-control:focus { outline: none; border-color: var(--ig-primary); box-shadow: 0 0 0 3px rgba(225,48,108,0.1); }

select.form-control {
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    background-size: 15px; padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.form-section {
    margin: 14px 0; padding: 14px; background: var(--bg-soft);
    border-radius: var(--radius-m); border: 1px solid var(--border);
}
.form-section-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 12px;
}

/* Image upload zone */
.img-zone {
    display: block; border: 2px dashed var(--border);
    border-radius: var(--radius-m); padding: 16px;
    text-align: center; cursor: pointer; transition: 0.2s ease; position: relative;
}
.img-zone:hover { border-color: var(--ig-primary); background: rgba(225,48,108,0.02); }
.img-zone.has-img { border-style: solid; border-color: var(--ig-primary); }
.img-zone input[type="file"] { display: none; }

.img-preview {
    width: 100%; height: 130px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-s); overflow: hidden;
    margin-bottom: 8px; color: var(--text-muted);
}
.img-preview svg { width: 40px; height: 40px; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-s); }

.img-zone-text { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.img-zone-text strong { color: var(--ig-primary); }

.remove-img-btn {
    position: absolute; top: 8px; right: 8px;
    width: 22px; height: 22px; background: rgba(0,0,0,0.55); color: white;
    border: none; border-radius: 50%; cursor: pointer; font-size: 14px;
    display: none; align-items: center; justify-content: center;
}
.img-zone.has-img .remove-img-btn { display: flex; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.slider {
    width: 40px; height: 22px; background: var(--border);
    border-radius: 11px; position: relative; transition: 0.25s ease;
}
.slider::after {
    content: ''; position: absolute; width: 16px; height: 16px;
    background: white; border-radius: 50%; top: 3px; left: 3px;
    transition: 0.25s ease; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--ig-primary); }
.switch input:checked + .slider::after { transform: translateX(18px); }

/* ═══ TOAST ═══════════════════════════════════ */
.toast-stack {
    position: fixed; bottom: 24px; right: 24px; z-index: 3000;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; background: var(--bg-card); border-radius: var(--radius-m);
    box-shadow: var(--shadow-l); border-left: 3px solid var(--border);
    min-width: 270px; max-width: 360px; pointer-events: auto;
    animation: toastSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastSlide {
    from { opacity: 0; transform: translateX(80px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warn    { border-left-color: var(--amber); }
.toast-ico { flex-shrink: 0; }
.toast-ico svg { width: 16px; height: 16px; }
.toast.success .toast-ico { color: var(--green); }
.toast.error   .toast-ico { color: var(--red); }
.toast.warn    .toast-ico { color: var(--amber); }
.toast-txt { flex: 1; font-size: 0.84rem; font-weight: 500; }
.toast-x { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-muted); padding: 0; flex-shrink: 0; line-height: 1; }
.toast-x:hover { color: var(--text-primary); }

/* ═══ LOADING ═════════════════════════════════ */
.loading-cover {
    position: fixed; inset: 0; background: rgba(255,255,255,0.82);
    backdrop-filter: blur(2px); display: none;
    align-items: center; justify-content: center; z-index: 5000;
}
.loading-cover.show { display: flex; }
.spinner-ring {
    width: 38px; height: 38px; border: 3px solid var(--border);
    border-top-color: var(--ig-primary); border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: white;
    border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle;
}
.spinner.dark { border-color: var(--border); border-top-color: var(--ig-primary); width: 22px; height: 22px; }

/* ═══ VIEW PROMOTION PAGE ═════════════════════ */
.view-page { max-width: 860px; }
.view-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-l); box-shadow: var(--shadow-s);
    overflow: hidden; margin-bottom: 18px;
}
.view-card-head {
    padding: 13px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-soft); display: flex; align-items: center; gap: 8px;
}
.view-card-head h2 { font-size: 0.88rem; font-weight: 700; }
.view-card-body { padding: 20px; }

.view-hero { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.view-img {
    aspect-ratio: 1; border-radius: var(--radius-m); overflow: hidden;
    background: var(--bg-soft); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.view-img img { width: 100%; height: 100%; object-fit: cover; }
.view-img svg { width: 50px; height: 50px; color: var(--text-muted); }

.view-fields { display: grid; gap: 14px; }
.view-field label {
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-muted); display: block; margin-bottom: 3px;
}
.view-field .val { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.view-field a { color: var(--ig-primary); font-size: 0.84rem; word-break: break-all; }
.view-field a:hover { text-decoration: underline; }

.amount-val {
    font-size: 1.4rem; font-weight: 800;
    background: var(--ig-gradient); -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; background-clip: text;
}

.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.perf-item {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-m); padding: 14px 12px; text-align: center;
}
.perf-val { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 5px; }
.perf-lbl { font-size: 0.68rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }

.notes-box {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-radius: var(--radius-m); padding: 14px;
    font-size: 0.875rem; color: var(--text-secondary); white-space: pre-wrap; min-height: 60px;
}

/* ═══ SETTINGS PAGE ═══════════════════════════ */
.settings-page { max-width: 820px; }
.settings-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-l); box-shadow: var(--shadow-s); overflow: hidden; margin-bottom: 18px;
}
.settings-card-head {
    padding: 13px 20px; border-bottom: 1px solid var(--border);
    background: var(--bg-soft); display: flex; align-items: center; gap: 8px;
}
.settings-card-head svg { width: 16px; height: 16px; color: var(--ig-primary); }
.settings-card-head h2  { font-size: 0.88rem; font-weight: 700; }
.settings-card-body { padding: 0; }

.settings-row {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light); gap: 24px;
}
.settings-row:last-child { border-bottom: none; }
.settings-lbl h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 3px; }
.settings-lbl p  { font-size: 0.77rem; color: var(--text-secondary); }
.settings-ctrl { flex: 0 0 220px; }
.settings-ctrl .form-control { width: 100%; }

.upload-row { display: flex; align-items: center; gap: 12px; }
.upload-preview {
    width: 54px; height: 54px; border-radius: var(--radius-m);
    border: 2px solid var(--border); background: var(--bg-soft);
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.upload-preview img { width: 100%; height: 100%; object-fit: contain; }
.upload-preview svg { width: 22px; height: 22px; color: var(--text-muted); }

.upload-acts { display: flex; flex-direction: column; gap: 5px; }
.upload-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
    font-size: 0.79rem; font-weight: 600; color: var(--ig-primary);
    background: rgba(225,48,108,0.08); border: none; border-radius: var(--radius-s);
    cursor: pointer; transition: 0.15s;
}
.upload-btn:hover { background: rgba(225,48,108,0.14); }
.upload-btn input { display: none; }
.upload-hint { font-size: 0.68rem; color: var(--text-muted); }

.pw-grid { display: grid; gap: 12px; }

.sticky-save {
    position: sticky; bottom: 0; background: var(--bg-card);
    border-top: 1px solid var(--border); padding: 12px 0 0;
    display: flex; justify-content: flex-end; margin-top: 16px;
}

/* ═══ RESPONSIVE ══════════════════════════════ */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .sidebar-overlay { display: block; }
    .main { margin-left: 0; }
    .mobile-toggle { display: flex; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .form-row-4 { grid-template-columns: repeat(2, 1fr); }
    .view-hero { grid-template-columns: 1fr; }
    .settings-row { flex-direction: column; gap: 10px; }
    .settings-ctrl { flex: none; width: 100%; }
}

@media (max-width: 640px) {
    .page { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .table-head { flex-direction: column; align-items: flex-start; }
    .table-controls { width: 100%; }
    .search-box, .search-box:focus { width: 100%; }
    .search-wrap { flex: 1; }
    .form-row { grid-template-columns: 1fr; }
    .modal-overlay { padding: 12px; }
    .perf-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-title p { display: none; }
}
