/* 
  Figma-inspired Design System (New) + Stitch Mobile-First (The Obsidian Executive)
*/

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css");

/* Performance Optimization: Use targeted transitions */
@layer base {
    * {
        box-sizing: border-box;
        transition: background-color 0.2s ease, color 0.1s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    }
}

/* Initial Background Color to prevent flashing */
html,
body {
    background-color: #0B0E14;
    overflow-x: hidden;
    /* Default Dark Background */
}

/* Global Progress Bar (NProgress Style) */
#nprogress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-color);
    z-index: 10000;
    transition: width 0.2s ease, opacity 0.4s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

:root {
    /* 1. Global CSS Variables (User Requested) - Dark Mode (Default) - The Obsidian Executive */
    --bg-body: #0B0F19; /* Obsidian Void Background */
    --bg-card: #1c1f2a; /* surface-container */
    --text-main: #dfe2f1; /* on_surface */
    --border-color: rgba(63, 72, 82, 0.15); /* outline_variant at 15% (Ghost border) */

    /* The Obsidian Specific Tokens */
    --surface: #0f131d;
    --surface-container-low: #171b26;
    --surface-container: #1c1f2a;
    --surface-container-highest: #313540;
    --surface-bright: #353944;
    
    --primary-container: #00A3FF;
    --primary-color: #98cbff;
    --primary-hover: #38bdf8;
    --secondary-color: #41e4bf;
    --tertiary-color: #ffb868;
    --error-color: #ffb4ab;
    --error-container: #93000a;
    
    --text-muted: #bec7d4; /* on_surface_variant */

    /* 2. Legacy Mapping & Extended Palette */
    --bg-color: var(--bg-body);
    --card-bg: var(--bg-card);
    --card-border: var(--border-color);

    /* Effects - Anti-Gravity & Glassmorphism */
    --glass-bg: rgba(53, 57, 68, 0.6); /* surface-bright with opacity */
    --glass-border: 1px solid var(--border-color);
    --shadow-card: 0 10px 40px -10px rgba(0, 163, 255, 0.05); /* Ambient blue glow */
    --shadow-hover: 0 20px 40px rgba(0, 163, 255, 0.08); /* Elevated glow */

    /* Center Card Specific - Dark */
    --center-text-title: #ffffff;
    --center-text-label: var(--text-muted);
    --center-progress-track: var(--surface-container-highest);
    --center-card-bg: var(--surface-container);
    --center-card-border: transparent; /* No-Line Rule */
    --center-card-shadow: var(--shadow-card);
    --badge-bg: var(--surface-container-highest);
    --badge-text: #dfe2f1;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --padding-main: 40px;
    --gap-common: 24px;
    --radius-card: 16px;
    --radius-sm: 8px;
    --radius-full: 9999px;

    color-scheme: dark;
}

[data-theme="light"] {
    /* 1. Global CSS Variables (User Requested) - Light Mode */
    --bg-body: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-main: #1E293B;
    --border-color: #E2E8F0;

    /* 2. Legacy Mapping & Extended Palette */
    --bg-color: var(--bg-body);
    --card-bg: var(--bg-card);
    --card-border: var(--border-color);

    --primary-color: #0284C7;
    --primary-hover: #0369A1;
    --text-muted: #64748B;

    /* Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: 1px solid rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);

    /* Center Card Specific - Light */
    --center-text-title: #0F172A;
    --center-text-label: #64748B;
    --center-progress-track: #F1F5F9;
    --center-card-bg: #FFFFFF;
    --center-card-border: #E2E8F0;
    --center-card-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    --badge-bg: rgba(0, 0, 0, 0.05);
    --badge-text: #475569;

    color-scheme: light;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

body {
    /* 기존 한국어 폰트 최우선 적용, 영문은 Manrope를 활용할 경우 Manrope를 먼저 선언 */
    font-family: "Pretendard Variable", Pretendard, "Manrope", system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6, .display-font, .display-num {
    font-family: "Pretendard Variable", Pretendard, "Manrope", sans-serif;
}

/* Ensure form elements inherit the font */
input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    opacity: 0;
    animation: fadeIn 0.1s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}


/* --- Center Personnel Status Section --- */
.center-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.center-status-card {
    background: var(--center-card-bg);
    border: 1px solid transparent; /* Ghost border fallback will be box-shadow */
    box-shadow: inset 0 0 0 1px var(--border-color), var(--center-card-shadow);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.center-status-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 1px rgba(0, 163, 255, 0.2), var(--shadow-hover);
}

.center-status-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--center-text-title);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.center-status-counts {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 14px;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 11px;
    color: var(--center-text-label);
    margin-bottom: 4px;
}

.status-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    /* Ensure numbers are visible */
}

.status-progress-track {
    width: 100%;
    height: 6px;
    background: var(--center-progress-track);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    display: flex;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    opacity: 0;
    animation: fadeIn 0.1s ease forwards;
}

body.transition-enabled {
    transition: background-color 0.3s ease, color 0.3s ease;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    padding: 30px 16px;
    /* Slightly more vertical padding */
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 14px;
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.nav-item {
    width: 100%;
    padding: 0;
}

.nav-item a {
    width: 100%;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 50px;
    white-space: nowrap;
    position: relative;
    box-sizing: border-box;
    /* Explicitly set */
}

.nav-item a i {
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    font-size: 18px;
}

.nav-item a:hover {
    background-color: var(--primary-color);
    background-color: rgba(56, 189, 248, 0.08);
    /* Fallback */
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item a.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white !important;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    font-weight: 600;
}

.nav-item a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 4px;
    background: white;
    border-radius: 0 4px 4px 0;
    opacity: 0.9;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 50px 60px;
    /* Increased breathing room */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--gap-common);
    max-width: 1600px;
    /* Prevent over-stretching on huge screens */
}

/* Dashboard Top Section (2x2 Grid for height alignment) */
.dashboard-top-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--gap-common);
    align-items: stretch;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 48px;
    height: var(--header-height);
}

.header-title h1 {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.header-title p {
    color: var(--text-muted);
    font-size: clamp(12px, 3vw, 14px);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.btn-icon:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
}

/* Card Components (Glassmorphism) */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

/* Grid System */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-common);
    margin-bottom: var(--gap-common);
}

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

.list-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
}

.list-item-row:last-child {
    border-bottom: none;
}

/* Stats Card */
.stats-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-label {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    opacity: 0.7;
}

.stats-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
}

/* Stitch Style Dashboard Cards */
.stitch-card-blue {
    background: linear-gradient(135deg, #0284c7, #0369a1); /* Rich blue gradient */
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 10px 30px -10px rgba(2, 132, 199, 0.4);
}

.stitch-card-blue .metric-icon-bg {
    position: absolute;
    right: -10px;
    bottom: -20px;
    font-size: 110px;
    color: rgba(255, 255, 255, 0.1);
    transform: rotate(-10deg);
    pointer-events: none;
}

.stitch-card-blue .trend-icon-top {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    backdrop-filter: blur(4px);
}

.stitch-card-dark {
    background: var(--surface-container-high); /* dark gray */
    border: 1px solid rgba(255, 255, 255, 0.05); /* very subtle border */
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.stitch-card-dark .icon-header {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 16px;
}

.stitch-card-dark .stats-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stitch-card-dark .stats-label {
    font-size: 12px;
    color: var(--text-muted);
}

.icon-square.green {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.badge.green {
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}


/* Table */
.table-container {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    color: var(--text-main);
}

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

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-text {
    min-width: 48px;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 500;
}

.progress-track {
    flex: 1;
    height: 8px;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transform: scale(1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.input-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.input-field {
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.02);
    /* Soft background */
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    /* Soft bottom underline reserved */
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input-field:hover {
    background: rgba(0, 0, 0, 0.04);
}

.input-field:focus {
    outline: none;
    background: #ffffff;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 163, 255, 0.1);
}

[data-theme="dark"] .input-field {
    background: var(--surface); /* Deep void for input */
    border-bottom: 2px solid rgba(255, 255, 255, 0.05); /* Ghost underline */
}

[data-theme="dark"] .input-field:hover {
    background: #11151f; /* Slightly lighter surface */
}

[data-theme="dark"] .input-field:focus {
    background: var(--surface-container);
    border-bottom: 2px solid var(--primary-container);
    box-shadow: 0 8px 24px rgba(0, 163, 255, 0.15); /* Ambient glow */
}

/* Date/Month Picker Icon Styling for Dark Mode */
[data-theme="dark"] .input-field::-webkit-calendar-picker-indicator {
    filter: invert(72%) sepia(85%) saturate(1450%) hue-rotate(167deg) brightness(101%) contrast(101%);
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
}

[data-theme="dark"] .input-field::-webkit-calendar-picker-indicator:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Fix for Select Options in Dark Mode */
[data-theme="dark"] select option {
    background-color: #1e293b;
    color: white;
}

/* Tag System */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.tag-btn:hover {
    background: rgba(56, 189, 248, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.tag-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

/* Comment UI Textarea */
textarea.input-field {
    resize: none;
    overflow-y: hidden;
    line-height: 1.6;
    min-height: 100px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 800px;
    max-width: 90%;
    max-height: 85vh;
    padding: 30px;
    overflow-y: auto;
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Dashboard Gradients (The Obsidian Executive) --- */
.gradient-card-1 {
    /* Teal-to-Dark Teal (High visibility) */
    background: linear-gradient(135deg, #00c7a4 0%, #005141 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 10px 30px rgba(0, 199, 164, 0.2);
}

.gradient-card-2 {
    /* Blue-to-Deep Blue */
    background: linear-gradient(135deg, #00A3FF 0%, #00375a 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 10px 30px rgba(0, 163, 255, 0.2);
}

.gradient-card-3 {
    /* Orange-to-Brown */
    background: linear-gradient(135deg, #de8900 0%, #4d2d00 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 10px 30px rgba(222, 137, 0, 0.2);
}

.gradient-card-4 {
    /* Red-to-Deep Red */
    background: linear-gradient(135deg, #ffb4ab 0%, #93000a 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 10px 30px rgba(147, 0, 10, 0.3);
}

.stats-icon-bg {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    margin-bottom: 12px;
}

/* --- Status Badges --- */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-terminated {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Summary Stats Section --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: rgba(56, 189, 248, 0.3);
}

/* Summary Grid (List Page Top) */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--center-card-bg);
    border: 1px solid var(--center-card-border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--center-card-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px -10px rgba(0, 0, 0, 0.2);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--center-text-title);
    letter-spacing: -0.3px;
}

.total-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    background: var(--badge-bg);
    color: var(--badge-text);
    border-radius: 20px;
    letter-spacing: 0.2px;
}

.summary-body {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 2px 0;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.summary-val {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

.summary-label {
    font-size: 12px;
    color: var(--center-text-label);
    font-weight: 600;
}

.summary-divider {
    width: 1px;
    height: 24px;
    background: var(--center-card-border);
    opacity: 0.6;
}

/* System Total Card Gradient */
.summary-card-total {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%) !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px rgba(29, 78, 216, 0.4);
}

.summary-card-total .summary-title {
    color: #FFFFFF !important;
}

.summary-card-total .total-badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
}

.summary-card-total .summary-val {
    color: #FFFFFF !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.summary-card-total .summary-label {
    color: rgba(255, 255, 255, 0.9) !important;
}

.summary-card-total .summary-divider {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Center Comparison Bar */
.summary-progress {
    height: 5px;
    background: var(--center-progress-track);
    border-radius: 5px;
    overflow: hidden;
    margin-top: auto;
}


.indicator-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.indicator-dot.active {
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.indicator-dot.terminated {
    background-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.stats-subtext .divider {
    margin: 0 10px;
    color: rgba(255, 255, 255, 0.2);
}

/* --- Center Personnel Status Section --- */
.center-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.center-status-card {
    background: var(--center-card-bg);
    border: 1px solid var(--center-card-border);
    box-shadow: var(--center-card-shadow);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.2s, border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.center-status-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.4);
}

.center-status-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--center-text-title);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.center-status-counts {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 14px;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 11px;
    color: var(--center-text-label);
    margin-bottom: 4px;
}

.status-value {
    font-size: 18px;
    font-weight: 700;
}

.status-progress-track {
    width: 100%;
    height: 6px;
    background: var(--center-progress-track);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    display: flex;
}

.status-progress-bar {
    height: 100%;
}

.status-progress-active {
    background-color: #22c55e;
}

.status-progress-term {
    background-color: #ef4444;
}


/* --- Center Badges --- */
.center-badge {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

.center-badge-hq {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.center-badge-gangdong {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.center-badge-gasan {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.center-badge-bucheon {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.center-badge-default {
    background: rgba(255, 255, 255, 0.05);
    /* Gray/Default */
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .dashboard-top-section {
        grid-template-columns: 1fr !important;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Bottom Navigation Bar Base (Hidden on Desktop) */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --padding-main: 20px;
        --sidebar-width: 0px; 
        --bottom-nav-height: 70px;
    }

    .sidebar {
        display: none !important; /* Hide original sidebar entirely */
    }

    .main-content {
        margin-left: 0;
        padding-top: calc(var(--header-height) + 20px);
        padding-left: 20px;
        padding-right: 20px;
        /* Leave space for bottom nav AND floating action bar on mobile */
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 80px); 
    }

    .top-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        margin-bottom: 0;
        padding: 0 20px;
        background: rgba(11, 15, 25, 0.85); /* Obsidian void transparent */
        border-bottom: 1px solid transparent;
        z-index: 40;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    [data-theme="light"] .top-header {
        background: rgba(248, 250, 252, 0.85);
    }

    #mobile-toggle,
    #mobile-close {
        display: none !important;
    }
    
    .mobile-logo {
        display: flex !important;
    }

    /* Bottom Navigation Styles - Obsidian Glassmorphism */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottom-nav-height);
        background: rgba(23, 27, 38, 0.65); /* surface-container-low with opacity */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.05); /* very soft ghost border */
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
    }
    
    [data-theme="light"] .bottom-nav {
        background: rgba(255, 255, 255, 0.8);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
    }

    /* Floating Action Bar (Form Submissions on Mobile) */
    .floating-action-bar {
        position: fixed;
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        padding: 16px 20px;
        background: rgba(31, 35, 42, 0.8); /* surface-container with blur */
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 900;
        box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.4);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        color: var(--text-muted);
        text-decoration: none;
        flex: 1;
        height: 100%;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    .bottom-nav-item i {
        font-size: 20px;
        transition: transform 0.2s, color 0.2s;
    }

    .bottom-nav-item span {
        font-size: 11px;
        font-weight: 500;
    }

    .bottom-nav-item.active {
        color: var(--primary-container);
    }

    .bottom-nav-item.active i {
        filter: drop-shadow(0 0 10px rgba(0, 163, 255, 0.5)); /* Glow effect for active icon */
        transform: translateY(-2px);
    }

    /* Add a subtle indicator above active item 
    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        width: 32px;
        height: 3px;
        background: var(--primary-container);
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 8px rgba(0, 163, 255, 0.6);
    } */

    .header-actions {
        gap: 8px;
    }

    .dashboard-top-section {
        grid-template-columns: 1fr !important;
        grid-template-areas: none !important;
        gap: 16px !important;
    }

    .dashboard-top-section>div {
        grid-column: auto !important;
        grid-row: auto !important;
        grid-area: auto !important;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .stats-card-full {
        grid-column: span 2 !important;
    }
    
    .stats-card-half {
        grid-column: span 1 !important;
    }

    /* Mobile horizontal scroll container */
    .mobile-horizontal-scroll {
        display: flex;
        overflow-x: auto;
        gap: 16px;
        padding-bottom: 12px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
        width: 100vw;
    }
    .mobile-horizontal-scroll::-webkit-scrollbar {
        display: none;
    }

    .mobile-horizontal-scroll > div {
        flex: 0 0 calc(50% - 16px);
        min-width: 140px;
    }

    /* Apply horizontal scroll to center status grid on mobile */
    .center-status-grid {
        display: flex !important;
        overflow-x: auto !important;
        gap: 16px !important;
        padding-bottom: 12px;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
        width: 100vw;
    }
    
    .center-status-grid::-webkit-scrollbar {
        display: none;
    }

    .center-status-grid > div {
        flex: 0 0 calc(60% - 16px); /* slightly wider cards */
        min-width: 200px;
    }

    .form-grid,
    .performance-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .glass-card {
        padding: 16px;
        width: 100% !important;
    }

    .desktop-only {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important; /* Never display */
    }

    /* Table Mobile optimization: Card-like view */
    .table-container table,
    .table-container thead,
    .table-container tbody,
    .table-container th,
    .table-container td,
    .table-container tr {
        display: block;
    }

    .table-container thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-container tr {
        border: none;
        border-radius: 16px;
        margin-bottom: 16px;
        background: var(--center-card-bg); /* Use Obsidian surface-container */
        padding: 12px;
        box-shadow: var(--shadow-card);
    }

    .table-container td {
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.02); /* Extra subtle */
        position: relative;
        padding-left: 40% !important;
        text-align: right;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    [data-theme="light"] .table-container td {
        border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    }

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

    .table-container td::before {
        content: attr(data-label);
        position: absolute;
        left: 12px; /* Less padding */
        width: 35%;
        text-align: left;
        font-weight: 500;
        color: var(--text-muted);
        font-size: 13px;
    }

    /* Fix to prevent text overlap in cards */
    .table-container td>* {
        max-width: 60%;
    }
}

/* Skeleton UI Effect */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: rgba(128, 128, 128, 0.1);
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton::after {
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.03),
            transparent);
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.loading-state .stats-value,
.loading-state .stats-label,
.loading-state td,
.loading-state th {
    color: transparent !important;
    border-color: transparent !important;
}

.loading-state .stats-card,
.loading-state tr {
    pointer-events: none;
    /* @extend .skeleton; */
    /* This is a SASS/SCSS feature, not plain CSS. Will comment out or remove if not using preprocessor. */
    /* For plain CSS, you'd manually apply the skeleton properties */
    position: relative;
    overflow: hidden;
    background-color: rgba(128, 128, 128, 0.1);
}

.loading-state .stats-card::after,
.loading-state tr::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    animation: shimmer 1.5s infinite;
}

[data-theme="dark"] .loading-state .stats-card::after,
[data-theme="dark"] .loading-state tr::after {
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.03),
            transparent);
}

/* Adjust Chart Container Height */
#mainChart,
#centerComparisonChart {
    max-height: 250px;
}

/* ---------------------------------------------------
   Stitch List UI (Grid + Responsive Cards)
   --------------------------------------------------- */
.stitch-list-container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.stitch-list-header {
    display: grid;
    grid-template-columns: 80px 2fr 1fr 1fr 1fr 120px;
    padding: 16px;
    background: var(--surface-container-high);
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
    border-bottom: 2px solid var(--surface-container-highest);
}

.stitch-list-item {
    display: grid;
    grid-template-columns: 80px 2fr 1fr 1fr 1fr 120px;
    padding: 16px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background-color 0.2s;
}

.stitch-list-item:hover {
    background-color: var(--surface-container-low);
}

.item-avatar-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-avatar {
    display: none; /* hidden on desktop generally, but could show */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-container), var(--surface-container-high));
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.item-id-desktop {
    color: var(--text-muted);
    font-family: 'Manrope', sans-serif;
}

.item-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
}

.item-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 768px) {
    .stitch-list-header {
        display: none;
    }
    .stitch-list-container {
        gap: 12px;
        background: transparent;
    }
    .stitch-list-item {
        display: flex;
        flex-wrap: wrap;
        background: rgba(255, 255, 255, 0.03); /* Soft emissive card */
        border-radius: 12px;
        border: 1px solid var(--surface-container-highest);
        padding: 16px;
        gap: 12px;
        align-items: flex-start;
    }
    
    .item-avatar-group {
        width: auto;
        position: absolute;
    }
    
    .item-avatar {
        display: flex; /* Show avatar on mobile */
    }
    
    .item-id-desktop {
        display: none; /* Hide simple ID on mobile card */
    }
    
    .item-main-info {
        flex: 1;
        padding-left: 56px; /* space for absolute avatar */
        min-width: 100%;
        margin-bottom: 8px;
    }
    
    .item-contact {
        width: 100%;
        font-size: 13px;
        color: var(--text-main);
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .item-contact::before {
        content: "\f095"; /* fa-phone */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        color: var(--text-muted);
    }

    .item-date {
        width: 100%;
        font-size: 12px;
        color: var(--text-muted);
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .item-date::before {
        content: "\f073"; /* fa-calendar */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        color: var(--text-muted);
    }
    
    .item-actions {
        width: 100%;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,0.05);
        display: flex;
        justify-content: flex-end;
    }
}