/**
 * File: public/assets/css/style.css
 * System: FACT Ltd. Management System
 * Scope: Global Stylesheet & Design System Tokens (`DESIGN.md` & `AGENTS.md` Rule 2 & 4)
 *
 * Defines the complete visual styling for all pages, modals, tables, forms, and responsive layouts.
 * Implements the FACT Ltd. monochrome palette (`#111111` Primary Black, `#333333` Secondary Black,
 * `#777777` Muted Text, `#D9D9D9` Borders, `#F5F5F5` Light Background, `#FFFFFF` White), semantic
 * status colors (`#16A34A` Success, `#2563EB` Info, `#F59E0B` Warning, `#EF4444` Error), and dual
 * typography (`Libre Bodoni` display serif + `Inter` sans-serif with `tabular-nums`).
 */

:root {
    /* Core Monochrome Palette */
    --color-primary-black: #111111;
    --color-secondary-black: #333333;
    --color-charcoal: #111111;
    --color-muted-text: #777777;
    --color-border: #D9D9D9;
    --color-bg-light: #F5F5F5;
    --color-white: #FFFFFF;

    /* Semantic Status Colors */
    --color-success: #16A34A;
    --color-success-bg: #DCFCE7;
    --color-success-border: #86EFAC;

    --color-info: #2563EB;
    --color-info-bg: #DBEAFE;
    --color-info-border: #93C5FD;

    --color-warning: #F59E0B;
    --color-warning-text: #D97706;
    --color-warning-bg: #FEF3C7;
    --color-warning-border: #FCD34D;

    --color-error: #EF4444;
    --color-error-bg: #FEE2E2;
    --color-error-border: #FCA5A5;

    /* Typography */
    --font-heading: 'Libre Bodoni', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Geometry & Spacing Tokens */
    --radius-card: 12px;
    --radius-control: 8px;
    --radius-pill: 999px;
    --border-standard: 1px solid var(--color-border);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.14);
}

/* ==========================================================================
   1. RESET & BASE TYPOGRAPHY
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-light);
    color: var(--color-primary-black);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .serif-heading {
    font-family: var(--font-heading);
    color: var(--color-primary-black);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--color-primary-black);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-secondary-black);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.is-hidden {
    display: none !important;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. DEVELOPMENT GATE (`public/index.php`)
   ========================================================================== */

body.gate-body {
    background-color: var(--color-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.gate-wrapper {
    width: 100%;
    max-width: 540px;
}

.gate-card {
    width: 100%;
    border: 1px solid var(--color-primary-black);
    border-radius: var(--radius-card);
    padding: 48px 40px;
    background-color: var(--color-white);
    box-shadow: var(--shadow-card);
}

.gate-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
}

.gate-status-badge {
    display: inline-block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    padding: 5px 12px;
    border: 1px solid var(--color-primary-black);
    border-radius: var(--radius-pill);
    color: var(--color-primary-black);
}

.gate-brand-mark {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary-black);
    letter-spacing: 0.02em;
}

.gate-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background-color: #000000;
    padding: 3px;
    border: 1px solid var(--color-primary-black);
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    display: block;
}

.gate-title {
    font-family: var(--font-heading);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    cursor: pointer;
    user-select: none;
}

.gate-description {
    font-size: 15px;
    line-height: 1.65;
    color: var(--color-secondary-black);
    margin-bottom: 32px;
}

.error-actions {
    margin-bottom: 28px;
}

.gate-divider {
    height: 1px;
    background-color: var(--color-border);
    margin-bottom: 20px;
}

.gate-footer {
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--color-muted-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.click-counter {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--color-primary-black);
    color: var(--color-white);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9000;
}

.click-counter.show {
    opacity: 1;
    transform: translateY(0);
}

.pin-code-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 12px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border: var(--border-standard);
    border-radius: var(--radius-control);
    background-color: var(--color-white);
    color: var(--color-primary-black);
    transition: border-color 0.15s ease;
}

.pin-code-input:focus {
    outline: none;
    border-color: var(--color-primary-black);
}

/* ==========================================================================
   3. AUTHENTICATION & SPLIT-SCREEN LOGIN PAGE (`public/login.php`)
   ========================================================================== */

body.auth-body {
    background-color: var(--color-bg-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

body.auth-split-body {
    background-color: var(--color-white);
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-split-layout {
    display: grid;
    grid-template-columns: 1fr minmax(420px, 46%);
    min-height: 100vh;
    width: 100%;
}

/* Right Pane: Login Form */
.auth-form-pane {
    background-color: var(--color-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px 40px;
    border-left: var(--border-standard);
    position: relative;
    z-index: 2;
}

.auth-form-inner {
    width: 100%;
    max-width: 410px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-card);
    padding: 40px 36px;
    box-shadow: var(--shadow-card);
}

.auth-header {
    text-align: left;
    margin-bottom: 28px;
}

.auth-logo-wrap {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 22px;
}

.auth-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    background-color: #000000;
    padding: 4px;
    border: 1px solid var(--color-primary-black);
    border-radius: 0;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    display: block;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background-color: #000000;
    padding: 2px;
    border-radius: 0;
    display: block;
}

.auth-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-muted-text);
    margin-bottom: 8px;
}

.auth-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-primary-black);
    color: var(--color-white);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-bottom: 16px;
}

.auth-brand-icon {
    color: var(--color-white);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-primary-black);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 14px;
    line-height: 1.55;
    color: var(--color-muted-text);
}

.auth-form.is-locked {
    opacity: 0.6;
    pointer-events: none;
}

.auth-submit-btn {
    padding: 13px 20px;
    margin-top: 6px;
}

.auth-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: var(--border-standard);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--color-muted-text);
}

.status-dot-live {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--color-success);
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
    animation: factLivePulse 2.2s infinite;
}

@keyframes factLivePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(22, 163, 74, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

/* Right Pane: Animated Architectural Blueprint Showcase */
.auth-visual-pane {
    position: relative;
    background-color: var(--color-primary-black);
    color: var(--color-white);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 48px;
}

.auth-blueprint-grid {
    position: absolute;
    inset: -60px;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
    background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
    animation: blueprintGridPan 28s linear infinite;
    pointer-events: none;
}

@keyframes blueprintGridPan {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(96px, 96px, 0);
    }
}

.auth-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 140px;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.045) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: blueprintScan 9s ease-in-out infinite;
    pointer-events: none;
}

@keyframes blueprintScan {
    0% {
        top: -160px;
    }
    50% {
        top: 100%;
    }
    100% {
        top: -160px;
    }
}

.auth-visual-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    gap: 28px;
}

.auth-telemetry-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.telemetry-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
}

.telemetry-coords {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.65);
}

.auth-Stage-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 360px;
}

.auth-blueprint-svg {
    width: 100%;
    max-width: 620px;
    height: auto;
    overflow: visible;
}

.bp-axis-line {
    stroke: rgba(255, 255, 255, 0.45);
    stroke-width: 1.5;
}

.bp-axis-dashed {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1;
    stroke-dasharray: 4 6;
}

.bp-orbit-ring {
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 1;
    stroke-dasharray: 8 10;
    transform-origin: 310px 210px;
    animation: bpOrbitRotate 36s linear infinite;
}

.bp-orbit-ring-inner {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    stroke-dasharray: 3 8;
    transform-origin: 310px 210px;
    animation: bpOrbitRotateReverse 24s linear infinite;
}

@keyframes bpOrbitRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes bpOrbitRotateReverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

.bp-draw-path {
    stroke: var(--color-white);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    animation: bpStrokeDraw 7s ease-in-out infinite alternate;
}

.bp-tower-main {
    stroke-width: 2.4;
}

.bp-delay-1 {
    animation-delay: 0.4s;
}

.bp-delay-2 {
    animation-delay: 0.9s;
}

.bp-delay-3 {
    animation-delay: 1.4s;
}

@keyframes bpStrokeDraw {
    0% {
        stroke-dashoffset: 900;
        opacity: 0.35;
    }
    45%, 100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.bp-floor-line {
    stroke: rgba(255, 255, 255, 0.38);
    stroke-width: 1.2;
}

.bp-spine-line {
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 1.4;
    stroke-dasharray: 5 5;
}

.bp-crane-group {
    transform-origin: 300px 50px;
    animation: bpCraneSway 8s ease-in-out infinite alternate;
}

@keyframes bpCraneSway {
    0% {
        transform: translateX(-6px);
    }
    100% {
        transform: translateX(8px);
    }
}

.bp-crane-mast,
.bp-crane-boom {
    stroke: var(--color-white);
    stroke-width: 2;
}

.bp-crane-cable {
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1;
}

.bp-crane-hoist {
    stroke: rgba(255, 255, 255, 0.75);
    stroke-width: 1.2;
    stroke-dasharray: 3 3;
}

.bp-crane-load {
    fill: var(--color-primary-black);
    stroke: var(--color-white);
    stroke-width: 1.6;
    animation: bpLoadFloat 4s ease-in-out infinite alternate;
}

@keyframes bpLoadFloat {
    0% {
        transform: translateY(-8px);
    }
    100% {
        transform: translateY(10px);
    }
}

.bp-node {
    fill: var(--color-primary-black);
    stroke: var(--color-white);
    stroke-width: 2;
}

.bp-node-pulse {
    fill: var(--color-white);
    animation: bpNodeBlink 2.4s ease-in-out infinite;
}

@keyframes bpNodeBlink {
    0%, 100% {
        opacity: 1;
        r: 5;
    }
    50% {
        opacity: 0.35;
        r: 7;
    }
}

.bp-label {
    fill: rgba(255, 255, 255, 0.55);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.auth-visual-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-visual-quote {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 6px;
}

.auth-visual-caption {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.68);
    max-width: 580px;
    line-height: 1.55;
}

/* ==========================================================================
   4. FORMS, INPUTS & CONTROLS
   ========================================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary-black);
}

.form-label svg {
    color: var(--color-muted-text);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-primary-black);
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-control);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
    color: var(--color-muted-text);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary-black);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

.form-control:disabled {
    background-color: var(--color-bg-light);
    color: var(--color-muted-text);
    cursor: not-allowed;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-control {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--color-muted-text);
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.toggle-password:hover {
    color: var(--color-primary-black);
    background-color: var(--color-bg-light);
}

.otp-code-input {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 8px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary-black);
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-control);
    transition: border-color 0.15s ease;
}

.otp-code-input:focus {
    outline: none;
    border-color: var(--color-primary-black);
}

.otp-actions-row {
    margin-top: 14px;
    text-align: center;
}

/* ==========================================================================
   5. BUTTONS (`DESIGN.md` Section 4.1)
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background-color: var(--color-primary-black);
    color: var(--color-white);
    border-color: var(--color-primary-black);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-secondary-black);
    border-color: var(--color-secondary-black);
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-primary-black);
    border-color: var(--color-primary-black);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-bg-light);
}

.btn-approve {
    background-color: var(--color-white);
    color: var(--color-success);
    border-color: var(--color-success);
}

.btn-approve:hover:not(:disabled) {
    background-color: var(--color-success-bg);
}

.btn-danger {
    background-color: var(--color-white);
    color: var(--color-error);
    border-color: var(--color-error);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--color-error-bg);
}

.btn:disabled,
.btn-disabled {
    background-color: #EFEFEF;
    color: #999999;
    border-color: #E0E0E0;
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-secondary-black);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-link:hover {
    color: var(--color-primary-black);
}

.btn-arrow {
    font-size: 16px;
    line-height: 1;
}

/* ==========================================================================
   6. ALERTS, MODALS & TOAST NOTIFICATIONS (`DESIGN.md` Section 4.4)
   ========================================================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    border-radius: var(--radius-control);
    font-size: 13px;
    line-height: 1.45;
    border: 1px solid transparent;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-meta {
    margin-top: 4px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.alert-success {
    background-color: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}

.alert-error {
    background-color: var(--color-error-bg);
    color: var(--color-error);
    border-color: var(--color-error-border);
}

.alert-warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: var(--color-warning-border);
}

.alert-info {
    background-color: var(--color-info-bg);
    color: var(--color-info);
    border-color: var(--color-info-border);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 17, 17, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10000;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-elevated);
    width: 100%;
    max-width: 560px;
    overflow: hidden;
}

.modal-card-sm {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: var(--border-standard);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary-black);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--color-muted-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}

.modal-close-btn:hover {
    color: var(--color-primary-black);
    background-color: var(--color-bg-light);
}

.modal-body {
    padding: 24px;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--color-muted-text);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: var(--border-standard);
}

/* Loading & Spinners */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--color-secondary-black);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary-black);
    border-radius: 50%;
    display: inline-block;
    animation: factSpin 0.8s linear infinite;
}

.spinner-light {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
}

@keyframes factSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.notification-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background-color: var(--color-white);
    color: var(--color-primary-black);
    border: var(--border-standard);
    border-left: 4px solid var(--color-primary-black);
    border-radius: var(--radius-control);
    padding: 14px 16px;
    box-shadow: var(--shadow-elevated);
    font-size: 13px;
    line-height: 1.45;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.notification-toast.success {
    border-left-color: var(--color-success);
}

.notification-toast.error {
    border-left-color: var(--color-error);
}

.notification-toast.warning {
    border-left-color: var(--color-warning);
}

.notification-toast.info {
    border-left-color: var(--color-info);
}

.notification-toast.hide {
    opacity: 0;
    transform: translateX(16px);
}

.notification-close-btn {
    background: transparent;
    border: none;
    color: var(--color-muted-text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.notification-close-btn:hover {
    color: var(--color-primary-black);
}

/* ==========================================================================
   7. RESPONSIVE MEDIA QUERIES
   ========================================================================== */

@media (max-width: 1080px) {
    .auth-split-layout {
        grid-template-columns: 1fr;
    }

    .auth-form-pane {
        order: 1;
        border-left: none;
        border-bottom: var(--border-standard);
        padding: 44px 28px;
    }

    .auth-visual-pane {
        order: 2;
        padding: 36px 28px;
        min-height: 520px;
    }
}

@media (max-width: 640px) {
    .gate-card {
        padding: 32px 24px;
    }

    .gate-title {
        font-size: 28px;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .auth-title {
        font-size: 26px;
    }

    .auth-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================================================
   8. APP SHELL & CORE APPLICATION LAYOUT (`DESIGN.md` Section 5)
   ========================================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--color-bg-light);
    color: var(--color-primary-black);
}

/* Sidebar Navigation */
.sidebar {
    width: 250px;
    background-color: var(--color-primary-black);
    color: var(--color-white);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 24px 20px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-white);
}

.sidebar-brand-lockup:hover {
    color: var(--color-white);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--color-white);
    line-height: 1.2;
}

.sidebar-brand-tagline {
    font-size: 11px;
    color: #888888;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: #888888;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
}

.sidebar-close-btn:hover {
    color: var(--color-white);
}

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

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #666666;
    padding: 12px 10px 6px 10px;
    margin-top: 6px;
}

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav-item {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-control);
    color: #A0A0A0;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-white);
}

.sidebar-link.is-active {
    background-color: var(--color-secondary-black);
    color: var(--color-white);
    font-weight: 600;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background-color: var(--color-secondary-black);
    color: var(--color-white);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sidebar-link.is-active .sidebar-badge-count {
    background-color: var(--color-primary-black);
    color: var(--color-white);
}

.sidebar-badge-count.is-danger {
    background-color: var(--color-error);
    color: var(--color-white);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.2);
}

.sidebar-user-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    overflow: hidden;
    flex: 1;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    background-color: var(--color-secondary-black);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: #888888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-link {
    color: #888888;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-control);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sidebar-logout-link:hover {
    color: var(--color-error);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Main Application Shell */
.main-wrapper {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Topbar Header */
.topbar {
    height: 64px;
    background-color: var(--color-white);
    border-bottom: var(--border-standard);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    max-width: 520px;
}

.topbar-mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--color-primary-black);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-control);
}

.topbar-mobile-toggle:hover {
    background-color: var(--color-bg-light);
}

.topbar-search-form {
    position: relative;
    width: 100%;
}

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

.topbar-search-input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 38px;
    background-color: var(--color-bg-light);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    color: var(--color-primary-black);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.topbar-search-input:focus {
    outline: none;
    background-color: var(--color-white);
    border-color: var(--color-border);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-icon-action {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-black);
    background-color: transparent;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.topbar-icon-action:hover {
    background-color: var(--color-bg-light);
    border-color: var(--color-border);
    color: var(--color-primary-black);
}

.topbar-icon-svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.topbar-badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background-color: var(--color-error);
    border-radius: var(--radius-pill);
    border: 2px solid var(--color-white);
}

.topbar-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border: var(--border-standard);
    border-radius: var(--radius-pill);
    background-color: var(--color-white);
    color: var(--color-primary-black);
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.topbar-user-pill:hover {
    background-color: var(--color-bg-light);
    color: var(--color-primary-black);
}

.topbar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    background-color: var(--color-primary-black);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

.topbar-user-dept {
    font-size: 11px;
    color: var(--color-muted-text);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 32px 36px;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Header & Actions */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.page-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary-black);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 14px;
    color: var(--color-muted-text);
    margin: 0;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* KPI Cards Grid (`DESIGN.md` Section 3.1 & 4) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-card);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted-text);
}

.kpi-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-control);
    background-color: var(--color-bg-light);
    color: var(--color-primary-black);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-badge svg {
    width: 16px;
    height: 16px;
}

.kpi-number {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary-black);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

.kpi-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--color-muted-text);
}

.kpi-trend-up {
    color: var(--color-success);
    font-weight: 600;
}

.kpi-trend-down {
    color: var(--color-error);
    font-weight: 600;
}

/* Surface Cards & Table Containers */
.card {
    background-color: var(--color-white);
    border: var(--border-standard);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: var(--border-standard);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-black);
    margin: 0;
}

.card-subtitle {
    font-size: 13px;
    color: var(--color-muted-text);
    margin: 2px 0 0 0;
}

.card-body {
    padding: 24px;
}

/* Data Tables (`DESIGN.md` Section 2.2 & 4.2) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    color: var(--color-primary-black);
}

.data-table th {
    background-color: var(--color-bg-light);
    color: var(--color-muted-text);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 18px;
    text-align: left;
    border-bottom: var(--border-standard);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 18px;
    border-bottom: var(--border-standard);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

.data-table tr:hover td {
    background-color: #FAFAFA;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Status Badges (`DESIGN.md` Section 4.2) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-pill);
    background-color: currentColor;
}

.badge-planning {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    color: var(--color-muted-text);
}

.badge-ongoing {
    background-color: var(--color-primary-black);
    color: var(--color-white);
}

.badge-completed {
    background-color: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success);
}

.badge-info {
    background-color: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    color: var(--color-info);
}

.badge-warning {
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    color: var(--color-warning-text);
}

.badge-error {
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    color: var(--color-error);
}

/* App Footer */
.app-footer {
    padding: 18px 36px;
    background-color: var(--color-white);
    border-top: var(--border-standard);
    font-size: 12.5px;
    color: var(--color-muted-text);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-tagline {
    font-size: 12px;
    color: #999999;
}

/* Mobile Drawer Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive Breakpoints for App Layout */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar-mobile-toggle {
        display: inline-flex;
    }

    .main-content {
        padding: 24px 20px;
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 16px;
    }

    .topbar-search-form {
        display: none;
    }

    .main-content {
        padding: 20px 14px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .footer-container {
        flex-direction: column;
        align-items: flex-start;
    }
}
