/* ── Design Tokens ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --red:           #C0392B;
  --red-dark:      #96281B;
  --red-light:     #FDECEA;
  --red-mid:       #E74C3C;

  --sidebar-bg:    #ffffff;
  --sidebar-hover: #f8fafc;
  --sidebar-active:#C0392B;
  --sidebar-text:  #6b7280;
  --sidebar-head:  #111827;
  --sidebar-width: 240px;

  --bg:            #f8fafc;
  --surface:       #ffffff;
  --surface-2:     #f9fafb;
  --border:        #e5e7eb;
  --border-focus:  #C0392B;

  --text:          #1f2933;
  --text-2:        #374151;
  --text-3:        #6b7280;
  --text-inv:      #ffffff;

  --success:       #1A9B5E;
  --success-light: #E6F7EF;
  --warning:       #D97706;
  --warning-light: #FEF3C7;
  --danger:        #C0392B;
  --danger-light:  #FDECEA;
  --info:          #2563EB;
  --info-light:    #EFF6FF;

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  --shadow-sm:     0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow:        0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:     0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  --topbar-h:      72px;
  --font:          'Inter', system-ui, sans-serif;
  --font-mono:     'IBM Plex Mono', monospace;

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

  /* Department accent — overridden per dept */
  --dept-accent:   #C0392B;
}

/* Flooring uses a warm amber accent so the two depts feel distinct */
body[data-dept="flooring"] {
  --red:        #B7791F;
  --red-dark:   #975A16;
  --red-light:  #FEF5E7;
  --red-mid:    #D69E2E;
  --sidebar-active: #B7791F;
  --border-focus:   #B7791F;
  --danger: #C0392B;
}

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

html { height: 100%; font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: .9rem; font-weight: 600; }
small { font-size: .8rem; color: var(--text-3); }

.mono { font-family: var(--font-mono); }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; } .text-center { text-align: center; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: .8rem; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── App Shell ───────────────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
  transition: transform var(--transition), width var(--transition);
  z-index: 200;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px; border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px; background: var(--red);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; color:#fff;
}
.sidebar-logo-text { flex: 1; }
.sidebar-logo-text .title { font-size: .85rem; font-weight: 700; color: var(--sidebar-head); letter-spacing: .02em; }
.sidebar-logo-text .sub { font-size: .7rem; color: var(--sidebar-text); }

.sidebar-section { padding: 16px 0 4px; }
.sidebar-section-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); padding: 0 16px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  color: var(--sidebar-text); font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent; text-decoration: none; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--red); }
.nav-item.active { background: var(--red-light); color: var(--red); border-left-color: var(--red); }
.nav-item .nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-badge { background: var(--red); color: #fff; font-size: .65rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; }

.sidebar-footer { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar {
  width: 32px; height: 32px; background: var(--red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sidebar-user-info .user-name { font-size: .78rem; font-weight: 600; color: var(--sidebar-head); }
.sidebar-user-info .user-role { font-size: .68rem; color: var(--text-3); text-transform: capitalize; }
.sidebar-logout {
  margin-top: 8px; display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: .78rem; cursor: pointer; width: 100%;
  transition: background var(--transition);
}
.sidebar-logout:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }

/* ── Main Area ───────────────────────────────────────────────────────────── */
#main-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; z-index: 100;
}
#menu-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-2); padding: 4px; border-radius: var(--radius-sm); }
#menu-toggle:hover { background: var(--bg); }
#page-title { font-size: 1rem; font-weight: 600; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-pill { display: flex; align-items: center; gap: 6px; background: var(--red-light); color: var(--red); font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; }

/* ── Content ─────────────────────────────────────────────────────────────── */
#content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Mobile overlay ──────────────────────────────────────────────────────── */
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; }

@media (max-width: 768px) {
  #sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); z-index: 200; }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay.open { display: block; }
  #menu-toggle { display: flex; }
  #content { padding: 16px 12px; }
  #topbar { padding: 0 16px; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; font-family: var(--font); font-size: .82rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1.5px solid transparent; cursor: pointer;
  transition: all var(--transition); white-space: nowrap; line-height: 1; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: .75rem; }
.btn-lg { padding: 11px 22px; font-size: .9rem; }
.btn-full { width: 100%; }
.btn-primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); border-color: var(--red-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--text-3); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--red); }
.stat-card .stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text); font-family: var(--font-mono); margin: 4px 0 2px; }
.stat-card .stat-sub { font-size: .75rem; color: var(--text-3); }
.stat-card .stat-icon { position: absolute; top: 16px; right: 16px; font-size: 1.5rem; opacity: .15; }
.stat-card.low { border-color: var(--warning); } .stat-card.low::before { background: var(--warning); }
.stat-card.empty { border-color: var(--danger); } .stat-card.empty::before { background: var(--danger); }
.stat-card.ok { border-color: var(--success); } .stat-card.ok::before { background: var(--success); }
.stat-card.info { border-color: var(--info); } .stat-card.info::before { background: var(--info); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.form-section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.col-span-2 { grid-column: span 2; } .col-span-3 { grid-column: span 3; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .78rem; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.form-label .req { color: var(--red); }
.form-control {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .85rem; color: var(--text); background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition); width: 100%;
}
.form-control:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.form-control:disabled { background: var(--bg); color: var(--text-3); cursor: not-allowed; }
.form-control.error { border-color: var(--danger); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .73rem; color: var(--text-3); }
.form-error { font-size: .73rem; color: var(--danger); font-weight: 500; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.radio-option { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: .82rem; font-weight: 500; transition: all var(--transition); }
.radio-option input[type=radio] { accent-color: var(--red); }
.radio-option:has(input:checked) { border-color: var(--red); background: var(--red-light); color: var(--red); }
.file-upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: all var(--transition); background: var(--surface-2); }
.file-upload-area:hover, .file-upload-area.dragover { border-color: var(--red); background: var(--red-light); }
.file-upload-area .upload-icon { font-size: 1.5rem; margin-bottom: 6px; }
.file-upload-area .upload-text { font-size: .8rem; color: var(--text-3); }
.file-upload-area .upload-name { font-size: .8rem; font-weight: 600; color: var(--red); margin-top: 6px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: .82rem; font-weight: 500; border: 1px solid; }
.alert-warning { background: var(--warning-light); border-color: #FDE68A; color: #92400E; }
.alert-danger  { background: var(--danger-light);  border-color: #FECACA; color: var(--red-dark); }
.alert-success { background: var(--success-light); border-color: #A7F3D0; color: #065F46; }
.alert-info    { background: var(--info-light);    border-color: #BFDBFE; color: #1E40AF; }
.alert-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
table.erp-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.erp-table thead th { background: var(--surface-2); color: var(--text-3); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.erp-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
.erp-table tbody tr:last-child { border-bottom: none; }
.erp-table tbody tr:hover { background: var(--surface-2); }
.erp-table td { padding: 11px 14px; color: var(--text); vertical-align: middle; }
.erp-table td.mono { font-family: var(--font-mono); font-size: .78rem; }
.erp-table .actions { display: flex; gap: 6px; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-blue { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
.badge-admin { background: #1a1a2e; color: #a8abbe; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s ease; }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; animation: slideUp .18s ease; }
.modal-lg { max-width: 780px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; background: var(--bg); border-radius: var(--radius-sm); cursor: pointer; font-size: 1.1rem; color: var(--text-3); transition: all var(--transition); }
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 340px; width: 100%; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--border); border-left: 4px solid; font-size: .82rem; animation: slideLeft .2s ease; cursor: pointer; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg { flex: 1; font-weight: 500; }
.toast-close { color: var(--text-3); font-size: .8rem; cursor: pointer; }
@keyframes slideLeft { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); font-size: .78rem; }
.page-btn { min-width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; font-size: .78rem; transition: all var(--transition); }
.page-btn:hover { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { padding: 0 12px; color: var(--text-3); }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 1.3rem; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Loading Spinner ─────────────────────────────────────────────────────── */
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; justify-content: center; padding: 48px 0; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* ── Table Toolbar ───────────────────────────────────────────────────────── */
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; flex-wrap: wrap; }
.table-search { flex: 1; min-width: 200px; position: relative; }
.table-search input { padding: 7px 12px 7px 34px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .82rem; width: 100%; transition: border-color var(--transition); }
.table-search input:focus { outline: none; border-color: var(--red); }
.table-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: .85rem; }

/* ── Inline Expand Panel ─────────────────────────────────────────────────── */
.inline-panel { background: var(--surface-2); border: 1.5px solid var(--red); border-radius: var(--radius); padding: 16px; margin-top: 8px; }
.inline-panel-title { font-size: .78rem; font-weight: 700; color: var(--red); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .06em; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .modal { border-radius: var(--radius-lg); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .radio-group { flex-direction: column; }
}
@media (max-width: 400px) { .stat-grid { grid-template-columns: 1fr; } }

/* ── App Modules Grid ────────────────────────────────────────────────────── */
.welcome-header { margin-bottom: 32px; }
.welcome-header h1 { font-size: 1.8rem; color: var(--text); margin: 0 0 4px 0; letter-spacing: -0.5px; }
.welcome-header p { font-size: .95rem; color: var(--text-3); margin: 0; }
.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.module-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 20px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-focus); }
.card-icon-bg { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.card-content h3 { margin: 0 0 8px 0; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.card-content p { margin: 0; font-size: .85rem; color: var(--text-3); line-height: 1.5; min-height: 42px; }
.sub-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.action-tile { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; transition: all 0.2s; }
.action-tile:hover { background: var(--bg); border-color: var(--red); }
.tile-icon { color: var(--text-3); display: flex; align-items: center; }
.action-tile:hover .tile-icon { color: var(--red); }
.tile-text { display: flex; flex-direction: column; }
.tile-text strong { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.tile-text span { font-size: .65rem; color: var(--text-3); }

/* ════════════════════════════════════════════════════════════════════════
   EXTENSIONS for vijob2 — dept switcher, timeline, dashboard, login
   ════════════════════════════════════════════════════════════════════════ */

/* Department switcher pill in topbar */
.dept-switch { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px; }
.dept-switch button { border: none; background: transparent; padding: 5px 14px; border-radius: 99px; font-size: .76rem; font-weight: 600; cursor: pointer; color: var(--text-3); transition: all var(--transition); font-family: var(--font); }
.dept-switch button.active { background: var(--red); color: #fff; }
.dept-switch button:hover:not(.active) { color: var(--red); }
.dept-switch button:disabled { opacity:.4; cursor:not-allowed; }

/* Login page */
#login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #f8fafc 0%, #fdecea 100%); padding: 20px; }
.login-card { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 400px; }
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-logo img { height: 56px; object-fit: contain; }
.login-logo h1 { font-size: 1.3rem; text-align: center; }
.login-logo p { font-size: .8rem; color: var(--text-3); }

/* Timeline (job details) */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-dot { position: absolute; left: -24px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--red-light); }
.timeline-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.timeline-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-date { font-weight: 700; font-size: .82rem; }
.timeline-time { font-size: .72rem; color: var(--text-3); }
.timeline-user { font-size: .72rem; color: var(--text-3); margin-left: auto; }
.status-badge { background: var(--red-light); color: var(--red); padding: 2px 8px; border-radius: 99px; font-size: .68rem; font-weight: 700; }
.badge-latest { background: var(--success); color: #fff; padding: 2px 8px; border-radius: 99px; font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.timeline-chips { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.timeline-chip { background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 99px; font-size: .7rem; color: var(--text-2); }
.timeline-chip strong { color: var(--text-3); margin-right: 3px; }
.timeline-comment { margin-top: 8px; font-style: italic; color: var(--text-2); font-size: .8rem; }
.timeline-empty { color: var(--text-3); padding: 24px; text-align: center; }

/* Dashboard charts */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin-top: 20px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.chart-card h3 { margin-bottom: 16px; font-size: .95rem; }
.chart-canvas-wrap { position: relative; height: 280px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { width: 130px; font-size: .76rem; color: var(--text-2); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; background: var(--surface-2); border-radius: 99px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--red); border-radius: 99px; transition: width .4s ease; }
.bar-value { width: 44px; font-size: .76rem; font-weight: 700; font-family: var(--font-mono); color: var(--text-2); }

/* Quote linked banner */
.quote-link-card { background: var(--red-light); border: 1px solid var(--red); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }

.accessory-item { display: grid; grid-template-columns: 1fr 110px 130px; gap: 10px; align-items: center; margin-bottom: 8px; }
.accessory-item label { font-size: .82rem; color: var(--text-2); }
@media (max-width: 640px) { .accessory-item { grid-template-columns: 1fr; } }
