@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg:           #09090b;
    --bg-card:      #111113;
    --bg-hover:     #1a1a1d;
    --border:       rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.14);
    --accent:       #f97316;
    --accent-hover: #ea6c0a;
    --accent-glow:  rgba(249,115,22,0.18);
    --text-1:       #fafafa;
    --text-2:       #a1a1aa;
    --text-3:       #52525b;
    --sidebar-w:    240px;
    --header-h:     56px;
    --radius:       10px;
    --radius-lg:    14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Noise texture overlay ───────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ── CRM Layout ──────────────────────────────────── */
.crm-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -.2px;
}

.brand-version {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-3);
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-left: auto;
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-3);
    padding: 14px 18px 5px;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 18px;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 0;
    transition: color .12s, background .12s;
    position: relative;
    cursor: pointer;
    margin: 1px 8px;
    border-radius: 7px;
}

.sidebar-nav .nav-item i {
    font-size: 15px;
    width: 16px;
    text-align: center;
    opacity: .7;
    flex-shrink: 0;
}

.sidebar-nav .nav-item:hover {
    color: var(--text-1);
    background: var(--bg-hover);
}

.sidebar-nav .nav-item:hover i { opacity: 1; }

.sidebar-nav .nav-item.active {
    color: var(--text-1);
    background: var(--bg-hover);
}

.sidebar-nav .nav-item.active i { opacity: 1; color: var(--accent); }

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    line-height: 16px;
}

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

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    transition: background .12s;
    cursor: pointer;
}

.user-row:hover { background: var(--bg-hover); }

.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info .u-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.user-info .u-role { font-size: 11px; color: var(--text-3); }

.logout-btn {
    margin-left: auto;
    color: var(--text-3);
    text-decoration: none;
    display: flex; align-items: center;
    transition: color .12s;
}

.logout-btn:hover { color: var(--text-1); }

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

.top-header {
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    background: rgba(9,9,11,.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 1px;
}

.page-content { padding: 28px; }

/* ── Stat cards ──────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: border-color .15s;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-icon-wrap {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-2);
    background: var(--bg-hover);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -.5px;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 5px;
    font-weight: 500;
}

.stat-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    margin-top: 10px;
    color: var(--text-3);
}

.stat-delta.accent { color: var(--accent); }
.stat-delta.warn { color: #ef4444; }

/* ── Section header ──────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}

/* ── Table card ──────────────────────────────────── */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-wrap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.table-wrap-header h6 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
}

table { width: 100%; border-collapse: collapse; }

thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-3);
    padding: 10px 20px;
    text-align: left;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-1);
    font-size: 13.5px;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--bg-hover); }

.td-muted { color: var(--text-2); font-size: 12.5px; }

/* ── Status badges ───────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid transparent;
}

.status-badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.status-badge.pending    { color: #f59e0b; background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.2); }
.status-badge.processing { color: #3b82f6; background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.2); }
.status-badge.shipped    { color: #8b5cf6; background: rgba(139,92,246,.1); border-color: rgba(139,92,246,.2); }
.status-badge.delivered  { color: #22c55e; background: rgba(34,197,94,.1);  border-color: rgba(34,197,94,.2); }
.status-badge.cancelled  { color: #ef4444; background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.2); }
.status-badge.refunded   { color: #a1a1aa; background: rgba(161,161,170,.1);border-color: rgba(161,161,170,.2); }

/* ── Buttons ─────────────────────────────────────── */
.btn-primary-crm {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s, box-shadow .12s;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
}

.btn-primary-crm:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 14px var(--accent-glow);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .12s, color .12s, background .12s;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-1);
    background: var(--bg-hover);
}

/* ── Empty state ─────────────────────────────────── */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-3);
}

.empty-state i { font-size: 32px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 13px; margin: 0; }

/* ── Alert ───────────────────────────────────────── */
.alert-info-crm {
    background: rgba(249,115,22,.06);
    border: 1px solid rgba(249,115,22,.2);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-2);
    margin-top: 24px;
}

.alert-info-crm i { color: var(--accent); font-size: 16px; flex-shrink: 0; }
.alert-info-crm strong { color: var(--text-1); }

/* ────────────────────────────────────────────────── */
/* LOGIN PAGE                                         */
/* ────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* ambient glow blobs */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    opacity: .35;
}

.login-page::before {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(249,115,22,.5), transparent 70%);
    top: -150px; right: -100px;
}

.login-page::after {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(59,130,246,.4), transparent 70%);
    bottom: -150px; left: -100px;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.1), transparent);
    border-radius: 16px 16px 0 0;
}

.login-logo {
    width: 42px; height: 42px;
    background: var(--accent);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: #fff;
    margin: 0 auto 22px;
    box-shadow: 0 0 24px var(--accent-glow);
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
    text-align: center;
    letter-spacing: -.3px;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-3);
    text-align: center;
    margin-bottom: 28px;
}

/* Form fields */
.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.field-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13.5px;
    color: var(--text-1);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.field-input::placeholder { color: var(--text-3); }

.field-input:focus {
    border-color: rgba(249,115,22,.5);
    box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}

.field-wrap { position: relative; margin-bottom: 16px; }

.toggle-pwd {
    position: absolute;
    right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-3);
    cursor: pointer;
    display: flex; align-items: center;
    transition: color .12s;
    padding: 4px;
}

.toggle-pwd:hover { color: var(--text-2); }

.btn-submit {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .12s, box-shadow .12s;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    margin-top: 6px;
}

.btn-submit:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.login-error {
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12.5px;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 11.5px;
    color: var(--text-3);
}
