:root {
    --primary:        #1565c0;
    --primary-dark:   #0d47a1;
    --primary-light:  #e3f2fd;
    --accent:         #00897b;
    --accent-dark:    #00695c;
    --accent-light:   #e0f2f1;
    --bg:             #f0f4f8;
    --card:           #ffffff;
    --text:           #1a2332;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow:         0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
    --radius-sm:      6px;
    --radius:         10px;
    --radius-lg:      16px;
    --success:        #16a34a;
    --success-bg:     #f0fdf4;
    --warning:        #d97706;
    --warning-bg:     #fffbeb;
    --danger:         #dc2626;
    --danger-bg:      #fef2f2;
    --info:           #0284c7;
    --info-bg:        #f0f9ff;
    --transition:     0.18s ease;
    --font:           'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Flash Messages ── */
.flash {
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid;
}
.flash-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.flash-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger);  }
.flash-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.flash-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info);    }

/* ── Page Wrapper ── */
.page-wrapper { padding: 24px; max-width: 1440px; margin: 0 auto; }

/* ── Cards ── */
.card-custom {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

/* ── Form Controls ── */
.form-group { margin-bottom: 18px; }

.form-label-custom {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-control-custom {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}
.form-control-custom::placeholder { color: #b0bbc9; }

/* ── Buttons ── */
.btn-custom {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-custom:active { transform: translateY(1px); }

.btn-primary  { background: var(--primary);  color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,101,192,0.3); }

.btn-accent   { background: var(--accent);   color: #fff; }
.btn-accent:hover   { background: var(--accent-dark);  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,137,123,0.3); }

.btn-secondary { background: #fff; color: #374151; border: 1.5px solid #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; border-color: #94a3b8; transform: translateY(-1px); }

.btn-outline  { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover  { background: var(--primary-light); }

.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover   { background: #b91c1c; transform: translateY(-1px); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Table ── */
.table-custom {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table-custom thead th {
    background: var(--primary);
    color: #fff;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.table-custom tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.table-custom tbody tr:hover { background: var(--primary-light); }
.table-custom tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge-custom {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}
.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);    }

/* ── Compact form controls (used across all modules) ── */
.form-label-sm {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 5px;
}
.form-ctrl-sm {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13.5px;
    font-family: inherit;
    color: #1a2332;
    background: #fafbfc;
    outline: none;
    transition: border-color .18s;
}
.form-ctrl-sm:focus { border-color: #1565c0; background: #fff; box-shadow: 0 0 0 3px rgba(21,101,192,.08); }
.form-ctrl-sm::placeholder { color: #b0bbc9; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══ Responsive ══ */

/* Large desktop / 4K monitor */
@media (min-width: 1920px) {
    body { font-size: 15px; }
    .page-wrapper { max-width: 1800px; padding: 32px; }
    .card-custom { padding: 32px; }
    .btn-custom { padding: 11px 22px; font-size: 14.5px; }
    .table-custom thead th { font-size: 13.5px; padding: 13px 16px; }
    .table-custom tbody td { padding: 12px 16px; font-size: 14px; }
}

/* Laptop / standard desktop (1024–1440px) */
@media (max-width: 1440px) {
    .page-wrapper { max-width: 1280px; }
}

/* Tablet landscape (900–1024px) */
@media (max-width: 1024px) {
    .page-wrapper { padding: 18px; max-width: 100%; }
    .card-custom { padding: 20px; }
}

/* Tablet portrait (600–900px) */
@media (max-width: 900px) {
    .page-wrapper { padding: 14px; }
    .card-custom { padding: 16px; }
    .table-custom { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .btn-custom { min-height: 42px; } /* touch-friendly */
}

/* Mobile large (480–600px) */
@media (max-width: 600px) {
    body { font-size: 13.5px; }
    .page-wrapper { padding: 12px; }
    .card-custom { padding: 14px; border-radius: 8px; }
    .btn-custom { padding: 9px 16px; font-size: 13.5px; min-height: 44px; }
    .btn-sm { padding: 7px 13px; font-size: 12.5px; min-height: 38px; }
    .form-control-custom { font-size: 16px; } /* prevent iOS zoom */
    .form-ctrl-sm { font-size: 16px; }
}

/* Mobile small (< 480px) */
@media (max-width: 480px) {
    body { font-size: 13px; }
    .page-wrapper { padding: 8px; }
    .card-custom { padding: 12px; border-radius: 6px; }
    .btn-custom { padding: 8px 14px; font-size: 13px; width: 100%; justify-content: center; }
    .btn-sm { padding: 7px 12px; font-size: 12.5px; width: auto; }
    .btn-full { width: 100%; }
    .table-custom thead th,
    .table-custom tbody td { padding: 8px 10px; font-size: 12.5px; }
}

/* Very small phone (< 360px) */
@media (max-width: 360px) {
    .page-wrapper { padding: 6px; }
}

@media print {
    .topbar,
    .mainnav,
    #navBackdrop,
    .no-print,
    .flash { display: none !important; }

    body { background: #fff !important; margin: 0 !important; }

    .page-wrapper,
    .list-page,
    .sys-page { padding: 0 !important; margin: 0 !important; max-width: none !important; width: 100% !important; box-sizing: border-box !important; }

    .sys-card { border: none !important; box-shadow: none !important; overflow: visible !important; }
    .sys-card-body { overflow: visible !important; }
}

