/* ==============================================
   EASY PRINT - Dashboard CSS
   Horizontal Nav Layout | Light & Dark Theme
   ============================================== */

/* ------------------------------------------
   1. CSS VARIABLES
   ------------------------------------------ */
:root {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f8fa;
    --bg-input: #ffffff;
    --bg-input-focus: #fcfcfd;
    --bg-overlay: rgba(0,0,0,0.45);

    --text-primary: #1a1d26;
    --text-secondary: #5e6278;
    --text-muted: #99a1b7;
    --text-inverse: #ffffff;

    --border-color: #e1e5eb;
    --border-light: #eef0f4;
    --border-focus: #4f7df3;

    --sidebar-bg: #1e2a3a;
    --sidebar-hover: #263546;
    --sidebar-text: #8fa0be;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg: rgba(79,125,243,0.14);
    --sidebar-active-border: #4f7df3;
    --sidebar-section: #5a6e88;
    --sidebar-divider: rgba(255,255,255,0.07);

    --accent: #4f7df3;
    --accent-hover: #3d6ae0;
    --accent-light: rgba(79,125,243,0.1);

    --success: #17c964;
    --success-bg: rgba(23,201,100,0.1);
    --danger: #f31260;
    --danger-bg: rgba(243,18,96,0.1);
    --warning: #f5a524;
    --warning-bg: rgba(245,165,36,0.1);
    --info: #06b6d4;
    --info-bg: rgba(6,182,212,0.1);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    --navbar-bg: #2c3e56;
    --navbar-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --nav-text: #c8d4e2;
    --nav-text-hover: #ffffff;
    --nav-text-active: #ffffff;
    --nav-active-bg: rgba(255,255,255,0.12);
    --nav-hover-bg: rgba(255,255,255,0.08);
    --nav-dropdown-arrow: #8a9bb5;

    --table-stripe: #f3f5f8;
    --table-hover: #eef1f6;
    --table-header-bg: #eef0f5;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --header-height: 90px;
    --nav-height: 44px;
    --content-max-width: 1200px;

    --bg-card-inner: #f7f8fb;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-body: #1a1f2e;
    --bg-card: #222838;
    --bg-card-hover: #2a3245;
    --bg-input: #252d3d;
    --bg-input-focus: #2a3245;
    --bg-overlay: rgba(0,0,0,0.6);

    --text-primary: #e2e6f0;
    --text-secondary: #94a3c3;
    --text-muted: #5f7194;
    --text-inverse: #1a1d26;

    --border-color: #2e3a4e;
    --border-light: #283348;
    --border-focus: #6b8ff7;

    --sidebar-bg: #151b28;
    --sidebar-hover: #1c2436;
    --sidebar-text: #7084a6;
    --sidebar-text-active: #e2e6f0;
    --sidebar-active-bg: rgba(107,143,247,0.12);
    --sidebar-active-border: #6b8ff7;
    --sidebar-section: #4c5f7d;
    --sidebar-divider: rgba(255,255,255,0.05);

    --accent: #6b8ff7;
    --accent-hover: #839ff9;
    --accent-light: rgba(107,143,247,0.12);

    --success: #2ddb78;
    --success-bg: rgba(45,219,120,0.1);
    --danger: #f54180;
    --danger-bg: rgba(245,65,128,0.1);
    --warning: #f7b750;
    --warning-bg: rgba(247,183,80,0.1);
    --info: #22d3ee;
    --info-bg: rgba(34,211,238,0.1);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);

    --navbar-bg: #1a2030;
    --navbar-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --nav-text: #7f92b0;
    --nav-text-hover: #c8d4e2;
    --nav-text-active: #e2e6f0;
    --nav-active-bg: rgba(107,143,247,0.15);
    --nav-hover-bg: rgba(255,255,255,0.06);
    --nav-dropdown-arrow: #5f7194;

    --table-stripe: #252d3d;
    --table-hover: #2a3245;
    --table-header-bg: #252d3d;

    --bg-card-inner: #1c2234;
}


/* ------------------------------------------
   2. BASE / RESET
   ------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; color: var(--text-secondary); }

::selection { background: var(--accent); color: #fff; }

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

code {
    padding: 2px 7px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.8125rem;
    font-family: 'SF Mono', Consolas, monospace;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

small, .text-sm { font-size: 0.8125rem; }


/* ------------------------------------------
   3. GRID SYSTEM
   ------------------------------------------ */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: 24px;
}

.row > [class*="col-"] {
    padding-left: 12px;
    padding-right: 12px;
    margin-bottom: 0;
}

.col-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
.col-2  { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3  { flex: 0 0 25%;     max-width: 25%; }
.col-4  { flex: 0 0 33.333%; max-width: 33.333%; }
.col-5  { flex: 0 0 41.666%; max-width: 41.666%; }
.col-6  { flex: 0 0 50%;     max-width: 50%; }
.col-7  { flex: 0 0 58.333%; max-width: 58.333%; }
.col-8  { flex: 0 0 66.666%; max-width: 66.666%; }
.col-9  { flex: 0 0 75%;     max-width: 75%; }
.col-10 { flex: 0 0 83.333%; max-width: 83.333%; }
.col-11 { flex: 0 0 91.666%; max-width: 91.666%; }
.col-12 { flex: 0 0 100%;    max-width: 100%; }

@media (min-width: 768px) {
    .col-md-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
    .col-md-2  { flex: 0 0 16.666%; max-width: 16.666%; }
    .col-md-3  { flex: 0 0 25%;     max-width: 25%; }
    .col-md-4  { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-5  { flex: 0 0 41.666%; max-width: 41.666%; }
    .col-md-6  { flex: 0 0 50%;     max-width: 50%; }
    .col-md-7  { flex: 0 0 58.333%; max-width: 58.333%; }
    .col-md-8  { flex: 0 0 66.666%; max-width: 66.666%; }
    .col-md-9  { flex: 0 0 75%;     max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333%; max-width: 83.333%; }
    .col-md-11 { flex: 0 0 91.666%; max-width: 91.666%; }
    .col-md-12 { flex: 0 0 100%;    max-width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-1  { flex: 0 0 8.333%;  max-width: 8.333%; }
    .col-lg-2  { flex: 0 0 16.666%; max-width: 16.666%; }
    .col-lg-3  { flex: 0 0 25%;     max-width: 25%; }
    .col-lg-4  { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-lg-5  { flex: 0 0 41.666%; max-width: 41.666%; }
    .col-lg-6  { flex: 0 0 50%;     max-width: 50%; }
    .col-lg-7  { flex: 0 0 58.333%; max-width: 58.333%; }
    .col-lg-8  { flex: 0 0 66.666%; max-width: 66.666%; }
    .col-lg-9  { flex: 0 0 75%;     max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333%; max-width: 83.333%; }
    .col-lg-11 { flex: 0 0 91.666%; max-width: 91.666%; }
    .col-lg-12 { flex: 0 0 100%;    max-width: 100%; }
}

@media (max-width: 767px) {
    .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 16px;
    }
}


/* ------------------------------------------
   4. LAYOUT - BOXED (Two-Bar Header)
   ------------------------------------------ */
.main-content {
    padding-top: calc(var(--header-height) + var(--nav-height));
    min-height: 100vh;
    background: var(--bg-body);
    transition: background 0.3s;
}

.content-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.content-wrapper {
    max-width: var(--content-max-width);
    margin: 24px auto;
    padding: 28px 32px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    min-height: calc(100vh - var(--header-height) - var(--nav-height) - 80px);
}


/* ------------------------------------------
   5. TOP HEADER (light, slim)
   ------------------------------------------ */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1040;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 32px;
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* Brand */
.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}

.header-brand:hover {
    opacity: 0.85;
}

.header-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Company Badge (in header) */
.top-header .company-badge {
    display: flex;
    align-items: center;
    padding: 5px 14px;
    background: var(--accent-light);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* User Dropdown (in header) */
.top-header .user-dropdown {
    position: relative;
}

.top-header .user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.top-header .user-dropdown-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-focus);
}

.top-header .user-dropdown-btn .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
}

.top-header .user-dropdown-btn .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-header .user-dropdown-btn .fa-chevron-down {
    font-size: 0.5625rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

/* Dropdown User Info */
.dropdown-user-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-user-info .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.dropdown-user-info div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dropdown-user-info .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-info .badge {
    font-size: 0.625rem;
    padding: 1px 7px;
    align-self: flex-start;
    margin-top: 2px;
}

/* Dropdown Divider */
.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 6px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-nav-overlay.show {
    display: block;
    opacity: 1;
}


/* ------------------------------------------
   5b. NAVIGATION BAR (below header)
   ------------------------------------------ */
.nav-bar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--navbar-bg);
    border-bottom: none;
    box-shadow: var(--navbar-shadow);
    z-index: 1039;
}

.nav-bar-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 2px;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nav-text);
    border-radius: var(--radius-md);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    height: auto;
}

.nav-link i {
    font-size: 0.875rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link .dropdown-arrow {
    font-size: 0.5625rem;
    width: auto;
    margin-left: 2px;
    color: var(--nav-dropdown-arrow);
    transition: transform var(--transition-fast);
}

.nav-link:hover {
    color: var(--nav-text-hover);
    background: var(--nav-hover-bg);
}

.nav-link.active {
    color: var(--nav-text-active);
    background: var(--nav-active-bg);
    font-weight: 600;
}

/* Dropdown Menus */
.nav-item.has-dropdown {
    position: relative;
}

.nav-dropdown {
    list-style: none;
    margin: 0;
    padding: 6px;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.nav-item.has-dropdown:hover > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-item.has-dropdown:hover > .nav-link .dropdown-arrow,
.nav-item.has-dropdown.mobile-open > .nav-link .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-dropdown li a i {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.nav-dropdown li a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-dropdown li a:hover i {
    color: var(--accent);
}

.nav-dropdown li a.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-dropdown li a.active i {
    color: var(--accent);
}


/* ------------------------------------------
   6. STANDALONE THEME TOGGLE / COMPANY BADGE /
      USER DROPDOWN (non-header contexts)
   ------------------------------------------ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.company-badge {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--accent-light);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-family: var(--font-sans);
}

.user-dropdown-btn:hover {
    background: var(--bg-card-hover);
}

.user-dropdown-btn .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
}

.user-dropdown-btn .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-btn .fa-chevron-down {
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

/* Dropdown Menu (generic) */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1060;
    padding: 6px;
    display: none;
    opacity: 0;
    transform: translateY(4px);
    transition: all var(--transition-fast);
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.dropdown-menu a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-menu a i {
    width: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.dropdown-menu a:hover i {
    color: var(--accent);
}


/* ------------------------------------------
   7. CARDS
   ------------------------------------------ */
.card {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: none;
    margin-bottom: 24px;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.card-body {
    padding: 24px;
}


/* ------------------------------------------
   8. STAT CARDS (Dashboard)
   ------------------------------------------ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card-inner);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: none;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card .stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.stat-card .stat-info p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

/* Stat Card Variants */
.stat-card-primary::after { background: var(--accent); }
.stat-card-primary .stat-icon { background: var(--accent-light); color: var(--accent); }

.stat-card-info::after { background: var(--info); }
.stat-card-info .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-card-success::after { background: var(--success); }
.stat-card-success .stat-icon { background: var(--success-bg); color: var(--success); }

.stat-card-warning::after { background: var(--warning); }
.stat-card-warning .stat-icon { background: var(--warning-bg); color: var(--warning); }

.stat-card-danger::after { background: var(--danger); }
.stat-card-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }


/* ------------------------------------------
   9. TABLES
   ------------------------------------------ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--table-header-bg);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    text-align: left;
}

.table tbody td {
    padding: 13px 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

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

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

.clickable-row {
    cursor: pointer;
}


/* ------------------------------------------
   10. BUTTONS
   ------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    font-family: var(--font-sans);
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-sm { padding: 6px 13px; font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 0.9375rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; box-shadow: 0 4px 12px rgba(79,125,243,0.3); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #14b85c; border-color: #14b85c; color: #fff; box-shadow: 0 4px 12px rgba(23,201,100,0.3); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #e00d58; border-color: #e00d58; color: #fff; box-shadow: 0 4px 12px rgba(243,18,96,0.3); }

.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { background: #e89a1f; border-color: #e89a1f; color: #fff; }

.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover { background: #05a5c1; border-color: #05a5c1; color: #fff; }

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

.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-card-hover); border-color: var(--text-muted); color: var(--text-primary); }

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

.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.btn-group {
    display: inline-flex;
    gap: 4px;
}

.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 4px;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* ------------------------------------------
   11. FORMS
   ------------------------------------------ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label i {
    margin-right: 4px;
    color: var(--text-muted);
}

.required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 9px 14px;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    line-height: 1.5;
}

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

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-control:disabled,
.form-control[readonly] {
    background: var(--table-stripe);
    opacity: 0.7;
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235e6278' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Form Row - uses grid columns */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -8px;
    margin-right: -8px;
}

.form-row > .form-group {
    padding-left: 8px;
    padding-right: 8px;
}

.form-row > .form-group[class*="col-"] {
    padding-left: 8px;
    padding-right: 8px;
}

.form-row .col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.form-row .col-md-3 { flex: 0 0 25%; max-width: 25%; }
.form-row .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.form-row .col-md-5 { flex: 0 0 41.666%; max-width: 41.666%; }
.form-row .col-md-6 { flex: 0 0 50%; max-width: 50%; }
.form-row .col-5 { flex: 0 0 41.666%; max-width: 41.666%; }
.form-row .col-2 { flex: 0 0 16.666%; max-width: 16.666%; }

.form-row .col-md-1 { flex: 0 0 8.333%; max-width: 8.333%; }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 8px;
}

.text-muted { color: var(--text-muted) !important; }

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    user-select: none;
    padding-top: 4px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-custom {
    display: none;
}

/* Filter Form */
.filter-form .form-row {
    align-items: flex-end;
}

/* Validation */
.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.invalid-feedback {
    display: block;
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}


/* ------------------------------------------
   12. BADGES
   ------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-secondary { background: var(--bg-card-hover); color: var(--text-secondary); }


/* ------------------------------------------
   13. ALERTS
   ------------------------------------------ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    animation: alertSlideIn 0.3s ease;
    position: relative;
}

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert i:first-child {
    flex-shrink: 0;
    font-size: 1rem;
}

.alert-close {
    margin-left: auto;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.6;
    font-size: 1.2rem;
    padding: 0 4px;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}

.alert-close:hover { opacity: 1; }

.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-left: 3px solid var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 3px solid var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-left: 3px solid var(--info); }


/* ------------------------------------------
   14. MODALS
   ------------------------------------------ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.modal-overlay .modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    margin: 20px;
    animation: modalIn 0.25s ease;
}

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

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

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Also support modal-backdrop class (used by JS) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
}

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

.modal-backdrop .modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    margin: 20px;
    animation: modalIn 0.25s ease;
}

.modal-backdrop .modal-sm { max-width: 400px; }

.modal-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
}

.modal-confirm-icon.icon-danger  { background: var(--danger-bg);  color: var(--danger); }
.modal-confirm-icon.icon-warning { background: var(--warning-bg); color: var(--warning); }
.modal-confirm-icon.icon-success { background: var(--success-bg); color: var(--success); }

.modal-confirm-text {
    text-align: center;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}


/* ------------------------------------------
   15. TOAST NOTIFICATIONS
   ------------------------------------------ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.16,1,0.3,1);
    position: relative;
    overflow: hidden;
    min-width: 300px;
}

.toast.toast-leaving {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(100px); }
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.toast-success::before { background: var(--success); }
.toast-danger::before  { background: var(--danger); }
.toast-warning::before { background: var(--warning); }
.toast-info::before    { background: var(--info); }

.toast .toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-success .toast-icon { color: var(--success); }
.toast-danger .toast-icon  { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon    { color: var(--info); }

.toast .toast-body { flex: 1; }
.toast .toast-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; font-size: 0.8125rem; }
.toast .toast-message { color: var(--text-secondary); font-size: 0.8125rem; line-height: 1.5; }

.toast .toast-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.toast .toast-close:hover { color: var(--text-primary); }

.toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    animation: toastProgress linear forwards;
}

.toast-success .toast-progress { background: var(--success); }
.toast-danger .toast-progress  { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info .toast-progress    { background: var(--info); }

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}


/* ------------------------------------------
   16. DASHBOARD COMPONENTS
   ------------------------------------------ */
.approval-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
}

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

.approval-item small {
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.empty-state > i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin: 0;
}


/* ------------------------------------------
   17. REPORTS COMPONENTS
   ------------------------------------------ */
.status-bar-item {
    margin-bottom: 16px;
}

.status-bar-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.status-bar-label strong {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    height: 8px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-bar-primary { background: var(--accent); }
.progress-bar-success { background: var(--success); }
.progress-bar-danger  { background: var(--danger); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-info    { background: var(--info); }
.progress-bar-secondary { background: var(--text-muted); }

/* Monthly Chart */
.monthly-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 220px;
    padding: 0 10px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chart-bar {
    width: 80%;
    max-width: 48px;
    background: linear-gradient(180deg, var(--accent), rgba(79,125,243,0.6));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    min-height: 4px;
    transition: height 0.4s ease;
}

[data-theme="dark"] .chart-bar {
    background: linear-gradient(180deg, var(--accent), rgba(107,143,247,0.4));
}

.chart-bar-value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.chart-bar-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 8px;
    white-space: nowrap;
    text-align: center;
}


/* ------------------------------------------
   18. LOGIN PAGE
   ------------------------------------------ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg-body);
}

.login-page::before {
    display: none;
}

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Left Branding Panel */
.login-brand-panel {
    flex: 1;
    background: linear-gradient(135deg, #1e2a3a 0%, #2d3f56 50%, #1a2436 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(79,125,243,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 420px;
}

.login-brand-logo {
    max-width: 400px;
    height: auto;
    margin-bottom: 24px;
    filter: brightness(0) invert(1);
}

.login-brand-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0;
    letter-spacing: 1px;
}

.login-brand-content p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.7;
    margin-bottom: 0;
}

.login-brand-features {
    margin-top: 48px;
    text-align: left;
}

.login-brand-features .feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9375rem;
}

.login-brand-features .feature-item i {
    width: 40px;
    height: 40px;
    background: rgba(79,125,243,0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b8ff7;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Right Form Panel */
.login-form-panel {
    width: 520px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.login-form-wrapper {
    width: 100%;
    max-width: 380px;
}

.login-form-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-form-wrapper .login-subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 32px;
}

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

.login-form .form-control {
    padding: 11px 14px;
    font-size: 0.9375rem;
}

.login-form .btn-primary {
    padding: 12px;
    font-size: 0.9375rem;
    width: 100%;
    margin-top: 8px;
}

/* Password Input */
.password-input-wrapper {
    position: relative;
}

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

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

.password-toggle:hover {
    color: var(--text-primary);
}

.login-footer {
    margin-top: 40px;
    text-align: center;
}

.login-footer p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

/* Old login-card styles (fallback) */
.login-card {
    width: 100%;
}

.login-header {
    margin-bottom: 32px;
}

.login-header .login-logo {
    display: none;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 0;
}


/* ------------------------------------------
   19. TEMPLATE DESIGNER
   ------------------------------------------ */
.designer-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.designer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-bottom: 0;
}

.designer-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.designer-toolbar .toolbar-left h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.designer-toolbar .toolbar-left h3 i {
    color: var(--accent);
    margin-right: 6px;
}

.designer-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.designer-workspace {
    display: flex;
    gap: 24px;
    min-height: 600px;
}

.designer-canvas-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 500px;
    padding: 20px;
}

.designer-canvas {
    position: relative;
    display: inline-block;
    line-height: 0;
}

.designer-canvas img {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
}

.designer-zone {
    position: absolute;
    border: 2px dashed var(--accent);
    background: rgba(79,125,243,0.08);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    user-select: none;
    overflow: hidden;
    padding: 2px 4px;
}

.designer-zone:hover {
    background: rgba(79,125,243,0.15);
}

.designer-zone.selected {
    border-style: solid;
    border-color: #8b5cf6;
    background: rgba(139,92,246,0.12);
    box-shadow: 0 0 0 2px rgba(139,92,246,0.25);
}

.designer-zone .zone-label {
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: inherit;
    pointer-events: none;
    width: 100%;
}

.designer-zone .zone-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: 2px solid var(--bg-card);
    font-size: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.designer-zone.selected .zone-delete,
.designer-zone:hover .zone-delete {
    display: flex;
}

.designer-panel {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--header-height) - var(--nav-height) - 80px);
    overflow-y: auto;
    position: sticky;
    top: calc(var(--header-height) + var(--nav-height) + 24px);
    align-self: flex-start;
}

.designer-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9375rem;
}

.designer-panel-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Panel Sections */
.panel-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section h4 i {
    color: var(--accent);
    font-size: 0.875rem;
    width: 16px;
    text-align: center;
}

/* Variable List */
.variable-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.zone-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.zone-list-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.zone-list-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

/* Alignment Button Group */
.btn-group-full {
    display: flex;
    gap: 4px;
}

.btn-group-full .btn {
    flex: 1;
    justify-content: center;
}

.btn-group-full .btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Context Menu */
.context-menu {
    position: fixed;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    min-width: 180px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.context-menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.context-menu-item i {
    font-size: 0.8125rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 6px;
}

/* Designer Grid Overlay */
.designer-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    display: none;
    background-image: linear-gradient(rgba(79,125,243,0.1) 1px, transparent 1px),
                       linear-gradient(90deg, rgba(79,125,243,0.1) 1px, transparent 1px);
}

.designer-grid.show {
    display: block;
}

/* Preview mode: realistic view without zone chrome */
.designer-zone.preview-mode {
    pointer-events: none;
    background: transparent !important;
}

/* Preview mode: dim the property panel */
.panel-preview-disabled {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.panel-preview-disabled::after {
    content: 'Önizleme modunda düzenleme yapılamaz';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: #000;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    z-index: 5;
}


/* ------------------------------------------
   20. ORDER CREATOR
   ------------------------------------------ */
.order-creator {
    display: flex;
    gap: 24px;
}

.order-form-panel {
    flex: 1;
    min-width: 0;
}

.order-preview-panel {
    width: 420px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + var(--nav-height) + 28px);
    align-self: flex-start;
}

.name-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow: hidden;
}

.name-entry-active {
    border-color: var(--accent);
    border-left: 4px solid var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(79, 125, 243, 0.15);
}

.name-entry-active .name-entry-header {
    background: rgba(79, 125, 243, 0.08);
    color: var(--accent);
    font-weight: 600;
}

.name-entry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--table-stripe);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.name-entry-header:hover {
    background: rgba(79, 125, 243, 0.05);
}

.name-entry-body {
    padding: 18px;
}

.preview-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: #eef1f6;
    border-radius: var(--radius-lg);
    border: 2px solid #d0d7e2;
}

.preview-tab {
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid #c5cdd8;
    border-radius: 8px;
    background: #fff;
    color: #5a6577;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #e8edfb;
}

.preview-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(79, 125, 243, 0.4);
    transform: translateY(-1px);
}

.preview-canvas {
    position: relative;
    display: inline-block;
    width: 100%;
    line-height: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #f0f0f0;
}

.preview-canvas img {
    display: block;
    width: 100%;
    height: auto;
}

.add-name-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 16px;
}

.add-name-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Order Review Modal */
.review-person {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.review-person:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.review-person-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    background: var(--bg-card);
}

.review-person-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.review-person-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.review-person-title {
    flex: 1;
    min-width: 0;
}

.review-person-title strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
}

.review-person-vars {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.review-var-row {
    display: flex;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.8rem;
}

.review-var-label {
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 80px;
}

.review-var-value {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

@media (max-width: 768px) {
    #reviewContent {
        flex-direction: column !important;
    }

    #reviewPreviewPanel {
        width: 100% !important;
        border-right: none !important;
        border-top: 1px solid var(--border-color);
    }

    #reviewPersonList {
        border-right: none !important;
    }
}


/* ------------------------------------------
   ORDER DETAIL PAGE
   ------------------------------------------ */
.order-info-table {
    width: 100%;
    border-collapse: collapse;
}

.order-info-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
    vertical-align: middle;
}

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

.order-info-table .info-label {
    color: var(--text-secondary);
    white-space: nowrap;
    width: 140px;
    font-weight: 500;
}

.order-info-table .info-label i {
    width: 16px;
    text-align: center;
    margin-right: 6px;
    color: var(--text-muted);
}

.order-info-table .info-value {
    color: var(--text-primary);
}

.order-info-table .info-value strong {
    font-weight: 700;
    color: var(--accent);
}

.order-note-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 4px solid #ffa000;
    border-radius: var(--radius-md);
}

.order-note-alert .order-note-icon {
    font-size: 1.25rem;
    color: #f57c00;
    flex-shrink: 0;
    margin-top: 1px;
}

.order-note-alert .order-note-content strong {
    display: block;
    font-size: 0.85rem;
    color: #e65100;
    margin-bottom: 4px;
}

.order-note-alert .order-note-content p {
    margin: 0;
    font-size: 0.875rem;
    color: #4e342e;
    line-height: 1.5;
}

.order-note-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    color: #f57c00;
    font-size: 0.8rem;
    cursor: help;
}

/* Address select in order form */
.var-address-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
    padding-right: 32px;
}
.var-address-select option {
    padding: 6px 8px;
}

.order-item-detail {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
}

.order-item-detail:last-child {
    margin-bottom: 0;
}

.order-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card-hover);
    border-bottom: 1px solid var(--border-light);
}

.order-item-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-item-header .item-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.order-item-body {
    padding: 14px 16px;
}

.order-item-body h5 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.var-row {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
}

.var-row label {
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 100px;
    font-weight: 500;
    margin: 0;
}

.var-row span {
    color: var(--text-primary);
    word-break: break-word;
}

@media (max-width: 768px) {
    .order-info-table td {
        display: block;
        padding: 6px 16px;
    }
    .order-info-table .info-label {
        width: auto;
        padding-bottom: 2px;
        border-bottom: none;
    }
    .order-info-table .info-value {
        padding-top: 0;
    }
}

/* ------------------------------------------
   21. TEMPLATE LIST CARDS
   ------------------------------------------ */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

.template-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.template-card-body {
    padding: 16px;
}


/* ------------------------------------------
   22. INVITE LINK MODAL (Companies)
   ------------------------------------------ */
.invite-link-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.invite-link-input input {
    flex: 1;
}


/* ------------------------------------------
   23. LOADING / SPINNER
   ------------------------------------------ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }

.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    gap: 16px;
}

.loading-overlay .loading-text {
    color: #fff;
    font-size: 0.9375rem;
}

.content-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 12px;
}


/* ------------------------------------------
   24. UTILITY CLASSES
   ------------------------------------------ */
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.w-100 { width: 100%; }


/* ------------------------------------------
   PAGE SIDE TABS (Front/Back)
   ------------------------------------------ */
.page-side-tabs,
.preview-page-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.page-side-tabs {
    margin-left: 16px;
}

.page-side-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.page-side-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.page-side-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.page-side-tab i {
    font-size: 0.75rem;
}


/* ------------------------------------------
   25. RESPONSIVE
   ------------------------------------------ */
@media (max-width: 1280px) {
    .content-wrapper {
        padding: 24px;
        margin-left: 24px;
        margin-right: 24px;
    }

    .nav-bar-inner {
        padding: 0 24px;
    }

    .order-creator {
        flex-direction: column;
    }

    .order-preview-panel {
        width: 100%;
        position: static;
    }

    .designer-workspace {
        flex-direction: column;
    }

    .designer-panel {
        width: 100%;
        max-height: none;
        position: static;
    }
}

@media (max-width: 992px) {
    /* Show mobile hamburger */
    .mobile-menu-btn {
        display: flex;
    }

    /* Nav bar collapses on mobile */
    .nav-bar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        height: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background: var(--navbar-bg);
        border-bottom: none;
        box-shadow: var(--shadow-lg);
        z-index: 1039;
    }

    .nav-bar.mobile-open {
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
    }

    .nav-bar-inner {
        padding: 8px 0;
    }

    .nav-menu {
        flex-direction: column;
        height: auto;
        gap: 0;
    }

    .nav-item {
        height: auto;
        flex-direction: column;
    }

    .nav-link {
        padding: 11px 24px;
        border-radius: 0;
        width: 100%;
    }

    .nav-link:hover {
        border-radius: 0;
    }

    /* Mobile dropdown: show/hide on tap */
    .nav-dropdown {
        position: static;
        min-width: 100%;
        background: rgba(0,0,0,0.12);
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        opacity: 1;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transform: none;
        transition: max-height 0.25s ease, visibility 0s 0.25s;
        pointer-events: auto;
    }

    .nav-item.has-dropdown:hover > .nav-dropdown {
        opacity: 1;
        visibility: hidden;
        max-height: 0;
        transform: none;
    }

    .nav-item.has-dropdown.mobile-open > .nav-dropdown {
        visibility: visible;
        max-height: 500px;
        transition: max-height 0.25s ease, visibility 0s 0s;
    }

    .nav-dropdown li a {
        padding: 10px 24px 10px 48px;
        border-radius: 0;
        color: var(--text-secondary);
    }

    .nav-dropdown li a i {
        color: var(--text-muted);
    }

    .nav-dropdown li a:hover {
        background: var(--accent-light);
        color: var(--accent);
    }

    .nav-dropdown li a:hover i {
        color: var(--accent);
    }

    /* On mobile, only header height matters (nav collapses) */
    .main-content {
        padding-top: var(--header-height);
    }

    .content-wrapper {
        margin-left: 16px;
        margin-right: 16px;
    }

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

    /* Hide user name on smaller screens */
    .top-header .user-dropdown-btn .user-name {
        display: none;
    }

    /* Login responsive */
    .login-container {
        flex-direction: column;
    }

    .login-brand-panel {
        display: none;
    }

    .login-form-panel {
        width: 100%;
        border-left: none;
        padding: 40px 24px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 16px;
        border-radius: var(--radius-md);
        margin-left: 12px;
        margin-right: 12px;
    }

    .content-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

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

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .form-row {
        flex-direction: column;
        margin-left: 0;
        margin-right: 0;
    }

    .form-row > .form-group,
    .form-row > .form-group[class*="col-"],
    .form-row .col-md-2,
    .form-row .col-md-3,
    .form-row .col-md-4,
    .form-row .col-md-5,
    .form-row .col-md-6,
    .form-row .col-5,
    .form-row .col-2,
    .form-row .col-md-1 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .header-inner {
        padding: 0 12px;
    }

    .top-header .company-badge {
        display: none;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        max-width: none;
    }

    .toast { min-width: 0; }

    /* Login on mobile */
    .login-form-panel {
        padding: 32px 20px;
    }

    .login-form-wrapper {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    html { font-size: 13px; }

    .header-logo {
        height: 50px;
    }
}

/* Print */
@media print {
    .top-header, .nav-bar, .mobile-nav-overlay, .toast-container { display: none !important; }
    .main-content { padding-top: 0 !important; }
    .content-wrapper { box-shadow: none; border: none; margin: 0; max-width: none; border-radius: 0; }
    .content-header { display: none; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}


/* ------------------------------------------
   26. ANIMATIONS
   ------------------------------------------ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease; }
