/* ─────────────────────────────────────────────────────────────
   NextWall Console — Shared Stylesheet
   Brand colors: dark navy #0f1e38, golden amber #f5a623
   ───────────────────────────────────────────────────────────── */

/* ── Tokens ───────────────────────────────────────────────── */
:root {
    --accent:       #f5a623;   /* golden amber — "WALL" in logo */
    --accent-d:     #d9880a;   /* darker amber for hover */
    --accent-soft:  rgba(245,166,35,.1);
    --accent-text:  #7a4700;   /* dark amber for text on light bg */
    --navy:         #0f1e38;   /* true dark navy */
    --navy-d:       #0a1628;   /* deeper navy */
    --sidebar-bg:   #0f1e38;
    --sidebar-w:    280px;
    --topbar-h:     56px;
    --bg:           #f8fafc;
    --border:       #e2e8f0;
    --card-r:       10px;
    --card-shadow:  0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.05);
    --red:          #dc2626;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: #1c1f24;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

/* ── Auth layout ──────────────────────────────────────────── */
body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(175deg, #0f1e38 0%, #0a1628 100%);
    display: flex; flex-direction: column;
    z-index: 200;
    border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand    { padding: 1.25rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo-wrap {
    background: #fff; border-radius: 10px; padding: 0.75rem 1rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.3); margin-bottom: 0.75rem;
}
.sidebar-logo-wrap img { width: 100%; max-width: 220px; height: auto; display: block; }
.sidebar-live {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(245,166,35,.14); border: 1px solid rgba(245,166,35,.3);
    color: #f5a623; font-size: 0.575rem; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    padding: 3px 8px; border-radius: 20px;
}
.sidebar-live-dot { width: 5px; height: 5px; background: #f5a623; border-radius: 50%; animation: pulse-dot 2s ease-in-out infinite; }
.sidebar-section  { font-size: 0.575rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.22); padding: 0.875rem 1rem 0.3rem; }
.sidebar-nav { padding: 0 0.5rem; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 0.55rem;
    color: rgba(255,255,255,.45); padding: 0.5rem 0.75rem;
    border-radius: 8px; font-size: 0.8rem; font-weight: 500;
    text-decoration: none; transition: all .13s; margin-bottom: 1px; position: relative;
}
.sidebar-nav a i { font-size: 1rem; width: 1.1rem; text-align: center; flex-shrink: 0; }
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.sidebar-nav a.active {
    background: rgba(245,166,35,.15); color: #f5a623; font-weight: 600;
    border: 1px solid rgba(245,166,35,.25);
}
.sidebar-nav a.active::before {
    content: ''; position: absolute; left: -0.5rem; top: 22%; bottom: 22%;
    width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
/* ── Layout ───────────────────────────────────────────────── */
.layout-main { margin-left: var(--sidebar-w); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem; flex-shrink: 0; gap: 1rem; z-index: 10;
}
.topbar-page  { font-size: 0.9375rem; font-weight: 700; color: #1c1f24; }
.topbar-crumb { font-size: 0.7rem; color: #94a3b8; margin-top: 1px; }
.topbar-crumb a { color: #94a3b8; text-decoration: none; }
.topbar-crumb a:hover { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 0.625rem; }
.user-pill {
    display: flex; align-items: center; gap: 0.45rem;
    background: #f1f5f9; border: 1px solid var(--border);
    border-radius: 40px; padding: 3px 10px 3px 3px; cursor: pointer; transition: all .12s;
}
.user-pill:hover { background: #e2e8f0; }
.user-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, #f5a623, #d9880a);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.625rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name { font-size: 0.775rem; font-weight: 600; color: #1e293b; }

/* ── Page content ─────────────────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; padding: 1.375rem; background: var(--bg); }
.page-content::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.page-content::-webkit-scrollbar-thumb:hover { background: #f5a623; }

/* ── Cards ────────────────────────────────────────────────── */
.kk-card { background: #fff; border-radius: var(--card-r); box-shadow: var(--card-shadow); border: 1px solid var(--border); overflow: hidden; }
.kk-card-header { padding: 0.75rem 1.125rem; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.kk-card-title  { font-size: 0.8125rem; font-weight: 700; color: #1c1f24; display: flex; align-items: center; gap: 0.4rem; }
.kk-card-title i { color: var(--accent); font-size: 0.9375rem; }
.kk-card-body   { padding: 1.125rem; }

/* ── Stat cards ───────────────────────────────────────────── */
.stat-card { background: #fff; border-radius: var(--card-r); box-shadow: var(--card-shadow); border: 1px solid var(--border); padding: 1rem 1.125rem; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0 2px 2px 0; }
.stat-card.accent-amber::after  { background: var(--accent); }
.stat-card.accent-purple::after { background: var(--accent); }
.stat-card.accent-green::after  { background: #059669; }
.stat-card.accent-blue::after   { background: #2563eb; }
.stat-card.accent-red::after    { background: var(--red); }
.stat-card.accent-orange::after { background: #ea580c; }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.625rem; }
.stat-label  { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #94a3b8; }
.stat-icon   { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #fef3c7; color: var(--accent); }
.stat-icon.green  { background: #d1fae5; color: #059669; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.red    { background: #fee2e2; color: var(--red); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: #1c1f24; line-height: 1; letter-spacing: -.03em; }
.stat-sub   { font-size: 0.68rem; color: #94a3b8; margin-top: 0.25rem; }

/* ── Tables ───────────────────────────────────────────────── */
.kk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kk-table { width: 100%; border-collapse: collapse; }
.kk-table thead th { background: #f8fafc; padding: 0.6rem 1rem; font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.kk-table thead th:first-child { padding-left: 1.25rem; }
.kk-table thead th:last-child  { padding-right: 1.25rem; }
.kk-table tbody tr  { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.kk-table tbody tr:last-child  { border-bottom: none; }
.kk-table tbody tr:hover       { background: #fffbf0; }
.kk-table tbody td { padding: 0.75rem 1rem; font-size: 0.8rem; color: #334155; vertical-align: middle; }
.kk-table tbody td:first-child { padding-left: 1.25rem; }
.kk-table tbody td:last-child  { padding-right: 1.25rem; }
.cell-main { font-size: 0.8rem; font-weight: 600; color: #1e293b; line-height: 1.25; }
.cell-sub  { font-size: 0.68rem; color: #94a3b8; margin-top: 2px; }

/* ── Badges ───────────────────────────────────────────────── */
.kk-badge           { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 20px; font-size: 0.675rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.kk-badge-success   { background: #edf8e4; color: #2d6010; border: 1px solid #bcd898; }
.kk-badge-danger    { background: #fdecea; color: #b01818; border: 1px solid #f0a8a8; }
.kk-badge-warning   { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.kk-badge-info      { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.kk-badge-secondary { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.kk-badge-amber     { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.kk-badge-purple    { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Form inputs ──────────────────────────────────────────── */
.kk-input {
    -webkit-appearance: none; appearance: none;
    width: 100%; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
    padding: 0.45rem 0.75rem; font-size: 0.8125rem; font-family: 'Inter', sans-serif;
    color: #1e293b; outline: none; transition: border-color .12s, box-shadow .12s;
}
.kk-input:focus       { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,.15); background: #fff; }
.kk-input::placeholder { color: #cbd5e1; }
.btn-primary {
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: background .12s, box-shadow .12s;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.45rem 1rem; font-size: 0.8125rem; font-weight: 600; color: #1a1a1a;
}
.btn-primary:hover    { background: var(--accent-d); box-shadow: 0 2px 12px rgba(245,166,35,.35); }
.btn-primary:disabled { background: #fcd34d; cursor: not-allowed; }

/* ── Misc ─────────────────────────────────────────────────── */
.empty-state   { text-align: center; padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.25rem; color: #cbd5e1; margin-bottom: 0.6rem; display: block; }
.empty-state p { color: #94a3b8; font-size: 0.825rem; margin: 0; line-height: 1.55; }

@keyframes spin-anim { to { transform: rotate(360deg); } }
@keyframes pulse-dot  { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.75)} }
.spin { display: inline-block; animation: spin-anim .8s linear infinite; }

/* ── Reusable loader ─────────────────────────────────────────── */
.kk-loader     { display: inline-block; width: 24px; height: 24px; border: 2.5px solid #e2e8f0; border-top-color: #f5a623; border-radius: 50%; animation: spin-anim .85s linear infinite; flex-shrink: 0; }
.kk-loader-sm  { width: 14px; height: 14px; border-width: 2px; }
.kk-loader-lg  { width: 36px; height: 36px; border-width: 3px; }
.kk-loader-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.625rem; padding: 2.5rem 1rem; }
.kk-loader-text { color: #94a3b8; font-size: 0.775rem; margin: 0; }

/* ── Login / Unauthorized pages ──────────────────────────── */
.login-wrap  { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-card  { background: #fff; border-radius: 20px; padding: 2.5rem; box-shadow: 0 4px 32px rgba(0,0,0,.10); border: 1px solid #e8e8e8; }
.brand-row   { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-bottom: 2rem; text-align: center; }
.brand-logo  { display: block; height: 36px; width: auto; }
.brand-text-sub { font-size: 0.75rem; color: #9ba3af; }
.section-label  { font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 0.5rem; text-align: center; }
.section-hint   { font-size: 0.8125rem; color: #9ba3af; line-height: 1.5; margin-bottom: 1.5rem; }
.ms-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    background: var(--accent); color: #1a1a1a; border: none; border-radius: 12px;
    padding: 0.8125rem 1.5rem; font-family: 'Inter', sans-serif; font-size: 0.9375rem;
    font-weight: 700; text-decoration: none; width: 100%; cursor: pointer;
    transition: background .12s, box-shadow .12s, transform .1s;
}
.ms-btn:hover  { background: var(--accent-d); color: #1a1a1a; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245,166,35,.4); }
.ms-btn:active { transform: translateY(0); }
.footer-note   { text-align: center; font-size: 0.7rem; color: #9ba3af; margin-top: 1.25rem; }
.error-wrap  { max-width: 460px; width: 100%; text-align: center; }
.error-card  { background: #fff; border-radius: 20px; padding: 2.5rem 2rem; box-shadow: 0 4px 24px rgba(0,0,0,.07); border: 1px solid #eceef3; margin-bottom: 1rem; }
.error-title { font-size: 1.25rem; font-weight: 800; color: #111827; margin-bottom: 0.75rem; }
.error-msg   { font-size: 0.875rem; color: #6b7280; line-height: 1.6; margin-bottom: 1.75rem; }
.icon-ring   { width: 80px; height: 80px; border-radius: 50%; background: #fef2f2; border: 2px solid #fecaca; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; }

/* ── Mobile sidebar overlay ───────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0); z-index: 199; transition: background .25s ease; }
.sidebar-overlay.show { display: block; background: rgba(0,0,0,.5); }
.hamburger-btn  { display: none; width: 36px; height: 36px; border-radius: 9px; background: #f1f5f9; border: 1px solid var(--border); align-items: center; justify-content: center; color: #64748b; font-size: 1.15rem; cursor: pointer; transition: all .13s; flex-shrink: 0; order: -1; }
.hamburger-btn:hover { background: var(--accent); color: #1a1a1a; border-color: var(--accent-d); }
.sidebar-close-btn  { display: none; position: absolute; top: 0.875rem; right: 0.875rem; width: 28px; height: 28px; border-radius: 7px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.6); font-size: 0.9rem; cursor: pointer; align-items: center; justify-content: center; transition: all .13s; }
.sidebar-close-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ── Tablet (768–1023 px) ─────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-w: 72px; }
    .sidebar-brand { padding: 0.875rem 0.5rem 0.625rem; text-align: center; }
    .sidebar-logo-wrap { padding: 0.35rem 0.5rem; margin-bottom: 0.5rem; }
    .sidebar-logo-wrap img { width: 100%; max-width: 52px; height: auto; }
    .sidebar-live, .sidebar-section { display: none; }
    .sidebar-nav { padding: 0 0.375rem; }
    .sidebar-nav a { flex-direction: column; justify-content: center; padding: 0.5rem 0.25rem; gap: 3px; font-size: 0; border-radius: 10px; }
    .sidebar-nav a i { font-size: 1.25rem; width: auto; }
    .sidebar-nav a::after { content: attr(data-label); font-size: 0.5rem; font-weight: 700; color: rgba(255,255,255,.35); letter-spacing: .04em; text-transform: uppercase; display: block; }
}

/* ── Mobile (< 768 px) ────────────────────────────────────── */
@media (max-width: 767px) {
    body { overflow: auto; height: auto; }
    .layout-main { margin-left: 0 !important; height: auto; min-height: 100vh; }
    .sidebar { width: min(280px, 85vw); transform: translateX(-110%); transition: transform .26s cubic-bezier(.4,0,.2,1); box-shadow: none; z-index: 300; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,.35); }
    .sidebar-close-btn { display: flex; }
    .hamburger-btn { display: flex; }
    .topbar { padding: 0 1rem; position: sticky; top: 0; z-index: 100; }
    .topbar-crumb { display: none; }
    .user-name { display: none; }
    .user-pill { padding: 3px 6px 3px 3px; }
    .page-content { padding: 0.875rem; overflow-y: visible; }
    .kk-card-header { flex-wrap: wrap; }
    .stat-value { font-size: 1.375rem; }
    .stat-card  { padding: 0.75rem 0.875rem; }
    .login-card { padding: 1.75rem 1.25rem; }
}
@media (max-width: 419px) {
    .kk-card-body { padding: 0.75rem; }
    .stat-value   { font-size: 1.2rem; }
}
