/* ═══════════════════════════════════════════════════════
   CleanOps — Design System
   Theme: Industrial Clarity — dark sidebar, clean white content
   Font: DM Sans + DM Mono
═══════════════════════════════════════════════════════ */

:root {
  --brand:       #1a3c5e;
  --brand-light: #2458883;
  --brand-2:     #2e7d32;
  --accent:      #00c8a0;
  --bg:          #f1f4f8;
  --surface:     #ffffff;
  --border:      #e5e9f0;
  --text:        #1e2535;
  --muted:       #7a8499;
  --sidebar-w:   260px;
  --sidebar-bg:  #111827;
  --topbar-h:    60px;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,.07);
  --shadow-md:   0 4px 24px rgba(0,0,0,.10);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccd0da; border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width .25s ease;
  z-index: 1000;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .sidebar-nav { padding: 12px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 70px;
}
.brand-icon {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #0098a8);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: #fff; display: block; }
.brand-tagline { font-size: 11px; color: rgba(255,255,255,.4); display: block; text-transform: uppercase; letter-spacing: .6px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: rgba(255,255,255,.3); padding: 0 8px; display: block; margin-bottom: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 7px;
  color: rgba(255,255,255,.6); text-decoration: none;
  font-size: 13.5px; font-weight: 500; transition: all .15s;
  margin-bottom: 2px; position: relative;
}
.nav-item i { font-size: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(0,200,160,.15); color: var(--accent); }
.nav-item.active i { color: var(--accent); }
.nav-badge { margin-left: auto; background: #dc3545; color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px;
}
.user-card {
  flex: 1; display: flex; align-items: center; gap: 10px;
  text-decoration: none; min-width: 0;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-name { color: #fff; font-size: 13px; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); display: block; }
.logout-btn { color: rgba(255,255,255,.4); padding: 6px 8px; border-radius: 6px; text-decoration: none; font-size: 18px; transition: .15s; }
.logout-btn:hover { color: #ff5f5f; background: rgba(255,95,95,.1); }

/* ══════════════════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sidebar-w);
  transition: margin-left .25s ease;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.main-wrap.expanded { margin-left: 64px; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 99;
}
.sidebar-toggle { background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.sidebar-toggle:hover { background: var(--bg); }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: #dc3545; border-radius: 50%; border: 2px solid white; }

.flash-wrap { padding: 12px 24px 0; }
.page-content { flex: 1; padding: 20px 24px 40px; }

/* ══════════════════════════════════════════════════════
   CARDS & PANELS
══════════════════════════════════════════════════════ */
.card-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-header h5 { font-size: 14px; font-weight: 700; margin: 0; }

/* ── Stat Cards ────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
}
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; font-family: 'DM Mono', monospace; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.stat-blue  .stat-icon { background: #e8f0fe; color: #2563eb; }
.stat-green .stat-icon { background: #e8f5e9; color: #2e7d32; }
.stat-orange .stat-icon { background: #fff3e0; color: #e65100; }
.stat-yellow .stat-icon { background: #fffde7; color: #f57f17; }
.stat-purple .stat-icon { background: #f3e8ff; color: #7c3aed; }
.stat-teal   .stat-icon { background: #e0f7fa; color: #00838f; }
.stat-red    .stat-icon { background: #ffebee; color: #c62828; }

/* ── Job List ──────────────────────────────────────── */
.job-list { display: flex; flex-direction: column; }
.job-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); transition: .15s;
}
.job-row:last-child { border-bottom: none; }
.job-row:hover { background: var(--bg); }
.job-num { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.job-num-sm { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }
.job-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.job-meta { font-size: 12px; color: var(--muted); }
.date-chip { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ── Status Badges ─────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
  white-space: nowrap;
}
.status-draft       { background: #f0f0f0; color: #666; }
.status-scheduled   { background: #e3f2fd; color: #1565c0; }
.status-assigned    { background: #e8eaf6; color: #3949ab; }
.status-in_progress { background: #fff8e1; color: #f57f17; }
.status-pending_l1  { background: #fff3e0; color: #e65100; }
.status-pending_l2  { background: #fce4ec; color: #880e4f; }
.status-pending_l3  { background: #f3e5f5; color: #6a1b9a; }
.status-approved    { background: #e8f5e9; color: #1b5e20; }
.status-completed   { background: #e8f5e9; color: #1b5e20; }
.status-rejected    { background: #ffebee; color: #b71c1c; }
.status-cancelled   { background: #f5f5f5; color: #9e9e9e; }

/* ── Priority ──────────────────────────────────────── */
.priority-badge {
  display: inline-flex; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.priority-badge.priority-urgent { background: #ffebee; color: #c62828; }
.priority-badge.priority-high   { background: #fff3e0; color: #e65100; }
.priority-badge.priority-medium { background: #fffde7; color: #f57f17; }
.priority-badge.priority-low    { background: #f1f8e9; color: #558b2f; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.priority-dot.priority-urgent { background: #dc3545; }
.priority-dot.priority-high   { background: #fd7e14; }
.priority-dot.priority-medium { background: #ffc107; }
.priority-dot.priority-low    { background: #28a745; }

/* ── Role Badge ────────────────────────────────────── */
.role-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.role-superadmin { background: #111827; color: #fff; }
.role-admin      { background: #1a3c5e; color: #fff; }
.role-manager    { background: #4a148c; color: #fff; }
.role-supervisor { background: #01579b; color: #fff; }
.role-cleaner    { background: #1b5e20; color: #fff; }
.role-client     { background: #e65100; color: #fff; }
.badge-role-superadmin,.badge-role-admin { color: var(--accent); }
.badge-role-manager,.badge-role-supervisor { color: #81d4fa; }
.badge-role-cleaner,.badge-role-client { color: #a5d6a7; }

/* ── Detail Grid ───────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; padding: 0 20px 8px; }
.detail-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.detail-item .label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.detail-item .value { font-size: 13.5px; color: var(--text); }
.notes-block { padding: 14px 16px; background: #f8fafc; border-left: 3px solid var(--brand); border-radius: 0 6px 6px 0; margin: 0 20px 16px; }
.notes-block.notes-danger { background: #fff5f5; border-left-color: #dc3545; }
.notes-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }

/* ── Approval Pipeline ─────────────────────────────── */
.pipeline { padding: 16px 20px; }
.pipe-step { display: flex; align-items: flex-start; gap: 12px; }
.pipe-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; border: 2px solid var(--border); background: var(--surface); }
.pipe-title { font-size: 13px; font-weight: 600; }
.pipe-sub { font-size: 11px; color: var(--muted); }
.pipe-comment { font-size: 11px; color: #dc3545; font-style: italic; margin-top: 2px; }
.pipe-connector { width: 2px; height: 22px; background: var(--border); margin: 2px 0 2px 17px; }
.pipe-wait    .pipe-icon { border-color: var(--border); color: var(--muted); background: var(--bg); }
.pipe-pending .pipe-icon { border-color: #f57f17; color: #f57f17; background: #fffde7; }
.pipe-approved .pipe-icon { border-color: #2e7d32; color: #2e7d32; background: #e8f5e9; }
.pipe-rejected .pipe-icon { border-color: #c62828; color: #c62828; background: #ffebee; }
.pipe-done    .pipe-icon { border-color: #2e7d32; color: #2e7d32; background: #e8f5e9; }

/* ── Activity ──────────────────────────────────────── */
.activity-list { padding: 8px 20px 12px; max-height: 300px; overflow-y: auto; }
.activity-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 5px; }
.activity-desc { font-size: 12.5px; color: var(--text); }
.activity-time { font-size: 11px; color: var(--muted); }

/* ── Checklist ─────────────────────────────────────── */
.checklist-list { padding: 8px 20px 16px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.check-item:last-child { border-bottom: none; }
.check-item.done .check-label { text-decoration: line-through; color: var(--muted); }
.check-input { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.check-label { font-size: 13px; }
.check-time { font-size: 11px; }

/* ── Toolbar ───────────────────────────────────────── */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-filters .form-control, .toolbar-filters .form-select { min-width: 0; }

/* ── Notifications Dropdown ────────────────────────── */
.notif-dropdown { width: 340px; max-height: 420px; overflow-y: auto; padding: 0; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.btn-link-sm { background: none; border: none; color: var(--brand); font-size: 12px; cursor: pointer; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); transition: .15s; }
.notif-item:hover { background: var(--bg); }
.notif-item.read { opacity: .6; }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; background: #e3f2fd; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #1565c0; flex-shrink: 0; }
.notif-title { font-size: 12.5px; font-weight: 600; }
.notif-msg { font-size: 11.5px; color: var(--muted); }
.notif-time { font-size: 10px; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Client Card ───────────────────────────────────── */
.client-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: .2s; }
.client-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.client-header { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.client-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.client-name { font-weight: 700; font-size: 14px; }
.client-name a { color: var(--text); text-decoration: none; }
.client-city { font-size: 12px; color: var(--muted); }
.client-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.client-detail { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.client-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ── Property Card ─────────────────────────────────── */
.property-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.property-type-badge { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--brand); background: #e3f2fd; display: inline-block; padding: 2px 7px; border-radius: 4px; margin-bottom: 6px; }
.property-name { font-weight: 600; font-size: 13px; }
.property-addr, .property-meta { font-size: 12px; color: var(--muted); }

/* ── Approval Queue ────────────────────────────────── */
.approval-queue { display: flex; flex-direction: column; }
.approval-card { display: flex; align-items: center; gap: 14px; padding: 16px 20px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); transition: .15s; }
.approval-card:hover { background: var(--bg); }
.approval-level { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.approval-job { font-size: 13.5px; font-weight: 600; }
.approval-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 3px; }
.approval-actioned { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── User Avatar SM ────────────────────────────────── */
.user-avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg,var(--brand),var(--brand-2)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0; }

/* ── Bar Chart ─────────────────────────────────────── */
.bar-chart { padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label { min-width: 110px; font-size: 12px; color: var(--text); text-transform: capitalize; }
.bar-track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 5px; transition: width .4s ease; }
.bar-val { min-width: 28px; text-align: right; font-size: 12px; font-weight: 600; font-family: 'DM Mono', monospace; color: var(--muted); }

/* ── Misc ──────────────────────────────────────────── */
.btn-ghost { background: none; border: none; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.member-select-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; background: var(--bg); border-radius: 8px; padding: 12px; }

/* ── INPUT GROUP ───────────────────────────────────── */
.input-group-custom { position: relative; }
.input-group-custom i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
.input-group-custom .form-control { padding-left: 38px; }
.pwd-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; }

/* ── LOGIN ─────────────────────────────────────────── */
.login-body { background: var(--sidebar-bg); }
.login-wrap { display: flex; min-height: 100vh; }
.login-left { width: 420px; background: linear-gradient(145deg, #0f1f2e, #1a3c5e); display: flex; flex-direction: column; justify-content: center; padding: 60px 48px; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.brand-icon-lg { width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(135deg,var(--accent),#0098a8); display: flex; align-items: center; justify-content: center; font-size: 32px; color: #fff; margin-bottom: 20px; }
.login-left h1 { font-size: 28px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.login-left p { color: rgba(255,255,255,.5); font-size: 14px; }
.login-features { margin-top: 48px; display: flex; flex-direction: column; gap: 16px; }
.feat-item { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.7); font-size: 14px; }
.feat-item i { font-size: 18px; color: var(--accent); }
.login-card { background: var(--surface); border-radius: 14px; padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--muted); margin-bottom: 24px; }
.btn-login { height: 44px; font-size: 15px; font-weight: 600; }

/* ── Bootstrap Overrides ───────────────────────────── */
.form-control, .form-select { border-color: var(--border); border-radius: 7px; font-size: 13.5px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,60,94,.12); }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.btn { border-radius: 7px; font-size: 13.5px; font-weight: 600; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: #153256; border-color: #153256; }
.table { font-size: 13.5px; }
.table thead th { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--bg); border-bottom: 2px solid var(--border); padding: 10px 14px; }
.table tbody td { padding: 10px 14px; vertical-align: middle; border-color: var(--border); }
.alert { border-radius: 8px; font-size: 13.5px; }
.modal-content { border-radius: 12px; border: none; }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
.dropdown-menu { border-color: var(--border); border-radius: 8px; box-shadow: var(--shadow-md); font-size: 13.5px; padding: 4px; }
.dropdown-item { border-radius: 5px; padding: 7px 12px; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0 !important; }
  .login-left { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}
