/* ==============================================
   CDA Digital Building Approval System
   Shared Dashboard Stylesheet
   Version: 2.0
   ============================================== */

/* --- 1. CSS Variables --- */
:root {
    --primary:        #2563EB;
    --primary-light:  #EFF6FF;
    --primary-hover:  #1D4ED8;
    --primary-dark:   #1E40AF;

    --bg-main:    #F1F5F9;
    --bg-card:    #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-hover:   #F8FAFC;

    --text-main:  #0F172A;
    --text-sub:   #334155;
    --text-muted: #64748B;
    --text-light: #94A3B8;

    --border:     #E2E8F0;
    --border-dark:#CBD5E1;

    --sidebar-width:    260px;
    --sidebar-collapsed:70px;
    --header-height:    64px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 30px rgba(0,0,0,.08);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Status palette */
    --c-blue:   #3B82F6;
    --c-green:  #22C55E;
    --c-yellow: #EAB308;
    --c-red:    #EF4444;
    --c-orange: #F97316;
    --c-purple: #8B5CF6;
    --c-teal:   #14B8A6;
    --c-gray:   #94A3B8;

    --c-blue-bg:   #EFF6FF;
    --c-green-bg:  #F0FDF4;
    --c-yellow-bg: #FEFCE8;
    --c-red-bg:    #FEF2F2;
    --c-orange-bg: #FFF7ED;
    --c-purple-bg: #F5F3FF;
    --c-teal-bg:   #F0FDFA;
    --c-gray-bg:   #F8FAFC;

    --transition: all 0.2s ease;
}

/* --- 2. Reset & Base --- */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}
html { font-size: 14px; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* --- 3. Color Utilities --- */
.text-blue   { color: var(--c-blue); }
.text-green  { color: var(--c-green); }
.text-yellow { color: var(--c-yellow); }
.text-red    { color: var(--c-red); }
.text-orange { color: var(--c-orange); }
.text-purple { color: var(--c-purple); }
.text-teal   { color: var(--c-teal); }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--c-red) !important; }

.bg-blue   { background: var(--c-blue); }
.bg-green  { background: var(--c-green); }
.bg-yellow { background: var(--c-yellow); }
.bg-red    { background: var(--c-red); }
.bg-orange { background: var(--c-orange); }
.bg-purple { background: var(--c-purple); }
.bg-teal   { background: var(--c-teal); }


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

/* ===============================================
   SIDEBAR
   =============================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }

/* Sidebar Header / Logo */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.logo-text span {
    font-size: 10px;
    color: var(--text-muted);
}

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Search */
.sidebar-search {
    padding: 12px 14px;
    position: relative;
    flex-shrink: 0;
}
.sidebar-search i {
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.sidebar-search input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: var(--bg-main);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}
.sidebar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}

/* Nav */
.sidebar-nav { flex: 1; padding: 4px 0 20px; }
.nav-list { }

/* Divider */
.nav-divider {
    padding: 16px 18px 6px;
}
.nav-divider span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--text-light);
    text-transform: uppercase;
}

/* Nav Item */
.nav-item { margin: 1px 8px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link i:first-child {
    width: 18px;
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition);
}

.nav-link .nav-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
    color: var(--text-light);
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-link:hover i:first-child { color: var(--primary); }

/* Active */
.nav-item.active > .nav-link {
    background: var(--primary);
    color: white;
}
.nav-item.active > .nav-link i { color: white !important; }

/* Submenu */
.nav-item.has-submenu.open > .nav-link .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    padding: 4px 0;
}
.nav-item.has-submenu.open .nav-submenu {
    display: block;
}

.nav-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px 7px 34px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 400;
    transition: var(--transition);
}
.nav-sublink i {
    font-size: 6px;
    color: var(--text-light);
    flex-shrink: 0;
}
.nav-sublink:hover {
    color: var(--primary);
    background: var(--primary-light);
}
.nav-sublink.active {
    color: var(--primary);
    font-weight: 600;
}
.nav-sublink.active i { color: var(--primary); }


/* ===============================================
   MAIN CONTENT
   =============================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease, max-width 0.3s ease;
}

/* ===============================================
   TOP HEADER
   =============================================== */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.menu-toggle {
    background: none;
    border: none;
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    transition: var(--transition);
}
.menu-toggle:hover {
    background: var(--bg-main);
    color: var(--primary);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.breadcrumb a {
    color: var(--text-muted);
    transition: var(--transition);
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb i {
    font-size: 9px;
    color: var(--text-light);
}
.breadcrumb span {
    color: var(--text-main);
    font-weight: 500;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-muted);
    position: relative;
    transition: var(--transition);
}
.icon-btn:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    width: 16px; height: 16px;
    background: var(--c-red);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.profile-dropdown:hover { background: var(--bg-main); }

.avatar, .avatar-sm {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}
.avatar { width: 40px; height: 40px; font-size: 13px; }
.avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.avatar.bg-teal   { background: var(--c-teal); }
.avatar.bg-purple { background: var(--c-purple); }
.avatar.bg-green  { background: var(--c-green); }
.avatar-sm.bg-teal   { background: var(--c-teal); }
.avatar-sm.bg-purple { background: var(--c-purple); }

.user-name-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.user-role  { font-size: 11px; color: var(--text-muted); }

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 220px;
    display: none;
    z-index: 500;
    overflow: hidden;
}
.dropdown-menu.show { display: block; }

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-main);
}
.dropdown-header h4 { font-size: 13px; font-weight: 600; }
.dropdown-header p  { font-size: 11px; color: var(--text-muted); }

.dropdown-divider { height: 1px; background: var(--border); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-sub);
    transition: var(--transition);
}
.dropdown-item i { width: 14px; color: var(--text-muted); }
.dropdown-item:hover { background: var(--bg-main); color: var(--primary); }
.dropdown-item.text-danger { color: var(--c-red); }
.dropdown-item.text-danger:hover { background: var(--c-red-bg); }


/* ===============================================
   CONTENT WRAPPER & PAGE HEADER
   =============================================== */
.content-wrapper {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-left h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}
.page-header-left p {
    font-size: 13px;
    color: var(--text-muted);
}
.page-header-right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


/* ===============================================
   STAT CARDS (Dashboard)
   =============================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: default;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--card-accent, var(--primary));
    border-radius: 0 2px 2px 0;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
    background: var(--card-icon-bg, var(--c-blue-bg));
    color: var(--card-accent, var(--c-blue));
}
.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--card-accent, var(--c-blue));
    margin-bottom: 4px;
    line-height: 1;
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Color variants for stat cards */
.stat-card.blue   { --card-accent: var(--c-blue);   --card-icon-bg: var(--c-blue-bg); }
.stat-card.green  { --card-accent: var(--c-green);  --card-icon-bg: var(--c-green-bg); }
.stat-card.yellow { --card-accent: var(--c-yellow); --card-icon-bg: var(--c-yellow-bg); }
.stat-card.red    { --card-accent: var(--c-red);    --card-icon-bg: var(--c-red-bg); }
.stat-card.purple { --card-accent: var(--c-purple); --card-icon-bg: var(--c-purple-bg); }
.stat-card.teal   { --card-accent: var(--c-teal);   --card-icon-bg: var(--c-teal-bg); }
.stat-card.orange { --card-accent: var(--c-orange); --card-icon-bg: var(--c-orange-bg); }


/* ===============================================
   CHARTS / CARD CONTAINERS
   =============================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card, .table-card, .form-card, .info-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}
.card-header .card-actions {
    display: flex;
    gap: 8px;
}

.card-body { padding: 20px; }

/* Progress Bars */
.progress-item { margin-bottom: 16px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-sub);
    margin-bottom: 6px;
}
.progress-bar-bg {
    height: 6px;
    background: var(--bg-main);
    border-radius: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Bar Chart */
.bar-chart-placeholder {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px 0 0;
    gap: 8px;
}
.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.bar-col .val {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.bar-col .bar {
    width: 80%;
    background: var(--c-blue-bg);
    border-radius: 4px 4px 0 0;
    border: 1px solid var(--c-blue);
    border-bottom: none;
    transition: height 0.5s ease, background 0.2s;
    min-height: 4px;
}
.bar-col:hover .bar { background: var(--primary); border-color: var(--primary); }
.bar-col .day {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    border-top: 1px solid var(--border);
    width: 100%;
    text-align: center;
    padding-top: 6px;
}


/* ===============================================
   BUTTONS
   =============================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}
.btn i { font-size: 13px; }

.btn-primary   { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3); }

.btn-success   { background: var(--c-green); color: white; border-color: var(--c-green); }
.btn-success:hover { opacity: 0.9; }

.btn-danger    { background: var(--c-red); color: white; border-color: var(--c-red); }
.btn-danger:hover { opacity: 0.9; }

.btn-warning   { background: var(--c-yellow); color: #1a1a1a; border-color: var(--c-yellow); }
.btn-warning:hover { opacity: 0.9; }

.btn-outline   {
    background: transparent;
    color: var(--text-sub);
    border-color: var(--border-dark);
}
.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }


/* ===============================================
   BADGES
   =============================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-green  { background: var(--c-green-bg);  color: #15803D; }
.badge-yellow { background: var(--c-yellow-bg); color: #A16207; }
.badge-red    { background: var(--c-red-bg);    color: #B91C1C; }
.badge-blue   { background: var(--c-blue-bg);   color: #1D4ED8; }
.badge-orange { background: var(--c-orange-bg); color: #C2410C; }
.badge-purple { background: var(--c-purple-bg); color: #6D28D9; }
.badge-teal   { background: var(--c-teal-bg);   color: #0F766E; }
.badge-gray   { background: var(--c-gray-bg);   color: #475569; }


/* ===============================================
   TABLE
   =============================================== */
/* Controls above table */
.table-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}
.table-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}
.table-search input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-main);
    outline: none;
    transition: var(--transition);
}
.table-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37,99,235,.08);
}

.table-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-group .form-control {
    width: auto;
}

.filter-select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: var(--bg-main);
    color: var(--text-sub);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

.table-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table thead th:first-child { padding-left: 20px; }
.data-table thead th:last-child  { padding-right: 20px; }

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table tbody td {
    padding: 13px 16px;
    font-size: 13px;
    color: var(--text-sub);
    vertical-align: middle;
    white-space: nowrap;
}
.data-table tbody td:first-child { padding-left: 20px; }
.data-table tbody td:last-child  { padding-right: 20px; }

.data-table .id-cell {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.data-table .name-cell {
    font-weight: 600;
    color: var(--text-main);
}

/* Table Footer / Pagination */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}
.table-info {
    font-size: 12px;
    color: var(--text-muted);
}
.pagination {
    display: flex;
    gap: 4px;
}
.page-btn {
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: none;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}


/* ===============================================
   ACTION BUTTONS (in table rows)
   =============================================== */
.action-btns {
    display: flex;
    gap: 4px;
    align-items: center;
}
.action-btn {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.action-view   { background: var(--c-blue-bg);   color: var(--c-blue); }
.action-edit   { background: var(--c-yellow-bg);  color: #92400E; }
.action-delete { background: var(--c-red-bg);     color: var(--c-red); }
.action-print  { background: var(--c-purple-bg);  color: var(--c-purple); }
.action-qr     { background: var(--c-teal-bg);    color: var(--c-teal); }
.action-assign { background: var(--c-green-bg);   color: var(--c-green); }

.action-view:hover   { background: var(--c-blue);   color: white; }
.action-edit:hover   { background: var(--c-yellow);  color: white; }
.action-delete:hover { background: var(--c-red);     color: white; }
.action-print:hover  { background: var(--c-purple);  color: white; }
.action-qr:hover     { background: var(--c-teal);    color: white; }
.action-assign:hover { background: var(--c-green);   color: white; }


/* ===============================================
   FORMS
   =============================================== */
.form-card {
    margin-bottom: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    transition: var(--transition);
    background: var(--bg-card);
}
.form-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
    border-radius: 12px 12px 0 0;
}
.form-card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.form-card-header h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 18px;
    background: var(--primary);
    border-radius: 4px;
}
.form-card-header h3 i {
    color: var(--primary);
    font-size: 16px;
}
.form-card-body { padding: 24px; }

/* Grid layouts */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
}
.required { color: var(--c-red); margin-left: 2px; }

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-main);
    background: var(--bg-card);
    outline: none;
    transition: var(--transition);
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-control:disabled {
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: not-allowed;
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding: 16px 0 0;
    align-items: center;
    flex-wrap: wrap;
}

/* Section divider within form */
.section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 16px;
    grid-column: 1 / -1;
}
.section-divider::before, .section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.section-divider span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}


/* ===============================================
   INFO / DETAIL CARDS
   =============================================== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.info-item { }
.info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 3px;
}
.info-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    padding: 0 20px;
    overflow-x: auto;
}
.tab-btn {
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-btn i { font-size: 13px; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content { display: none; padding: 20px; }
.tab-content.active { display: block; }

/* Step wizard */
.wizard-steps {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.wizard-step {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 100px;
}
.step-circle {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-dark);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition);
}
.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    transition: var(--transition);
}
.step-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    white-space: nowrap;
}
.wizard-step.active .step-circle   { border-color: var(--primary); background: var(--primary); color: white; }
.wizard-step.done .step-circle     { border-color: var(--c-green); background: var(--c-green); color: white; }
.wizard-step.done .step-line       { background: var(--c-green); }
.wizard-step.active .step-label    { color: var(--primary); font-weight: 600; }


/* ===============================================
   ALERT / NOTICE CARDS
   =============================================== */
.alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
}
.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--c-blue-bg);   color: #1D4ED8; border: 1px solid #BFDBFE; }
.alert-success { background: var(--c-green-bg);  color: #15803D; border: 1px solid #BBF7D0; }
.alert-warning { background: var(--c-yellow-bg); color: #92400E; border: 1px solid #FDE68A; }
.alert-danger  { background: var(--c-red-bg);    color: #B91C1C; border: 1px solid #FECACA; }


/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 1200px) {
    .charts-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 300;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content { 
        margin-left: 0; 
        width: 100%; 
        max-width: 100%; 
    }

    .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .breadcrumb { display: none; }
    .user-name-wrap { display: none; }
    .header-link { display: none; }

    .content-wrapper { padding: 16px; }

    /* Mobile overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 250;
        display: none;
    }
    .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .table-controls { flex-direction: column; align-items: stretch; }
    .table-search { max-width: 100%; }
    .table-actions { margin-left: 0; }
}
