/* ==========================================================================
   Billboard ERP — Design System
   Theme: "Signal" — deep slate control room + amber signal-light accent,
   nodding to illuminated billboards without leaning on a literal skin.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Palette */
    --ink-950: #0B1120;
    --ink-900: #101828;
    --ink-800: #1D2939;
    --ink-700: #344054;
    --ink-600: #475467;
    --ink-500: #667085;
    --ink-400: #98A2B3;
    --ink-300: #D0D5DD;
    --ink-200: #E4E7EC;
    --ink-100: #F0F2F5;
    --ink-50:  #F8FAFC;
    --paper:   #FFFFFF;

    --signal-amber:      #F5A524;
    --signal-amber-dark: #C87F0A;
    --signal-amber-soft: #FEF3DC;

    --teal:      #0E7C7B;
    --teal-soft: #E1F3F2;

    --success:      #12B76A;
    --success-soft: #E7F9F1;
    --danger:       #F04438;
    --danger-soft:  #FEECEB;
    --info:         #2E90FA;
    --info-soft:    #EAF3FF;

    --font-display: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
    --shadow-md: 0 4px 12px rgba(16,24,40,.08);
    --shadow-lg: 0 12px 32px rgba(16,24,40,.12);

    --bg: var(--ink-50);
    --surface: var(--paper);
    --surface-alt: var(--ink-100);
    --text: var(--ink-900);
    --text-muted: var(--ink-600);
    --border: var(--ink-200);
    --sidebar-bg: var(--ink-950);
    --sidebar-text: #C6CEDA;
    --sidebar-active: var(--signal-amber);

    --transition: 150ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --bg: #0B1120;
    --surface: #131B2C;
    --surface-alt: #182238;
    --text: #EAEEF5;
    --text-muted: #93A0B4;
    --border: #223049;
    --sidebar-bg: #070B14;
    --sidebar-text: #8B96AB;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 700; margin: 0; color: var(--text); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
::selection { background: var(--signal-amber-soft); color: var(--ink-900); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--ink-700); }

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

/* ---- Sidebar ---- */
.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width var(--transition);
    z-index: 40;
}
.sidebar.collapsed { width: 76px; }
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.sidebar-brand__mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, var(--signal-amber), var(--signal-amber-dark));
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 800; color: var(--ink-950);
    flex-shrink: 0; font-size: 15px;
}
.sidebar-brand__text { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 15px; white-space: nowrap; overflow: hidden; }
.sidebar-brand__text small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--ink-400); }
.sidebar.collapsed .sidebar-brand__text { display: none; }

.sidebar-nav { flex: 1; padding: 10px 10px 20px; }
.nav-group { margin-bottom: 2px; }
.nav-link, .nav-toggle {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; margin: 1px 0;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500;
    color: var(--sidebar-text);
    white-space: nowrap; overflow: hidden;
    transition: background var(--transition), color var(--transition);
    position: relative;
    border: none; background: transparent; width: 100%; text-align: left;
}
.nav-link:hover, .nav-toggle:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: rgba(245,165,36,.14); color: var(--signal-amber); }
.nav-link.active::before {
    content: ''; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
    background: var(--signal-amber); border-radius: 0 3px 3px 0;
}
.nav-link svg, .nav-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-toggle__chevron { margin-left: auto; width: 14px; height: 14px; transition: transform var(--transition); flex-shrink: 0; }
.nav-toggle.open .nav-toggle__chevron { transform: rotate(90deg); }
.nav-submenu { max-height: 0; overflow: hidden; transition: max-height var(--transition); padding-left: 30px; }
.nav-submenu.open { max-height: 400px; }
.nav-submenu .nav-link { font-size: 13px; padding: 7px 12px; }
.sidebar.collapsed .nav-toggle__chevron,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-toggle span { display: none; }
.sidebar.collapsed .nav-submenu { display: none; }

/* ---- Main column ---- */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 64px; flex-shrink: 0;
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; color: var(--text-muted);
    transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.topbar-search {
    flex: 1; max-width: 380px;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0 12px; height: 38px;
    color: var(--text-muted);
}
.topbar-search input { border: none; background: transparent; outline: none; font-size: 13px; color: var(--text); width: 100%; }
.topbar-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.avatar-menu { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), #0a5a59);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 12px; font-family: var(--font-display);
    flex-shrink: 0;
}
.avatar-menu__name { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.avatar-menu__role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.content { flex: 1; padding: 24px; max-width: 1600px; width: 100%; margin: 0 auto; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; margin-bottom: 4px; }
.page-header .subtitle { color: var(--text-muted); font-size: 13.5px; }
.breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb span { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600; border: 1px solid transparent;
    transition: all var(--transition); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--signal-amber); color: var(--ink-950); }
.btn-primary:hover { background: var(--signal-amber-dark); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Cards / KPIs
   ========================================================================== */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    box-shadow: var(--shadow-sm);
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
    box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card__top { display: flex; align-items: center; justify-content: space-between; }
.kpi-card__icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-card__icon svg { width: 19px; height: 19px; }
.kpi-card__label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi-card__value { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.kpi-card__trend { font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 15px; }
.card-header .card-header__sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow: auto; max-height: calc(100vh - 260px); border-radius: var(--radius-md); border: 1px solid var(--border); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.data-table thead th {
    text-align: left; padding: 11px 14px; background: var(--surface-alt);
    font-weight: 600; color: var(--text-muted); font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border);
    white-space: nowrap; position: sticky; top: 0;
}
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table .cell-muted { color: var(--text-muted); }
.data-table .cell-actions { display: flex; gap: 6px; }
.table-empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.table-empty svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: .5; }

.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.table-toolbar .spacer { flex: 1; }
.search-input {
    display: flex; align-items: center; gap: 8px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; height: 36px; min-width: 220px;
}
.search-input input { border: none; background: transparent; outline: none; font-size: 13px; color: var(--text); width: 100%; }
.search-input svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
select.filter-select, input.filter-date {
    height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); padding: 0 10px; font-size: 13px;
}

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12.5px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 6px; }
.pagination-btns button {
    width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 12.5px;
}
.pagination-btns button.active { background: var(--signal-amber); border-color: var(--signal-amber); color: var(--ink-950); font-weight: 700; }
.pagination-btns button:disabled { opacity: .4; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--signal-amber-soft); color: var(--signal-amber-dark); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); }

/* ==========================================================================
   Forms / Modals
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(11,17,32,.55); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
    background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 660px;
    max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); overflow: hidden; box-sizing: border-box;
}
.modal.modal-lg { max-width: 1080px; width: 95vw; }
.modal.modal-xl { max-width: 1400px; width: 97vw; }
.modal.modal-fullscreen { max-width: 98vw !important; width: 98vw !important; height: 95vh; max-height: 95vh; }
.modal.modal-fullscreen .modal-body { flex: 1; max-height: none; }
.btn-spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btnSpin 0.65s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes btnSpin { to { transform: rotate(360deg); } }
button:disabled, .btn:disabled { opacity: 0.65; cursor: not-allowed; pointer-events: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.modal-header h3 { font-size: 17px; font-weight: 700; color:var(--text); margin: 0; }
.modal-body { padding: 22px 24px; overflow-y: auto; overflow-x: hidden; max-height: calc(92vh - 125px); box-sizing: border-box; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; background: var(--surface); }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; width: 100%; box-sizing: border-box; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; box-sizing: border-box; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 4px; }
.form-group .required { color: var(--danger); font-weight: 700; }
.form-control {
    height: 40px; width: 100%; box-sizing: border-box; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); padding: 0 12px; font-size: 13.5px;
    font-family: var(--font-body); transition: border-color var(--transition), box-shadow var(--transition);
    max-width: 100%; min-width: 0;
}
select.form-control {
    padding-right: 28px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: var(--signal-amber); box-shadow: 0 0 0 3px rgba(245,165,36,.18); }
.form-control[readonly] { background: var(--surface-alt); color: var(--text); cursor: default; }
textarea.form-control { height: auto; padding: 10px 12px; min-height: 76px; resize: vertical; }
.form-hint { font-size: 11.5px; color: var(--text-muted); }
.form-error { font-size: 11.5px; color: var(--danger); }

/* ==========================================================================
   Login page
   ========================================================================== */
.login-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--ink-950);
    background-image: radial-gradient(circle at 20% 20%, rgba(245,165,36,.09), transparent 45%),
                       radial-gradient(circle at 80% 80%, rgba(14,124,123,.15), transparent 45%);
    padding: 20px;
}
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-title { font-size: 19px; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-demo { margin-top: 18px; padding: 12px 14px; background: var(--surface-alt); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-md);
    background: var(--ink-950); color: #fff; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
    min-width: 260px; animation: toast-in .2s ease;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.toast-success { background: #0B4A32; }
.toast.toast-error { background: #5C1A17; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* Confirm dialog */
.confirm-modal { max-width: 400px; text-align: center; padding: 28px 24px; }
.confirm-modal .confirm-icon {
    width: 48px; height: 48px; border-radius: 50%; background: var(--danger-soft); color: var(--danger);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.confirm-modal .confirm-icon svg { width: 22px; height: 22px; }
.confirm-modal h3 { margin-bottom: 8px; }
.confirm-modal p { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.confirm-modal .confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* Loading */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,.1); border-top-color: var(--signal-amber); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: 6px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Toggle switch (light/dark) */
.theme-toggle { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); position: relative; flex-shrink: 0; }
.theme-toggle__dot { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--signal-amber); transition: transform var(--transition); display: flex; align-items: center; justify-content: center; }
[data-theme="dark"] .theme-toggle__dot { transform: translateX(18px); }
.theme-toggle__dot svg { width: 11px; height: 11px; color: var(--ink-950); }

/* Utility */
.text-right { text-align: right; }
.mono { font-family: var(--font-mono); }
.mb-0{margin-bottom:0} .mt-16{margin-top:16px}
.flex { display: flex; } .items-center { align-items: center; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--signal-amber); border-radius: 999px; }

/* Mobile sidebar */
.sidebar-backdrop { display: none; }
.mobile-menu-btn { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
    .mobile-menu-btn { display: flex; }
    .topbar-search { display: none; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .kpi-grid, .grid-3 { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .avatar-menu__name, .avatar-menu__role { display: none; }
}

/* ==========================================================================
   Utilities & Component Classes (added in R1)
   ========================================================================== */

/* Metrics Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 1200px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .metrics-grid { grid-template-columns: 1fr; }
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}
.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--ink-300);
}
.metric-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.metric-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.metric-card__icon svg {
    width: 20px;
    height: 20px;
}
.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.metric-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Card Header & Body Helpers */
.card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-header-styled {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header-styled h3 {
    font-size: 14.5px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Quick Action Tiles */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.quick-action-btn:hover {
    background: var(--surface-alt);
    border-color: var(--signal-amber);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.quick-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--ink-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    flex-shrink: 0;
}
.quick-action-icon svg { width: 18px; height: 18px; }

/* Typography utilities */
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--text); }
.p-0 { padding: 0 !important; }
.mt-16 { margin-top: 16px; }

/* Table specific */
.table-responsive { overflow-x: auto; width: 100%; margin-bottom: 0; }
table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--surface);
    text-align: left;
}
table.table thead th {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
table.table tbody tr:last-child td {
    border-bottom: none;
}
table.table tbody tr:hover {
    background: rgba(15, 23, 42, 0.02);
}
.items-table, .totals-table, .meta-table { width: 100%; border-collapse: collapse; }
.items-table th, .items-table td, .totals-table td, .meta-table td { border: 1px solid var(--border); padding: 8px 12px; }
.items-table th { background: var(--surface-alt); font-weight: 500; font-size: 13px; text-align: left; }
.totals-table td { font-weight: 500; }
.sign-line { border-top: 1px solid var(--text); margin-top: 40px; padding-top: 8px; text-align: center; width: 200px; display: inline-block; font-size: 13px; }

/* Layout parts used in Print/Modal */
.header, .footer { margin-bottom: 16px; }
.half { width: 50%; display: inline-block; vertical-align: top; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; gap: 16px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 16px; cursor: pointer; color: var(--text-muted); font-size: 14px; font-weight: 500; transition: all 0.2s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { border-bottom-color: var(--signal-amber); color: var(--signal-amber-dark); font-weight: 600; }

/* Permissions Table */
.perm-view { color: #3b82f6; }
.perm-edit { color: #10b981; }
.perm-delete { color: #ef4444; }

/* Checkboxes */
.bk-chk { margin: 0; padding: 0; cursor: pointer; }

/* --------------------------------------------------------------------------
   User & Dynamic Role Management UI Enhancements
   -------------------------------------------------------------------------- */
.modal-user-form {
    max-width: 620px !important;
    width: 95vw !important;
}
.modal-user-form .modal-body {
    padding: 24px 30px;
}
.modal-user-form .form-control {
    height: 46px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    width: 100%;
}
.modal-user-form .input-icon-wrap .form-control {
    padding-left: 44px;
}
.modal-user-form .input-icon-wrap svg.input-lead-icon {
    left: 15px;
    width: 18px;
    height: 18px;
}

/* Sleek User Identity Strip */
.user-id-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 165, 36, 0.08), rgba(245, 165, 36, 0.02));
    border: 1px solid rgba(245, 165, 36, 0.25);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}
.user-id-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--signal-amber), var(--signal-amber-dark));
    color: var(--ink-950);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-display);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(245, 165, 36, 0.35);
}
.user-id-details {
    flex: 1;
    min-width: 0;
}
.user-id-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.user-id-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.user-id-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Full Width Role Scope Banner */
.role-scope-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    grid-column: 1 / -1;
    margin-top: -2px;
    margin-bottom: 6px;
}
.role-scope-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--info-soft);
    color: var(--info);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.role-scope-icon svg {
    width: 17px;
    height: 17px;
}
.role-scope-content {
    flex: 1;
    min-width: 0;
}
.role-scope-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}
.role-scope-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.role-scope-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.form-helper-text {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.35;
}

.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.input-icon-wrap svg.input-lead-icon {
    position: absolute;
    left: 12px;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    pointer-events: none;
}
.input-icon-wrap .form-control {
    padding-left: 38px;
}
.input-icon-wrap .input-trail-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.input-icon-wrap .input-trail-btn:hover {
    color: var(--text);
    background: var(--surface-alt);
}
.input-icon-wrap .input-trail-btn svg {
    width: 16px;
    height: 16px;
}

.role-preview-box {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}
.role-preview-box__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.role-preview-box__desc {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

/* Roles Management Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 14px;
}
.role-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--transition), box-shadow var(--transition);
}
.role-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.role-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}
.role-card__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.role-card__desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 14px;
    flex: 1;
}
.role-card__stats {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    font-size: 12.5px;
}
.role-card__stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}
.role-card__stat-item strong {
    color: var(--text);
    font-weight: 700;
}
.role-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Permissions Matrix Toolbar & Layout */
.perm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.perm-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.perm-quick-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}
.perm-quick-btn:hover {
    background: var(--surface-alt);
    border-color: var(--text-muted);
}
.perm-category-row {
    background: var(--surface-alt) !important;
    font-weight: 700;
    font-size: 13px;
    color: var(--text);
}
.perm-category-row td {
    padding: 8px 12px !important;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.cat-btn-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}
.cat-btn-pill:hover {
    background: var(--surface-alt);
    border-color: var(--signal-amber);
    color: var(--signal-amber-dark);
}
.perm-chk-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
}
.perm-chk-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--signal-amber);
}

/* ==========================================================================
   GLOBAL PRINT STYLESHEET (Prevents table clipping & hides navs on print)
   ========================================================================== */
@media print {
    .sidebar,
    .header,
    .table-toolbar,
    .page-header-actions,
    .print-btn,
    .btn,
    #cl-print,
    #cr-print,
    #ol-print,
    #pnl-print,
    #add-booking-btn,
    #import-s1-btn {
        display: none !important;
    }

    body, .app-layout, .main-content, .page-content {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
        width: 100% !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    .table-responsive {
        overflow: visible !important;
        display: block !important;
        width: 100% !important;
    }

    table {
        width: 100% !important;
        border-collapse: collapse !important;
        table-layout: auto !important;
    }

    th, td {
        padding: 6px 8px !important;
    }
}



