/* -------------------------------------------------------------
 * Stylesheet: Internal Audit Tracking System
 * Features: Light & Dark Modes, Glassmorphism, Responsive Grid, Kanban Board
 * ------------------------------------------------------------- */

/* Theme Variables */
:root {
    /* Fonts */
    --font-primary: 'Sarabun', 'Inter', -apple-system, sans-serif;
    
    /* Common Colors */
    --color-white: #ffffff;
    --color-black: #000000;
    
    /* Status Colors */
    --status-not-started: #f43f5e; /* Rose / Red */
    --status-field-work: #a855f7;  /* Purple */
    --status-reporting: #3b82f6;   /* Blue */
    --status-follow-up: #f97316;   /* Orange */
    --status-completed: #10b981;   /* Emerald / Green */
    --status-sky: #0ea5e9;         /* Sky / Info */

    /* Transition */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables (Default) */
body.theme-dark {
    --bg-app: #0f172a;           /* slate-900 */
    --bg-sidebar: #0b0f19;       /* deep dark slate */
    --bg-card: #1e293b;          /* slate-800 */
    --bg-card-hover: #273549;
    --bg-input: #0f172a;
    --border-color: #334155;     /* slate-700 */
    --text-main: #f1f5f9;        /* slate-100 */
    --text-muted: #94a3b8;       /* slate-400 */
    --text-title: #ffffff;
    --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --hover-overlay: rgba(255, 255, 255, 0.03);
}

/* Light Mode Variables */
body.theme-light {
    --bg-app: #f8fafc;           /* slate-50 */
    --bg-sidebar: #0f172a;       /* slate-900 (Keep sidebar dark for premium contrast) */
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;    /* slate-100 */
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;     /* slate-200 */
    --text-main: #334155;        /* slate-700 */
    --text-muted: #64748b;       /* slate-500 */
    --text-title: #0f172a;       /* slate-900 */
    --shadow-main: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(15, 23, 42, 0.05);
    --hover-overlay: rgba(0, 0, 0, 0.02);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-primary);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 24px 16px;
    color: #f1f5f9; /* Always light color for sidebar */
    transition: var(--transition-smooth);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon {
    font-size: 28px;
    color: var(--status-sky);
    background: rgba(14, 165, 233, 0.15);
    padding: 8px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-text h2 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.logo-text span {
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    color: #94a3b8;
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: var(--transition-smooth);
    width: 100%;
}

.menu-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.menu-item.active {
    background: linear-gradient(135deg, var(--status-sky), #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 15px -3px rgba(14, 165, 233, 0.4);
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.backup-status-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #94a3b8;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--status-completed);
    box-shadow: 0 0 8px var(--status-completed);
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    padding: 32px;
    width: calc(100% - 280px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-title);
    margin-bottom: 4px;
}

.header-title p {
    font-size: 13px;
}

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

/* General Buttons */
.btn {
    border: none;
    outline: none;
    cursor: pointer;
    font-family: var(--font-primary);
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--status-sky), #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}
.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: var(--bg-card-hover);
}

.btn-success {
    background-color: var(--status-completed);
    color: #ffffff;
}
.btn-success:hover {
    background-color: #0d9488;
}

.btn-danger {
    background-color: var(--status-not-started);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #e11d48;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-card-hover);
    transform: rotate(15deg);
}

body.theme-dark .icon-sun,
body.theme-light .icon-moon {
    display: block;
}

body.theme-dark .icon-moon,
body.theme-light .icon-sun {
    display: none;
}

/* Page Views */
.page-view {
    display: none;
    flex-direction: column;
    gap: 28px;
    animation: fadeIn 0.4s ease;
}

.page-view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.kpi-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-main);
}

.kpi-icon {
    font-size: 24px;
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-info h3 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-title);
    line-height: 1.1;
    margin-bottom: 2px;
}

.kpi-info span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Color Accent Coding */
.text-sky::after { background-color: var(--status-sky); }
.text-sky .kpi-icon { background: rgba(14, 165, 233, 0.1); color: var(--status-sky); }

.text-red::after { background-color: var(--status-not-started); }
.text-red .kpi-icon { background: rgba(244, 63, 94, 0.1); color: var(--status-not-started); }

.text-blue::after { background-color: var(--status-reporting); }
.text-blue .kpi-icon { background: rgba(59, 130, 246, 0.1); color: var(--status-reporting); }

.text-orange::after { background-color: var(--status-follow-up); }
.text-orange .kpi-icon { background: rgba(249, 115, 22, 0.1); color: var(--status-follow-up); }

.text-green::after { background-color: var(--status-completed); }
.text-green .kpi-icon { background: rgba(16, 185, 129, 0.1); color: var(--status-completed); }

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
}

/* Cards Styles */
.content-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.content-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-card h3 i {
    font-size: 18px;
    color: var(--status-sky);
}

/* Progress Analysis Widget */
.progress-analysis-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.issues-summary-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background-color: var(--hover-overlay);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: var(--transition-smooth);
}

.stat-box:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.stat-box .label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-box .val {
    font-size: 24px;
    font-weight: 700;
}

.progress-bar-wrapper {
    margin-top: 10px;
}

.progress-bar-track {
    height: 12px;
    background-color: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-green { background: linear-gradient(90deg, #10b981, #059669); }
.bg-sky { background: linear-gradient(90deg, #0ea5e9, #2563eb); }

.progress-percentage-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.progress-percentage-label strong {
    font-size: 14px;
    color: var(--status-completed);
}

/* Chart Container */
.donut-chart-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 20px;
}

.chart-container {
    position: relative;
    width: 180px;
    height: 180px;
}

.donut-svg {
    transform: rotate(-90deg);
}

.donut-segment {
    transition: stroke-dasharray 0.8s ease, stroke-dashoffset 0.8s ease;
}

.chart-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.chart-center-text #chart-center-val {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-title);
    line-height: 1;
}

.chart-center-text span {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.legend-item:hover {
    background-color: var(--hover-overlay);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-val {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-title);
}

/* Table Section Styling */
.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.table-card-header h3 {
    margin-bottom: 0;
}

.table-filters {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    width: 220px;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.search-input-wrapper input:focus {
    border-color: var(--status-sky);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.filter-select {
    padding: 9px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-select:focus {
    border-color: var(--status-sky);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background-color: var(--hover-overlay);
    color: var(--text-muted);
    font-weight: 500;
    padding: 14px 16px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tbody tr {
    transition: var(--transition-smooth);
}

.data-table tbody tr:hover {
    background-color: var(--hover-overlay);
}

.actions-col {
    text-align: center;
    width: 100px;
}

/* Badge Styles */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-not_started { background-color: rgba(244, 63, 94, 0.12); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-field_work { background-color: rgba(168, 85, 247, 0.12); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-reporting { background-color: rgba(59, 130, 246, 0.12); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-follow_up { background-color: rgba(249, 115, 22, 0.12); color: #f97316; border: 1px solid rgba(249, 115, 22, 0.2); }
.badge-completed { background-color: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }

/* Progress bar inside table cell */
.cell-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 120px;
}

.cell-progress-track {
    flex-grow: 1;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.cell-progress-fill {
    height: 100%;
    background-color: var(--status-completed);
}

.cell-progress-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

/* Edit action btn */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    color: var(--status-sky);
    background-color: rgba(14, 165, 233, 0.1);
}

.btn-icon-danger:hover {
    color: var(--status-not-started);
    background-color: rgba(244, 63, 94, 0.1);
}

/* -------------------------------------------------------------
 * Page: My Tasks View (Auditor view)
 * ------------------------------------------------------------- */
.auditor-selector-section {
    display: flex;
    justify-content: center;
    padding: 24px;
}

.card-like {
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

.selector-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.selector-content label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-title);
    white-space: nowrap;
}

.select-auditor-xl {
    width: 250px;
    padding: 10px 14px;
    font-size: 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
    font-family: var(--font-primary);
    cursor: pointer;
}

.select-auditor-xl:focus {
    border-color: var(--status-sky);
}

.auditor-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    width: 100%;
}

.no-tasks-fallback {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    text-align: center;
    color: var(--text-muted);
}

.no-tasks-fallback i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Auditor Task Card */
.task-editor-card {
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.task-editor-card:hover {
    box-shadow: var(--shadow-main);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.task-card-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-title);
    line-height: 1.3;
}

.task-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-data-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 6px;
}

.task-data-row span:first-child {
    color: var(--text-muted);
}

.task-data-row span:last-child {
    color: var(--text-main);
    font-weight: 500;
}

/* Mini Quick Editor for Auditor Tasks */
.task-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

/* -------------------------------------------------------------
 * Page: Kanban Board View
 * ------------------------------------------------------------- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    align-items: flex-start;
    width: 100%;
}

.kanban-column {
    background-color: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.kanban-column-header {
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    border-radius: 15px 15px 0 0;
}

.kanban-column-header .title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-column-header .counter {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.bg-rose { background: linear-gradient(135deg, #f43f5e, #be123c); }
.bg-purple { background: linear-gradient(135deg, #a855f7, #6b21a8); }
.bg-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.bg-orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.bg-emerald { background: linear-gradient(135deg, #10b981, #047857); }

.kanban-cards-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    min-height: 150px;
    flex-grow: 1;
}

/* Kanban Cards styling */
.kanban-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow-card);
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.2);
    border-color: var(--text-muted);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--status-sky);
}

.kanban-card h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 8px;
    line-height: 1.3;
}

.kanban-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

.kanban-card-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.kanban-card-meta i {
    width: 12px;
    text-align: center;
}

/* Card drag drop visual indicator */
.drag-over {
    background-color: rgba(14, 165, 233, 0.05);
    border: 1px dashed var(--status-sky);
}

.kanban-card-progress {
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.kanban-card-prog-bar {
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.kanban-card-prog-fill {
    height: 100%;
    background-color: var(--status-completed);
}

.kanban-card-prog-lbl {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
}

/* -------------------------------------------------------------
 * Page: Manage & Backup Panel
 * ------------------------------------------------------------- */
.management-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.manage-form {
    background-color: var(--hover-overlay);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}

.manage-form h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.col-md-6 { width: 50%; }
.col-md-3 { width: 25%; }

.form-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input, 
.form-group select, 
.modal-form select {
    padding: 9px 12px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus, 
.form-group select:focus,
.modal-form select:focus {
    border-color: var(--status-sky);
}

/* Manage Table */
.manage-units-list-wrapper h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 10px;
}

.manage-units-table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.manage-table {
    font-size: 12px;
}

.manage-table th {
    padding: 10px 14px;
}

.manage-table td {
    padding: 10px 14px;
}

/* Backup widget layout */
.backup-actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.backup-section-box {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.backup-icon-wrapper {
    font-size: 28px;
    padding: 10px;
    border-radius: 12px;
    background-color: var(--hover-overlay);
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.backup-section-box h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-title);
    margin-bottom: 4px;
}

.backup-section-box p {
    font-size: 11px;
    line-height: 1.4;
}

.border-sep {
    border: 0;
    border-top: 1px solid var(--border-color);
}

.file-input-hidden {
    display: none;
}

.text-danger-box {
    background-color: rgba(244, 63, 94, 0.03);
    border: 1px dashed rgba(244, 63, 94, 0.2);
    border-radius: 12px;
    padding: 12px;
}

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

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

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-title);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--status-not-started);
}

.modal-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-form .form-group input,
.modal-form .form-group select {
    width: 100%;
}

.card-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-title);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-sub-section {
    background-color: var(--hover-overlay);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.modal-form-calculated-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background-color: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-muted);
}

.modal-form-calculated-info strong {
    font-size: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 10px;
}

/* Utilities */
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--status-not-started); }
.text-green { color: var(--status-completed); }
.text-sky { color: var(--status-sky); }
.text-orange { color: var(--status-follow-up); }
.bg-rose-text { color: var(--status-not-started); }

/* Responsive adjustments */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .kanban-board {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .management-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 24px 8px;
    }
    .logo-text, .menu-item span, .backup-status-widget {
        display: none;
    }
    .logo-icon {
        margin: 0 auto;
    }
    .menu-item i {
        font-size: 20px;
        margin: 0 auto;
    }
    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
        padding: 20px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    .col-md-6, .col-md-3 {
        width: 100%;
    }
}
