/* ============================================
   Big Heavy Industrias — Stats Dashboard
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:        #000000;
    --surface:   #111111;
    --surface2:  #1a1a1a;
    --surface3:  #222222;
    --border:    rgba(255, 255, 255, 0.08);
    --border-h:  rgba(255, 255, 255, 0.16);
    --text:      #ffffff;
    --text-sec:  rgba(255, 255, 255, 0.5);
    --text-muted:rgba(255, 255, 255, 0.28);
    --green:     #30d158;
    --orange:    #ff9f0a;
    --red:       #ff453a;
    --blue:      #0a84ff;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius:    16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow:    0 4px 24px rgba(0, 0, 0, 0.6);
    --transition: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* ==========================================
   SPINNER
   ========================================== */

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: none;
    flex-shrink: 0;
}

.spinner.active {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   LOGIN
   ========================================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 52px 44px;
    text-align: center;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    margin-bottom: 28px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.6px;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-sec);
    font-weight: 400;
    margin-bottom: 36px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-wrap input {
    width: 100%;
    padding: 14px 18px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: border-color var(--transition);
}

.input-wrap input:focus {
    border-color: var(--border-h);
}

.input-wrap input::placeholder {
    color: var(--text-muted);
}

.btn-login {
    position: relative;
    padding: 14px;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    gap: 8px;
}

.btn-login:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: none;
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: block;
}

.login-error {
    font-size: 13px;
    color: var(--red);
    margin-top: 4px;
}

/* ==========================================
   HEADER
   ========================================== */

.dash-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}

.dash-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dash-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.dash-brand-text {
    display: flex;
    flex-direction: column;
}

.dash-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.dash-subtitle {
    font-size: 11px;
    color: var(--text-sec);
    font-weight: 400;
    line-height: 1.2;
}

.dash-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-update {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-sec);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover {
    color: var(--text);
    border-color: var(--border-h);
}

.btn-icon.spinning svg {
    animation: spin 0.7s linear infinite;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-sec);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-logout:hover {
    color: var(--text);
    border-color: var(--border-h);
}

/* ==========================================
   MAIN LAYOUT
   ========================================== */

.dash-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 44px 28px 100px;
    display: flex;
    flex-direction: column;
    gap: 52px;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ==========================================
   CARDS GRID
   ========================================== */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition);
}

.card:hover {
    border-color: var(--border-h);
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 18px;
    word-break: break-all;
    line-height: 1.3;
}

.card-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.card-row .k {
    color: var(--text-sec);
}

.card-row .v {
    font-weight: 500;
    text-align: right;
}

/* ==========================================
   BADGES
   ========================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-green  { background: rgba(48, 209,  88, 0.15); color: var(--green);  }
.badge-orange { background: rgba(255,159,  10, 0.15); color: var(--orange); }
.badge-red    { background: rgba(255, 69,  58, 0.15); color: var(--red);    }
.badge-blue   { background: rgba( 10,132, 255, 0.15); color: var(--blue);   }
.badge-gray   { background: rgba(255,255, 255, 0.08); color: var(--text-sec); }

/* ==========================================
   TABLE
   ========================================== */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dash-table thead th {
    padding: 14px 20px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
}

.dash-table tbody td {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.dash-table tbody tr:last-child td {
    border-bottom: none;
}

.dash-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.sub-name {
    font-weight: 500;
    font-size: 14px;
}

.sub-id {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: monospace;
}

/* ==========================================
   EMPTY & ERROR STATES
   ========================================== */

.state-empty,
.state-error {
    padding: 40px 24px;
    text-align: center;
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
}

.state-error {
    color: var(--red);
    border-color: rgba(255, 69, 58, 0.2);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 640px) {
    .dash-header-inner {
        padding: 0 16px;
    }

    .last-update {
        display: none;
    }

    .dash-main {
        padding: 28px 16px 80px;
        gap: 40px;
    }

    .login-card {
        padding: 40px 28px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 18px;
    }
}
