@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Site Green — the sidebar / brand surfaces (Mas Construction) */
    --ink: #0b3d24;
    --ink-2: #0f4c2d;
    --ink-3: #145c37;
    --ink-line: rgba(255, 255, 255, 0.1);
    --ink-line-strong: rgba(255, 255, 255, 0.18);

    /* Paper — the working surface: crisp white, construction-clean */
    --paper: #f4f8f5;
    --surface: #ffffff;
    --line: #e0e8e2;
    --line-soft: #edf2ee;

    /* Ink text on paper */
    --text: #10201a;
    --text-soft: #55655c;
    --text-faint: #8a9990;

    /* Leaf green — the one accent, spent deliberately (Mas Construction green) */
    --leaf: #159848;
    --leaf-light: #3ecb72;
    --leaf-dark: #0c6e34;
    --leaf-wash: #e6f7ec;
    --safety: #f5a623;
    --safety-wash: #fdf1dc;

    /* Muted status palette (no candy colors) */
    --st-pending: #a06a1f;
    --st-pending-bg: #f7ecd9;
    --st-approved: #2c5490;
    --st-approved-bg: #e4ebf4;
    --st-ongoing: #6a4f96;
    --st-ongoing-bg: #eae4f3;
    --st-completed: #226b52;
    --st-completed-bg: #dfeee7;
    --st-expired: #a13f3f;
    --st-expired-bg: #f5e2e2;
    --st-cancelled: #666b76;
    --st-cancelled-bg: #eaebee;

    --shadow-sm: 0 1px 2px rgba(11, 61, 36, 0.06);
    --shadow-md: 0 6px 20px rgba(11, 61, 36, 0.09);
    --shadow-lg: 0 16px 40px rgba(11, 61, 36, 0.14);
    --shadow-xl: 0 24px 64px rgba(11, 61, 36, 0.24);

    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 7px;

    --topbar-h: 60px;
    --sidebar-w: 258px;
    --sidebar-w-collapsed: 76px;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    font-size: 0.925rem;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(21, 152, 72, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(21, 152, 72, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
    background-attachment: fixed;
}

a { text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

::selection {
    background: var(--leaf-wash);
    color: var(--leaf-dark);
}

/* ============ Mobile Topbar ============ */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 1040;
    height: var(--topbar-h);
    background: var(--ink);
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 0.5rem;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--ink-line);
}

.mobile-topbar .topbar-brand {
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    letter-spacing: 0.01em;
}

.mobile-topbar .topbar-logo {
    height: 26px;
    width: auto;
    background: #fff;
    border-radius: 6px;
    padding: 2px 4px;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ink-line);
    color: #eceef2;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s ease;
}

.sidebar-toggle-btn:active {
    background: rgba(255, 255, 255, 0.14);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12, 14, 18, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1045;
    opacity: 0;
    transition: opacity 0.25s ease;
}

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

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ink-line);
    color: #eceef2;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ============ Sidebar ============ */
.sidebar {
    min-height: 100vh;
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    flex-shrink: 0;
    background:
        radial-gradient(circle at 100% 0%, rgba(62, 203, 114, 0.22) 0%, transparent 45%),
        linear-gradient(190deg, var(--ink-3) 0%, var(--ink) 65%);
    padding: 0;
    position: sticky;
    top: 0.85rem;
    height: calc(100vh - 1.7rem);
    margin: 0.85rem 0 0.85rem 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    transition: width 0.22s ease, max-width 0.22s ease, flex-basis 0.22s ease;
}

/* A quiet nod to the job site — a thin safety-stripe seam along the
   sidebar's top edge instead of a plain line. */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    border-radius: 20px 20px 0 0;
    background: repeating-linear-gradient(
        115deg,
        var(--leaf-light) 0px, var(--leaf-light) 10px,
        var(--safety) 10px, var(--safety) 20px
    );
    opacity: 0.9;
}

.sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
    max-width: var(--sidebar-w-collapsed);
    flex: 0 0 var(--sidebar-w-collapsed);
}

.sidebar-brand {
    padding: 1.6rem 1.35rem 1.3rem;
    border-bottom: 1px solid var(--ink-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.sidebar-brand .brand-mark {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    overflow: hidden;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: 1px solid var(--ink-line-strong);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--leaf-light);
    font-size: 1.05rem;
    background: #fff;
    padding: 4px;
}

.sidebar-brand .brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand h4 {
    font-size: 1.08rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    line-height: 1.15;
    font-family: var(--font-display);
}

.sidebar-brand .brand-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--leaf-light);
    margin-top: 1px;
}

.sidebar.collapsed .sidebar-brand .brand-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .sidebar-user .user-text,
.sidebar.collapsed .sidebar-collapse-btn span {
    display: none;
}

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

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.68rem;
}

.sidebar.collapsed .sidebar-nav a i {
    margin: 0;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 1rem 0;
}

.sidebar-nav {
    padding: 1.1rem 0.9rem;
    flex-grow: 1;
}

.sidebar-section-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #a9cdb6;
    padding: 0.9rem 0.75rem 0.4rem;
    white-space: nowrap;
}

.sidebar-nav a {
    color: #cfe6da;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 11px;
    font-size: 0.87rem;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    white-space: nowrap;
    position: relative;
}

.sidebar-nav a i {
    font-size: 0.95rem;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    opacity: 0.85;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d9534f;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 4px;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-dark) 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(11, 61, 36, 0.35);
}

.sidebar-nav a.active i {
    opacity: 1;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-nav a.active:hover { transform: none; }

.sidebar-nav hr {
    border-color: var(--ink-line);
    margin: 0.65rem 0.75rem;
}

.sidebar-user {
    padding: 1rem 1.35rem;
    border-top: 1px solid var(--ink-line);
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-user .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ink-3);
    border: 1px solid var(--ink-line-strong);
    color: var(--leaf-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    font-family: var(--font-display);
}

.sidebar-user .user-name {
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-user .user-role {
    color: #9dc4ac;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
}

.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: transparent;
    border: none;
    border-top: 1px solid var(--ink-line);
    color: #9dc4ac;
    padding: 0.85rem 1.35rem;
    font-size: 0.78rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: color 0.15s ease;
}

.sidebar-collapse-btn:hover {
    color: #eafaf0;
}

.sidebar.collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 0.85rem 0;
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* Neutralize Bootstrap's container/row gutters so the sidebar sits flush
   and .content's own padding is the only spacing in effect. */
.container-fluid:has(> .row > #appSidebar) {
    padding: 0;
}

.row:has(> #appSidebar) {
    margin: 0;
    min-height: 100vh;
}

/* ============ Content area ============ */
.content {
    padding: 2rem 2.5rem 3rem;
    min-height: 100vh;
    flex: 1 1 0% !important;
    flex-grow: 1 !important;
    max-width: 100% !important;
    width: auto !important;
    min-width: 0;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: linear-gradient(120deg, var(--ink) 0%, var(--ink-3) 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.8rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.page-header::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -6%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(62, 203, 114, 0.35), transparent 70%);
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #ffffff;
    position: relative;
}

.page-header p {
    color: #cfe6da;
    margin: 0;
    font-size: 0.88rem;
    position: relative;
}

.content > h2,
.content > h1 {
    font-size: 1.7rem;
    font-weight: 600;
    margin-bottom: 1.6rem;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--line);
    padding-bottom: 1.1rem;
}

/* ============ Stat cards ============ */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.4rem 1.2rem;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px) scale(1.015);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

a.stat-card {
    display: block;
    color: inherit;
    text-decoration: none;
}

a.stat-card:hover {
    text-decoration: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--leaf);
}

.stat-card.stat-pending::before { background: var(--st-pending); }
.stat-card.stat-approved::before { background: var(--st-approved); }
.stat-card.stat-ongoing::before { background: var(--st-ongoing); }
.stat-card.stat-completed::before { background: var(--st-completed); }
.stat-card.stat-expired::before { background: var(--st-expired); }

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 1.1rem;
    background: linear-gradient(135deg, var(--leaf-wash), var(--leaf-wash) 60%, #fff);
    color: var(--leaf-dark);
    transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }

.stat-pending .stat-icon { background: linear-gradient(135deg, var(--st-pending-bg), #fff); color: var(--st-pending); }
.stat-approved .stat-icon { background: linear-gradient(135deg, var(--st-approved-bg), #fff); color: var(--st-approved); }
.stat-ongoing .stat-icon { background: linear-gradient(135deg, var(--st-ongoing-bg), #fff); color: var(--st-ongoing); }
.stat-completed .stat-icon { background: linear-gradient(135deg, var(--st-completed-bg), #fff); color: var(--st-completed); }
.stat-expired .stat-icon { background: linear-gradient(135deg, var(--st-expired-bg), #fff); color: var(--st-expired); }

.stat-card .stat-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.35rem;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ============ Panel cards ============ */
.panel-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* Only stretch to match a sibling's height when placed side-by-side inside
   a grid row (e.g. two search panels in col-md-6s) — never by default,
   otherwise a short standalone panel inherits the full page height from
   .content (which itself gets a definite height via the sidebar's flex
   stretch) and leaves a large empty gap below it. */
/* Fix: Prevents the card container from stretching to the full content row height */
.row:has(> [class*="col-"] > .panel-card) {
  align-items: flex-start;
}

.row > [class*="col-"] > .panel-card {
  width: 100%;
  height: auto;
}


.panel-card .panel-header {
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: linear-gradient(180deg, #fafafb, #ffffff);
}

.panel-card .panel-header i {
    font-size: 1.05rem;
    color: var(--leaf);
}

.panel-card .panel-header h5 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
    font-family: var(--font-body);
}

.panel-card .panel-body {
    padding: 1.5rem;
}

.panel-card .panel-body p {
    color: var(--text-soft);
    font-size: 0.87rem;
    margin-bottom: 1rem;
}

/* ============ Generic Bootstrap card polish ============ */
.card {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm) !important;
}

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

.card-header {
    background: linear-gradient(180deg, #fafafb, #ffffff);
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-family: var(--font-body);
    padding: 1.05rem 1.4rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-body {
    padding: 1.4rem;
}

.card-body h5,
.card-body h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    font-family: var(--font-body);
}

/* ============ Form controls ============ */
.form-select,
.form-control,
textarea.form-control,
select.form-control,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"] {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: 0.6rem 0.85rem;
    font-size: 0.87rem;
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s, padding 0.2s, font-size 0.2s;
}

.form-select.has-value,
.form-control.has-value,
textarea.form-control.has-value,
select.form-control.has-value,
input[type="text"].has-value,
input[type="password"].has-value,
input[type="number"].has-value,
input[type="date"].has-value {
    padding: 0.4rem 0.7rem;
    font-size: 0.82rem;
}

label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-bottom: 0.4rem;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auto-pad-number {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: calc(1.5em + 1.4rem + 2px);
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--leaf-wash);
    border: 1px dashed var(--leaf);
    color: var(--leaf-dark);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
}

.auto-pad-number i { font-size: 0.95rem; }

.form-select:focus,
.form-control:focus {
    border-color: var(--leaf);
    box-shadow: 0 0 0 3px var(--leaf-wash);
    outline: none;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.58rem 1.3rem;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--leaf) 0%, var(--ink) 130%);
    border-color: var(--ink);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--leaf-dark) 0%, var(--ink-2) 130%);
    border-color: var(--ink-2);
    color: var(--leaf-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--st-completed);
    border-color: var(--st-completed);
}
.btn-success:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--leaf);
    border-color: var(--leaf);
    color: #fff;
}
.btn-warning:hover { color: #fff; background: var(--leaf-dark); transform: translateY(-1px); }

.btn-danger {
    background: var(--st-expired);
    border-color: var(--st-expired);
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text-soft);
}
.btn-secondary:hover { background: var(--paper); color: var(--text); transform: translateY(-1px); }

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

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.87rem;
    font-weight: 500;
}
.alert-danger { background: var(--st-expired-bg); color: var(--st-expired); border-color: #ecd3d3; }
.alert-success { background: var(--st-completed-bg); color: var(--st-completed); border-color: #d3e6dc; }
.alert-warning { background: var(--st-pending-bg); color: var(--st-pending); border-color: #efdcb8; }
.alert-info { background: var(--st-approved-bg); color: var(--st-approved); border-color: #d3e0ee; }

/* ============ Report section ============ */
.report-section {
    margin-top: 2rem;
    animation: fadeIn 0.4s ease;
}

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

.report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.report-header h4 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-header .site-badge {
    background: var(--ink);
    color: var(--leaf-light);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ============ Tables (custom + generic Bootstrap) ============ */
.table-modern {
    margin: 0;
    font-size: 0.87rem;
}

.table-modern thead th {
    background: #fafafb;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 0.9rem 1.1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
}

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

.table-modern tbody tr:hover {
    background: #fafafb;
}

.table-modern .item-name {
    font-weight: 600;
}

.table-modern .item-spec {
    color: var(--text-faint);
    font-size: 0.8rem;
}

/* Generic bootstrap tables get the same refined look automatically */
table.table {
    font-size: 0.87rem;
    margin: 0;
}

table.table thead th,
table.table tr:first-child th {
    background: #fafafb;
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.9rem 1.1rem;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}

table.table td {
    padding: 0.82rem 1.1rem;
    vertical-align: middle;
    border-color: var(--line-soft) !important;
}

table.table.table-striped tbody tr:nth-of-type(odd) {
    background-color: #fafafb;
}

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

.card-body,
.panel-body,
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.card-body table,
.panel-body table {
    min-width: 560px;
}

/* Status badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pending { background: var(--st-pending-bg); color: var(--st-pending); }
.badge-approved { background: var(--st-approved-bg); color: var(--st-approved); }
.badge-ongoing { background: var(--st-ongoing-bg); color: var(--st-ongoing); }
.badge-completed { background: var(--st-completed-bg); color: var(--st-completed); }
.badge-expired { background: var(--st-expired-bg); color: var(--st-expired); }
.badge-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled); }

.badge-sent { background: var(--st-pending-bg); color: var(--st-pending); }
.badge-received { background: var(--st-completed-bg); color: var(--st-completed); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-faint);
}

.empty-state i {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

/* Section divider */
.section-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.75rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--leaf);
    font-size: 0.95rem;
}

/* Quantity highlight */
.qty-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.qty-low {
    color: var(--st-expired);
}

.allocate-quantity-input.qty-exceeded {
    border-color: var(--st-expired) !important;
    background-color: var(--st-expired-bg) !important;
}

.allocate-quantity-input.qty-exceeded:focus {
    box-shadow: 0 0 0 3px rgba(161, 63, 63, 0.15) !important;
}

.days-badge {
    display: inline-block;
    background: var(--paper);
    color: var(--text-soft);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.76rem;
    font-family: var(--font-mono);
}

.qty-free {
    color: var(--st-completed);
    font-weight: 700;
    font-family: var(--font-mono);
}

.qty-in-use {
    color: var(--st-pending);
    font-weight: 700;
    font-family: var(--font-mono);
}

.days-left-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.days-left-free {
    background: var(--st-completed-bg);
    color: var(--st-completed);
}

.days-left-active {
    background: var(--st-approved-bg);
    color: var(--st-approved);
}

.days-left-soon {
    background: var(--st-pending-bg);
    color: var(--st-pending);
}

/* Duration badges for fixed asset items */
.duration-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
    margin-top: 0.5rem;
}

.duration-free {
    background: var(--st-completed-bg);
    color: var(--st-completed);
    border: 1px solid var(--st-completed);
}

.duration-waiting {
    background: var(--st-ongoing-bg);
    color: var(--st-ongoing);
    border: 1px solid var(--st-ongoing);
}

.duration-free-pill {
    background: var(--st-completed-bg);
    color: var(--st-completed);
    border: 1px solid var(--st-completed);
}

.duration-waiting-pill {
    background: var(--st-ongoing-bg);
    color: var(--st-ongoing);
    border: 1px solid var(--st-ongoing);
}

.days-left-today {
    background: var(--st-expired-bg);
    color: var(--st-expired);
}

.stock-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
    display: flex;
    margin-top: 0.4rem;
}

.stock-bar-in-use {
    background: var(--leaf);
    height: 100%;
}

.stock-bar-free {
    background: var(--st-completed);
    height: 100%;
}

.usage-detail-row td {
    background: #fafafb !important;
    padding: 0 !important;
}

.usage-detail-inner {
    padding: 1rem 1.4rem 1.4rem;
}

.usage-detail-inner h6 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 0.75rem;
}

.usage-mini-table {
    width: 100%;
    font-size: 0.82rem;
}

.usage-mini-table th {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.66rem;
    text-transform: uppercase;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--line);
}

.usage-mini-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--line-soft);
    background: #fff;
}

.item-header-card {
    background: var(--ink);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.75rem;
    margin-bottom: 1.75rem;
    border: 1px solid var(--ink-line);
    position: relative;
    overflow: hidden;
}

.item-header-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 40%;
    background: radial-gradient(circle at top right, rgba(62, 203, 114, 0.18), transparent 70%);
    pointer-events: none;
}

.item-header-card h2 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    color: #ffffff;
}

.item-header-card p {
    margin: 0;
    opacity: 0.75;
    font-size: 0.87rem;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--ink-line);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    font-weight: 500;
    margin-right: 0.5rem;
    margin-top: 0.85rem;
}

/* ============ Auth / login page ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 15% 15%, rgba(62, 203, 114, 0.14) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(62, 203, 114, 0.08) 0%, transparent 45%),
        linear-gradient(160deg, var(--ink) 0%, var(--ink-3) 100%);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2.25rem;
    animation: fadeIn 0.5s ease;
    border-top: 3px solid var(--leaf);
}

.auth-logo {
    width: 84px;
    height: 84px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.35rem;
    box-shadow: var(--shadow-md);
    padding: 8px;
}

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

.auth-card h3 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-soft);
    font-size: 0.84rem;
    margin-bottom: 1.85rem;
}

.auth-card .btn-primary {
    padding: 0.72rem 1.25rem;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.92rem;
}

.input-icon-wrap input {
    padding-left: 2.5rem;
}

/* ============ Mobile responsiveness ============ */
@media (max-width: 991.98px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 82vw;
        flex-basis: auto;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }

    .sidebar::after {
        border-radius: 0;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 280px;
        max-width: 82vw;
    }

    .sidebar.collapsed .sidebar-brand .brand-text,
    .sidebar.collapsed .sidebar-section-label,
    .sidebar.collapsed .sidebar-nav a span,
    .sidebar.collapsed .sidebar-user .user-text {
        display: revert;
    }

    .sidebar.collapsed .sidebar-nav a {
        justify-content: flex-start;
        padding: 0.62rem 0.75rem;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar-close-btn {
        display: flex;
    }

    .content {
        padding: 1.4rem 1.1rem 2rem;
    }

    .content > h2,
    .content > h1 {
        font-size: 1.4rem;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }
}

@media (max-width: 575.98px) {
    .card-body,
    .panel-body {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.65rem;
    }

    .stat-card {
        padding: 1rem 1.1rem;
    }

    .btn {
        font-size: 0.82rem;
    }

    .row > [class*="col-md-3"]:has(.stat-card),
    .row > [class*="col-md-4"]:has(.stat-card) {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .auth-card {
        padding: 1.85rem 1.4rem;
    }
}

/* ============ End-to-end transfer tracker (Manager view) ============ */
.tracker-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-bottom: 1.1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

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

.tracker-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.35rem;
    background: linear-gradient(180deg, var(--leaf-wash), #fff);
    border-bottom: 1px solid var(--line);
}

.tracker-card-head .tracker-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.tracker-card-head .tracker-pad-number {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--ink);
}

.tracker-card-head .tracker-route {
    font-size: 0.82rem;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tracker-card-head .tracker-route i { color: var(--leaf); }

.tracker-card-body {
    padding: 1.35rem 1.6rem 1.1rem;
}

.tracker-steps {
    display: flex;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 0.4rem;
}

.tracker-step {
    flex: 1;
    text-align: center;
    position: relative;
    min-width: 0;
    padding: 0 4px;
}

.tracker-step .step-line {
    position: absolute;
    top: 15px;
    left: -50%;
    width: 100%;
    height: 3px;
    background: var(--line);
    z-index: 0;
}

.tracker-step:first-child .step-line { display: none; }

.tracker-step.done .step-line,
.tracker-step.active .step-line { background: var(--leaf); }

.tracker-step .step-dot {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 3px solid var(--line);
    color: var(--text-faint);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tracker-step.done .step-dot {
    background: var(--leaf);
    border-color: var(--leaf);
    color: #fff;
}

.tracker-step.active .step-dot {
    background: #fff;
    border-color: var(--leaf);
    color: var(--leaf);
    box-shadow: 0 0 0 4px var(--leaf-wash);
    animation: pulseStep 1.8s ease-in-out infinite;
}

.tracker-step.rejected .step-dot {
    background: var(--st-expired);
    border-color: var(--st-expired);
    color: #fff;
}

@keyframes pulseStep {
    0%, 100% { box-shadow: 0 0 0 4px var(--leaf-wash); }
    50% { box-shadow: 0 0 0 7px var(--leaf-wash); }
}

.tracker-step .step-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    line-height: 1.25;
}

.tracker-step.pending .step-label { color: var(--text-faint); font-weight: 500; }

.tracker-step .step-meta {
    font-size: 0.7rem;
    color: var(--text-faint);
    margin-top: 0.15rem;
    line-height: 1.3;
}

.tracker-step .step-pad {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--leaf-dark);
    margin-top: 0.1rem;
}

@media (max-width: 767.98px) {
    .tracker-steps { flex-wrap: wrap; row-gap: 1.4rem; }
    .tracker-step { flex: 0 0 33.33%; }
    .tracker-step .step-line { display: none; }
}

/* Force the card to fit only its content and stop stretching */
.panel-card {
  height: auto !important;
  align-self: flex-start !important;
}
