/* ═══════════════════════════════════════════════════════════════
   PUMP MANAGEMENT SYSTEM — Professional UI
   Design: Clean SaaS Dashboard
═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────
   1.  DESIGN TOKENS
────────────────────────────────────────────── */
:root {
    /* Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed: 68px;
    --header-height: 64px;

    /* Sidebar */
    --sidebar-bg: #0f172a;
    --sidebar-surface: #1e293b;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active-bg: rgba(59,130,246,0.14);
    --sidebar-active-border: #3b82f6;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #f1f5f9;
    --sidebar-text-label: #475569;

    /* Brand / Accent */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: rgba(37,99,235,0.1);
    --accent-mid: rgba(37,99,235,0.06);

    /* Content */
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 4px 16px rgba(15,23,42,0.04);
    --card-shadow-hover: 0 4px 8px rgba(15,23,42,0.08), 0 8px 24px rgba(15,23,42,0.06);

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    /* Borders */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Semantic */
    --success: #059669;
    --success-light: rgba(5,150,105,0.1);
    --danger: #dc2626;
    --danger-light: rgba(220,38,38,0.1);
    --warning: #d97706;
    --warning-light: rgba(217,119,6,0.1);
    --info: #0ea5e9;
    --info-light: rgba(14,165,233,0.1);
    --purple: #7c3aed;
    --purple-light: rgba(124,58,237,0.1);
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ──────────────────────────────────────────────
   3.  SIDEBAR
────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1055;
    display: flex;
    flex-direction: column;
    transition: width 0.28s cubic-bezier(.4,0,.2,1), transform 0.28s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

/* Brand */
.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    gap: 12px;
}

.sidebar-brand img, .brand-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    object-fit: contain;
    font-size: 24px;
    color: var(--accent);
}

.brand-text {
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: -0.01em;
}

/* Role strip */
.sidebar-logged-in {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logged-in-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}

.sidebar-logged-in-info { overflow: hidden; }

.sidebar-logged-in-label {
    display: block;
    font-size: 11px;
    color: var(--sidebar-text-label);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-logged-in-role {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #7dd3fc;
    text-transform: capitalize;
    line-height: 1.3;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-item { padding: 1px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 9px;
    transition: background 0.18s, color 0.18s;
    font-size: 14px;
    font-weight: 500;
    min-height: 42px;
    border: none;
    width: 100%;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

.nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    transition: color 0.18s;
}

.nav-link .link-text {
    margin-left: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.nav-link:hover i { color: #e2e8f0; }

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

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--sidebar-active-border);
    border-radius: 0 3px 3px 0;
}

.nav-link.active i { color: #60a5fa; }

/* Nav groups */
.nav-group { padding: 1px 10px; }

button.nav-group-toggle {
    background: transparent;
    text-align: left;
    color: inherit;
    font: inherit;
}

.nav-group-chevron,
.nav-chevron {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.55;
    transition: transform 0.22s ease;
    flex-shrink: 0;
}

.nav-group-open .nav-group-toggle .nav-group-chevron,
.nav-group-open .nav-group-toggle .nav-chevron {
    transform: rotate(-180deg);
    opacity: 0.8;
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    padding: 0;
}

.nav-group-open .nav-submenu {
    max-height: 600px;
    opacity: 1;
    padding: 2px 0 4px;
}

.nav-sublink {
    padding: 8px 12px 8px 26px;
    min-height: 38px;
    font-size: 13px;
    font-weight: 500;
}

.nav-sublink i {
    font-size: 15px;
    width: 18px;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

/* ── COLLAPSED ── */
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }

.sidebar-collapsed .brand-text,
.sidebar-collapsed .link-text,
.sidebar-collapsed .sidebar-logged-in-info,
.sidebar-collapsed .nav-group-chevron,
.sidebar-collapsed .sidebar-footer {
    display: none;
}

.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0;
}

.sidebar-collapsed .sidebar-logged-in {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .sidebar-logged-in-avatar { width: 34px; height: 34px; }

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .nav-link::before { display: none; }

.sidebar-collapsed .nav-link i {
    font-size: 20px;
    width: auto;
}

@media (min-width: 992px) {
    .sidebar-collapsed .nav-submenu { display: none !important; }
}

.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }
.sidebar-collapsed .top-header   { left: var(--sidebar-collapsed); }

/* ──────────────────────────────────────────────
   4.  HEADER
────────────────────────────────────────────── */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1035;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-backdrop.show { display: block; }

.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1030;
    transition: left 0.28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 1px 0 var(--border-color), 0 2px 8px rgba(15,23,42,0.04);
}

.sidebar-collapsed .top-header { left: var(--sidebar-collapsed); }

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
    min-width: 42px;
    min-height: 42px;
    flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--body-bg); color: var(--text-primary); }

.header-title-group { min-width: 0; line-height: 1.25; }

.header-title-group h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.header-datetime {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-top: 1px;
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Icon buttons in header */
.header-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 17px;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    text-decoration: none;
    flex-shrink: 0;
}

.header-icon-btn:hover { background: var(--body-bg); color: var(--text-primary); border-color: #cbd5e1; }

/* Notification */
.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--card-bg);
    pointer-events: none;
}

.notif-wrap { position: relative; }

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 310px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(15,23,42,0.14);
    z-index: 1050;
    display: none;
    overflow: hidden;
}

.notif-dropdown.show { display: block; }

.notif-dropdown-title {
    padding: 12px 16px 11px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--body-bg);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--text-primary);
    transition: background 0.15s;
}

.notif-item:hover { background: var(--body-bg); }
.notif-item:last-child { border-bottom: none; }
.notif-item i { font-size: 15px; flex-shrink: 0; margin-top: 2px; }

/* User dropdown */
.user-dropdown { position: relative; }

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 6px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s;
    min-height: 42px;
}

.user-dropdown-toggle:hover { background: var(--body-bg); border-color: #cbd5e1; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.user-info { text-align: left; line-height: 1.3; }

.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.user-info .user-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15,23,42,0.14);
    min-width: 186px;
    display: none;
    z-index: 1050;
    overflow: hidden;
}

.user-dropdown-menu.show { display: block; }

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.15s;
}

.user-dropdown-menu a:hover { background: var(--body-bg); }
.user-dropdown-menu a.text-danger { color: var(--danger); }
.user-dropdown-menu a.text-danger:hover { background: var(--danger-light); }

/* ──────────────────────────────────────────────
   5.  MAIN LAYOUT
────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.28s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    padding: 28px 28px 20px;
    flex: 1;
}

.app-footer {
    text-align: center;
    padding: 14px 28px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    background: var(--card-bg);
}

/* ──────────────────────────────────────────────
   6.  BOOTSTRAP GRID  (col-sm-*, g-*)
────────────────────────────────────────────── */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -8px;
    margin-right: -8px;
}

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

/* gutter overrides */
.g-0 { --g: 0px; }
.g-2 { --g: 8px; }
.g-3 { --g: 12px; }
.g-4 { --g: 16px; }
.row.g-0, .row.g-2, .row.g-3, .row.g-4 {
    margin-left: calc(var(--g) * -.5);
    margin-right: calc(var(--g) * -.5);
}
.row.g-0 > *, .row.g-2 > *, .row.g-3 > *, .row.g-4 > * {
    padding-left: calc(var(--g) * .5);
    padding-right: calc(var(--g) * .5);
    margin-bottom: var(--g);
}

/* Base columns */
.col       { flex: 1 1 0; min-width: 0; }
.col-auto  { flex: 0 0 auto; width: auto; }
.col-12    { flex: 0 0 100%; max-width: 100%; }
.col-6     { flex: 0 0 50%; max-width: 50%; }
.col-4     { flex: 0 0 33.3333%; max-width: 33.3333%; }
.col-3     { flex: 0 0 25%; max-width: 25%; }
.col-8     { flex: 0 0 66.6666%; max-width: 66.6666%; }

/* sm breakpoint (≥576px) */
@media (min-width: 576px) {
    .col-sm-auto  { flex: 0 0 auto; width: auto; }
    .col-sm-1  { flex: 0 0 8.3333%;  max-width: 8.3333%; }
    .col-sm-2  { flex: 0 0 16.6666%; max-width: 16.6666%; }
    .col-sm-3  { flex: 0 0 25%;      max-width: 25%; }
    .col-sm-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-sm-5  { flex: 0 0 41.6666%; max-width: 41.6666%; }
    .col-sm-6  { flex: 0 0 50%;      max-width: 50%; }
    .col-sm-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
    .col-sm-8  { flex: 0 0 66.6666%; max-width: 66.6666%; }
    .col-sm-9  { flex: 0 0 75%;      max-width: 75%; }
    .col-sm-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
    .col-sm-11 { flex: 0 0 91.6666%; max-width: 91.6666%; }
    .col-sm-12 { flex: 0 0 100%;     max-width: 100%; }
}

/* md breakpoint (≥768px) */
@media (min-width: 768px) {
    .col-md-auto { flex: 0 0 auto; width: auto; }
    .col-md-2  { flex: 0 0 16.6666%; max-width: 16.6666%; }
    .col-md-3  { flex: 0 0 25%;      max-width: 25%; }
    .col-md-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-md-5  { flex: 0 0 41.6666%; max-width: 41.6666%; }
    .col-md-6  { flex: 0 0 50%;      max-width: 50%; }
    .col-md-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
    .col-md-8  { flex: 0 0 66.6666%; max-width: 66.6666%; }
    .col-md-9  { flex: 0 0 75%;      max-width: 75%; }
    .col-md-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
    .col-md-12 { flex: 0 0 100%;     max-width: 100%; }
}

/* lg breakpoint (≥992px) */
@media (min-width: 992px) {
    .col-lg-2  { flex: 0 0 16.6666%; max-width: 16.6666%; }
    .col-lg-3  { flex: 0 0 25%;      max-width: 25%; }
    .col-lg-4  { flex: 0 0 33.3333%; max-width: 33.3333%; }
    .col-lg-5  { flex: 0 0 41.6666%; max-width: 41.6666%; }
    .col-lg-6  { flex: 0 0 50%;      max-width: 50%; }
    .col-lg-7  { flex: 0 0 58.3333%; max-width: 58.3333%; }
    .col-lg-8  { flex: 0 0 66.6666%; max-width: 66.6666%; }
    .col-lg-9  { flex: 0 0 75%;      max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.3333%; max-width: 83.3333%; }
    .col-lg-12 { flex: 0 0 100%;     max-width: 100%; }
}

/* ──────────────────────────────────────────────
   7.  CARDS
────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 i { color: var(--accent); font-size: 16px; }

.card-body { padding: 22px; }

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.card-footer {
    padding: 12px 22px;
    border-top: 1px solid var(--border-color);
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--body-bg);
}

/* KPI stat icon circles */
.rounded-circle {
    border-radius: 50% !important;
}

/* ──────────────────────────────────────────────
   8.  BUTTONS
────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s, border-color 0.18s, color 0.18s;
    text-decoration: none;
    white-space: nowrap;
    min-height: 38px;
    line-height: 1.4;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.btn:active { transform: translateY(1px); }

.btn-sm {
    padding: 5px 12px;
    font-size: 12.5px;
    min-height: 32px;
    border-radius: 7px;
    gap: 5px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11.5px;
    min-height: 26px;
    border-radius: 6px;
    gap: 4px;
}

/* Primary */
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(37,99,235,0.2), 0 2px 8px rgba(37,99,235,0.15);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(37,99,235,0.3); color: #fff; }

/* Secondary */
.btn-secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: #e2e8f0; color: var(--text-primary); }

/* Danger */
.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 1px 2px rgba(220,38,38,0.2);
}
.btn-danger:hover { background: #b91c1c; color: #fff; }

/* Success */
.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 1px 2px rgba(5,150,105,0.2);
}
.btn-success:hover { background: #047857; color: #fff; }

/* Warning */
.btn-warning {
    background: var(--warning);
    color: #fff;
    box-shadow: 0 1px 2px rgba(217,119,6,0.2);
}
.btn-warning:hover { background: #b45309; color: #fff; }

/* Info */
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #0284c7; color: #fff; }

/* Light */
.btn-light { background: var(--border-light); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-light:hover { background: var(--border-color); }

/* Outline */
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover { background: var(--body-bg); border-color: #cbd5e1; color: var(--text-primary); }

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

.btn-outline-secondary { background: transparent; border: 1.5px solid var(--border-color); color: var(--text-secondary); }
.btn-outline-secondary:hover { background: var(--body-bg); color: var(--text-primary); border-color: #94a3b8; }

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

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

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

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

/* ──────────────────────────────────────────────
   9.  FORMS
────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-control, .form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-bg);
    transition: border-color 0.18s, box-shadow 0.18s;
    min-height: 42px;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control::placeholder { color: #94a3b8; font-weight: 400; }

.form-control:disabled, .form-control[readonly] {
    background: var(--body-bg);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-control-sm, .form-select-sm {
    padding: 5px 10px;
    font-size: 13px;
    min-height: 34px;
    border-radius: 7px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%2394a3b8' d='M7 9L2 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 34px;
}

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

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control { border-radius: 9px 0 0 9px; flex: 1; }
.input-group > .form-control:not(:first-child) { border-radius: 0 9px 9px 0; border-left: none; }

.input-group-text {
    display: flex;
    align-items: center;
    padding: 8px 13px;
    background: var(--body-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 0 9px 9px 0;
    font-size: 13.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    border-left: none;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 40px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.form-check label { font-size: 14px; cursor: pointer; user-select: none; }

.form-text { font-size: 12px; color: var(--text-secondary); margin-top: 5px; }

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

.table, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table th, .table th {
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--body-bg);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td, .table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
}

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

.data-table tbody tr:hover td, .table tbody tr:hover td {
    background: #f8fafc;
}

/* Bootstrap table variants */
.table-sm th, .table-sm td { padding: 7px 12px; }
.table-sm { font-size: 13px; }

.table-hover tbody tr:hover td { background: #f8fafc; }

.table-light th { background: var(--body-bg); }

.table-striped tbody tr:nth-child(even) td { background: #fafbfc; }

/* text-end / text-right on cells */
.text-end, .text-right { text-align: right; }
.text-start { text-align: left; }
.text-center { text-align: center; }

/* ──────────────────────────────────────────────
   11. BADGES
────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.badge-primary   { background: var(--accent-light);  color: var(--accent); }
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-secondary { background: #f1f5f9;              color: var(--text-secondary); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-purple    { background: var(--purple-light);  color: var(--purple); }

/* Bootstrap bg-* badge compat */
.badge.bg-success  { background: var(--success-light) !important; color: var(--success) !important; }
.badge.bg-danger   { background: var(--danger-light)  !important; color: var(--danger)  !important; }
.badge.bg-warning  { background: var(--warning-light) !important; color: var(--warning) !important; }
.badge.bg-primary  { background: var(--accent-light)  !important; color: var(--accent)  !important; }
.badge.bg-secondary{ background: #f1f5f9 !important; color: var(--text-secondary) !important; }
.badge.bg-info     { background: var(--info-light)    !important; color: var(--info)    !important; }

/* ──────────────────────────────────────────────
   12. ALERTS
────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 500;
    border: 1.5px solid transparent;
}

.alert i { font-size: 16px; flex-shrink: 0; }

.alert-success { background: var(--success-light); color: #065f46; border-color: rgba(5,150,105,0.25); }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border-color: rgba(220,38,38,0.25); }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: rgba(217,119,6,0.25); }
.alert-info    { background: var(--info-light);    color: #0c4a6e; border-color: rgba(14,165,233,0.25); }

/* ──────────────────────────────────────────────
   13. MODALS
────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    z-index: 1060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(4px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

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

.modal-dialog {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 530px;
    /* min() + dvh: dialog fits the visible viewport on mobile (iOS toolbars, etc.) */
    max-height: min(92vh, calc(100vh - 32px));
    max-height: min(92vh, calc(100dvh - 32px));
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(15,23,42,0.22);
    animation: modal-in 0.2s cubic-bezier(.4,0,.2,1);
}

/* Form is a flex child when it sits inside .modal-dialog (header may be a sibling above it). */
.modal-dialog > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 18px 22px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--body-bg);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 7px;
}

.modal-header h3 i { color: var(--accent); }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

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

.modal-body {
    padding: 22px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: var(--body-bg);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────
   14. AUTH PAGES
────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 60%;
    height: 80%;
    background: radial-gradient(circle, rgba(37,99,235,0.18) 0%, transparent 65%);
    pointer-events: none;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.28);
    width: 100%;
    max-width: 430px;
    padding: 44px 36px;
    position: relative;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-card .auth-logo .auth-brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
    color: #fff;
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

.auth-card .auth-logo h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.auth-card .auth-logo p {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.auth-card .auth-footer a { color: var(--accent); font-weight: 600; }
.auth-card .auth-footer a:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────
   15. STATUS & UTILITY
────────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

.status-dot.active  { background: var(--success); box-shadow: 0 0 0 2px rgba(5,150,105,0.2); }
.status-dot.deleted { background: var(--danger); }

.logo-preview {
    width: 120px;
    height: 60px;
    border: 2px dashed var(--border-color);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 8px;
}

.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.toggle-switch {
    position: relative;
    width: 46px;
    height: 25px;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 25px;
    cursor: pointer;
    transition: 0.25s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 19px;
    height: 19px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(21px); }

/* 403 */
.error-page { text-align: center; padding: 60px 20px; }

.error-page .error-code {
    font-size: 80px;
    font-weight: 900;
    color: var(--border-color);
    line-height: 1;
    letter-spacing: -0.04em;
}

.error-page h2 { font-size: 24px; margin: 18px 0 8px; }
.error-page p  { color: var(--text-secondary); margin-bottom: 24px; }

/* ──────────────────────────────────────────────
   16. WELCOME / KPI CARD
────────────────────────────────────────────── */
.welcome-card {
    background: linear-gradient(135deg, #0f172a 0%, var(--accent) 120%);
    color: #fff;
    border-radius: 14px;
    padding: 30px 28px;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}

.welcome-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.welcome-card p  { opacity: 0.8; font-size: 13.5px; }

/* ──────────────────────────────────────────────
   17. BOOTSTRAP UTILITY CLASSES
────────────────────────────────────────────── */

/* Display */
.d-flex      { display: flex !important; }
.d-block     { display: block !important; }
.d-none      { display: none !important; }
.d-inline    { display: inline !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid      { display: grid !important; }

/* Flex */
.flex-wrap   { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-fill   { flex: 1 1 auto !important; }
.flex-column { flex-direction: column !important; }

.align-items-center  { align-items: center !important; }
.align-items-start   { align-items: flex-start !important; }
.align-items-end     { align-items: flex-end !important; }
.align-items-stretch { align-items: stretch !important; }

.justify-content-between { justify-content: space-between !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-start   { justify-content: flex-start !important; }

.gap-0 { gap: 0 !important; }
.gap-1 { gap: 6px !important; }
.gap-2 { gap: 10px !important; }
.gap-3 { gap: 16px !important; }
.gap-4 { gap: 22px !important; }
.gap-5 { gap: 28px !important; }

/* Spacing */
.m-0  { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 6px !important; }
.mt-2 { margin-top: 10px !important; }
.mt-3 { margin-top: 16px !important; }
.mt-4 { margin-top: 22px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 6px !important; }
.mb-2 { margin-bottom: 10px !important; }
.mb-3 { margin-bottom: 16px !important; }
.mb-4 { margin-bottom: 22px !important; }
.mb-5 { margin-bottom: 32px !important; }
.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 6px !important; }
.ms-2 { margin-left: 10px !important; }
.ms-auto { margin-left: auto !important; }
.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: 6px !important; }
.me-2 { margin-right: 10px !important; }
.me-auto { margin-right: auto !important; }

.p-0  { padding: 0 !important; }
.p-2  { padding: 10px !important; }
.p-3  { padding: 16px !important; }
.p-4  { padding: 22px !important; }
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 4px !important; padding-bottom: 4px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.py-3 { padding-top: 14px !important; padding-bottom: 14px !important; }
.py-4 { padding-top: 22px !important; padding-bottom: 22px !important; }
.px-2 { padding-left: 8px !important; padding-right: 8px !important; }
.px-3 { padding-left: 14px !important; padding-right: 14px !important; }
.px-4 { padding-left: 22px !important; padding-right: 22px !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }

/* Typography */
.fw-bold    { font-weight: 700 !important; }
.fw-semibold{ font-weight: 600 !important; }
.fw-500     { font-weight: 500 !important; }
.fw-normal  { font-weight: 400 !important; }
.fs-5       { font-size: 18px !important; }
.fs-6       { font-size: 15px !important; }

.text-muted    { color: var(--text-secondary) !important; }
.text-primary  { color: var(--text-primary) !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-dark     { color: var(--text-primary) !important; }
.text-white    { color: #fff !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small, small  { font-size: 12.5px !important; }
.lh-sm         { line-height: 1.35 !important; }

/* Size */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

/* Misc */
.rounded          { border-radius: 8px !important; }
.rounded-1        { border-radius: 5px !important; }
.rounded-circle   { border-radius: 50% !important; }
.overflow-hidden  { overflow: hidden !important; }
.overflow-auto    { overflow: auto !important; }
.border           { border: 1px solid var(--border-color) !important; }
.border-top       { border-top: 1px solid var(--border-color) !important; }
.border-bottom    { border-bottom: 1px solid var(--border-color) !important; }
.shadow-sm        { box-shadow: 0 1px 4px rgba(15,23,42,0.08) !important; }
.position-relative { position: relative !important; }
.cursor-pointer   { cursor: pointer; }

/* ──────────────────────────────────────────────
   18. TABLE SORT & PAGINATION
────────────────────────────────────────────── */
.data-table th.th-sort {
    cursor: pointer;
    user-select: none;
}

.data-table th.th-sort::after {
    content: '\00a0\21C5';
    font-size: 9px;
    opacity: 0.3;
    margin-left: 4px;
}

.data-table th.th-sort.asc::after  { content: '\00a0\2191'; opacity: 1; color: var(--accent); }
.data-table th.th-sort.desc::after { content: '\00a0\2193'; opacity: 1; color: var(--accent); }

.pg-hide { display: none !important; }

.table-pg {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    background: var(--body-bg);
}

.table-pg-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pg-select {
    padding: 4px 8px;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    background: var(--card-bg);
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
}

.pg-btn {
    padding: 4px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-primary);
    min-height: 28px;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
    font-weight: 500;
}

.pg-btn:hover:not(:disabled) { background: var(--body-bg); border-color: #94a3b8; }
.pg-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ──────────────────────────────────────────────
   19. USERS PAGE
────────────────────────────────────────────── */
.users-ref-table th.th-sort::after { content: none; }

.th-sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.th-sort-link:hover { color: var(--accent); }
.th-sort-dim { opacity: 0.35; font-size: 11px; }

.users-card-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.users-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--body-bg);
}

.users-search-input { max-width: 280px; min-width: 160px; flex: 1 1 160px; }
.users-table-wrap   { padding: 0; }
.users-ref-table .users-col-actions { width: 1%; white-space: nowrap; text-align: right; }
.users-ref-table td { vertical-align: top; }
.users-row-deleted  { opacity: 0.52; }
.users-email-cell   { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.users-email-line   { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.users-email        { font-weight: 600; color: var(--text-primary); word-break: break-all; }
.users-you-badge    { font-size: 10px; padding: 2px 6px; }
.users-email-meta   { font-size: 12px; line-height: 1.35; }

.role-chip-group     { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.role-chip-group--readonly { gap: 4px; }

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 3px 8px 3px 6px;
    border-radius: 99px;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.role-chip input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.role-chip:hover { border-color: #94a3b8; }

.role-chip.is-on {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.role-chip--admin.is-on   { border-color: var(--danger);  background: var(--danger-light);  color: var(--danger); }
.role-chip--manager.is-on { border-color: var(--warning); background: var(--warning-light); color: var(--warning); }

/* ──────────────────────────────────────────────
   20. DAILY REPORT
────────────────────────────────────────────── */
.daily-shift-strip__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 4px 0;
}

.daily-shift-strip__cell {
    flex: 1 1 100px;
    min-width: 90px;
    text-align: center;
    padding: 12px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    box-shadow: 0 1px 4px rgba(15,23,42,0.04);
}

.daily-shift-strip__label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.daily-shift-strip__value {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.section-heading-rule {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 16px 0 10px;
}

.section-heading-rule::before,
.section-heading-rule::after {
    content: '';
    flex: 1;
    border-bottom: 1.5px solid var(--border-color);
}

.section-heading-rule__text {
    padding: 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ──────────────────────────────────────────────
   21. RESPONSIVE
────────────────────────────────────────────── */

/* Tap-delay fix for all interactive elements */
button, a, input, select, textarea, label, [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ── Phones (<576px): stack all non-prefixed multi-columns ── */
@media (max-width: 575px) {
    .col-6  { flex: 0 0 100%; max-width: 100%; }
    .col-4  { flex: 0 0 100%; max-width: 100%; }
    .col-3  { flex: 0 0 100%; max-width: 100%; }
    .col-8  { flex: 0 0 100%; max-width: 100%; }
}

/* ── Mobile (<768px): comprehensive mobile overhaul ── */
@media (max-width: 767px) {
    :root { --header-height: 56px; }

    /* === LAYOUT === */
    .main-content   { margin-left: 0; margin-top: 56px; }
    .sidebar-collapsed .main-content { margin-left: 0; }
    .content-wrapper { padding: 12px; }

    /* Prevent body scroll when sidebar overlay is open */
    body.sidebar-mobile-open { overflow: hidden; }

    /* === HEADER === */
    .top-header {
        left: 0 !important;
        height: 56px;
        padding: 0 10px;
    }
    .sidebar-collapsed .top-header { left: 0 !important; }
    .header-left { gap: 8px; }
    .header-title-group h1 {
        font-size: 14px;
        max-width: 38vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-datetime { display: none; }
    .user-info { display: none; }
    .header-right { gap: 3px; }
    .header-icon-btn { width: 36px; height: 36px; font-size: 16px; border: none; }
    .user-dropdown-toggle { padding: 4px; border: none; min-height: 36px; gap: 0; }
    .user-avatar { width: 32px; height: 32px; font-size: 11px; }
    .sidebar-toggle { padding: 6px; min-width: 38px; min-height: 38px; }

    /* Dropdowns: full-width overlays on mobile */
    #notifDrop {
        position: fixed !important;
        top: 56px !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 12px;
    }
    #userDropdownMenu {
        position: fixed !important;
        top: 56px !important;
        right: 8px !important;
        left: auto !important;
        width: 200px !important;
        border-radius: 12px;
    }

    /* === CARDS === */
    .card { border-radius: 12px; margin-bottom: 12px; }
    .card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .card-header h2 { font-size: 14px; }
    .card-body { padding: 14px; }
    .card-footer { padding: 10px 14px; font-size: 11.5px; }

    /* Button groups in card headers wrap nicely */
    .card-header .d-flex,
    .card-header > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    .card-header .btn { flex: 1 1 auto; min-width: 0; justify-content: center; }
    .card-header .btn-sm { font-size: 11.5px; padding: 5px 10px; }

    /* === TABLES === */
    .table-responsive {
        margin-left: -14px;
        margin-right: -14px;
        border-radius: 0;
        scrollbar-width: thin;
    }
    .data-table, .table { font-size: 12px; white-space: nowrap; }
    .data-table th, .table th {
        padding: 8px 10px;
        font-size: 10px;
        letter-spacing: 0.4px;
        position: sticky;
        top: 0;
        z-index: 5;
    }
    .data-table td, .table td { padding: 8px 10px; }

    /* Table action buttons */
    .data-table .btn-xs,
    .data-table .btn-sm,
    .table .btn-xs,
    .table .btn-sm {
        padding: 4px 8px;
        min-height: 30px;
        font-size: 11px;
    }

    /* Table pagination */
    .table-pg {
        padding: 8px 12px;
        font-size: 11px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-left: -14px;
        margin-right: -14px;
    }
    .table-pg-right { margin-left: 0; justify-content: space-between; width: 100%; }
    .pg-btn { padding: 6px 14px; min-height: 34px; }
    .pg-select { min-height: 30px; }

    /* === FORMS: 16px font prevents iOS auto-zoom === */
    .form-control, .form-select {
        font-size: 16px;
        min-height: 44px;
        padding: 10px 13px;
        border-radius: 10px;
    }
    .form-control-sm, .form-select-sm {
        font-size: 14px;
        min-height: 38px;
    }
    textarea.form-control { min-height: 70px; }
    .form-group { margin-bottom: 12px; }
    .form-label { font-size: 12px; margin-bottom: 5px; }
    .form-check { min-height: 44px; }
    .form-check input[type="checkbox"],
    .form-check input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    .input-group .form-control { border-radius: 10px 0 0 10px; }
    .input-group-text { border-radius: 0 10px 10px 0; }

    /* === BUTTONS: touch-friendly 44px min === */
    .btn {
        min-height: 42px;
        padding: 9px 16px;
        font-size: 13px;
        border-radius: 10px;
    }
    .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 12px; border-radius: 8px; }
    .btn-xs { min-height: 32px; padding: 5px 9px; font-size: 11px; border-radius: 7px; }

    /* === MODALS === */
    .modal-overlay { padding: 6px; }
    .modal-dialog {
        max-height: min(96vh, calc(100dvh - 12px));
        max-width: 100%;
        border-radius: 14px;
        margin: 0;
    }
    .modal-header { padding: 14px 16px 12px; border-radius: 14px 14px 0 0; }
    .modal-header h3 { font-size: 14px; }
    .modal-close { width: 36px; height: 36px; font-size: 22px; }
    .modal-body { padding: 16px; }
    .modal-body .row { margin-left: -6px; margin-right: -6px; }
    .modal-body .row > * { padding-left: 6px; padding-right: 6px; }
    .modal-footer { padding: 12px 16px; border-radius: 0 0 14px 14px; }
    .modal-footer .btn { flex: 1 1 auto; }

    /* === WELCOME / KPI === */
    .welcome-card { padding: 20px 16px; margin-bottom: 12px; border-radius: 12px; }
    .welcome-card h2 { font-size: 17px; }
    .welcome-card p { font-size: 12.5px; }

    /* === BADGES === */
    .badge { font-size: 10.5px; padding: 2px 7px; }

    /* === ALERTS === */
    .alert { padding: 10px 12px; font-size: 12.5px; border-radius: 8px; }

    /* === AUTH === */
    .auth-card { padding: 28px 20px; border-radius: 16px; }
    .auth-card .auth-logo .auth-brand-icon { width: 48px; height: 48px; font-size: 22px; }
    .auth-card .auth-logo h1 { font-size: 20px; }

    /* === GRID: stack everything === */
    .col-sm-6 { flex: 0 0 100%; max-width: 100%; }
    .col-sm-4 { flex: 0 0 100%; max-width: 100%; }
    .col-sm-3 { flex: 0 0 100%; max-width: 100%; }
    .col-sm-2 { flex: 0 0 100%; max-width: 100%; }
    .col-md-3, .col-md-4, .col-md-5, .col-md-6 { flex: 0 0 100%; max-width: 100%; }

    /* === DAILY REPORT === */
    .daily-shift-strip__inner { gap: 6px 8px; }
    .daily-shift-strip__cell {
        min-width: 0;
        padding: 8px 6px;
        flex: 1 1 calc(50% - 8px);
        border-radius: 8px;
    }
    .daily-shift-strip__label { font-size: 9px; letter-spacing: 0.03em; }
    .daily-shift-strip__value { font-size: 14px; }
    .section-heading-rule { margin: 12px 0 8px; }
    .section-heading-rule__text { font-size: 11px; padding: 0 10px; }

    /* === USERS === */
    .users-toolbar { padding: 10px 12px; }
    .users-search-input { max-width: 100%; min-width: 0; flex: 1 1 100%; }
    .role-chip { font-size: 11px; padding: 4px 8px 4px 6px; }

    /* === TOGGLE SWITCH === */
    .toggle-switch { width: 44px; height: 24px; }

    /* === ERROR PAGE === */
    .error-page { padding: 40px 16px; }
    .error-page .error-code { font-size: 56px; }
    .error-page h2 { font-size: 20px; }

    /* === FOOTER === */
    .app-footer { padding: 12px 14px; font-size: 11px; }
}

/* ── Extra-small phones (<400px) ── */
@media (max-width: 400px) {
    .content-wrapper { padding: 8px; }
    .card-header { padding: 10px 12px; }
    .card-body { padding: 12px; }
    .modal-overlay { padding: 4px; }
    .modal-body { padding: 14px; }

    /* Stack modal columns */
    .modal-body .col-6,
    .modal-body .col-sm-6,
    .modal-body .col-sm-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .header-title-group h1 { max-width: 30vw; font-size: 13px; }
}

/* ── Tablet (768–991px) ── */
@media (min-width: 768px) and (max-width: 991px) {
    .content-wrapper { padding: 20px; }
    .card-header { padding: 14px 18px; }
    .card-body { padding: 18px; }
}

/* ── Desktop (≥992px) ── */
@media (min-width: 992px) {
    .sidebar-collapsed .nav-submenu { display: none !important; max-height: 0 !important; }
}

/* ──────────────────────────────────────────────
   22. UTILITY ALIASES
────────────────────────────────────────────── */
.align-center { align-items: center; }

/* Visually-hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
