/* ═══════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════ */
:root {
  /* ── Deep Cleanify brand palette ───────────────────────────
     Primary blue  #1B74BB  (logo "deep" + icon)
     Accent amber  #FAA31B  (logo "cleanify" + highlights)
     Dark navy     #0C2D54  (sidebar)
  ──────────────────────────────────────────────────────────── */
  --navy:       #0C2D54;   /* sidebar bg */
  --navy-mid:   #103566;   /* sidebar hover */
  --navy-light: #1B74BB;   /* active nav — brand primary */
  --teal:       #1B74BB;   /* primary action = brand blue */
  --teal-light: #2E8DD4;   /* hover */
  --teal-dim:   #DDEEF9;   /* light blue bg tint */
  --amber:      #FAA31B;   /* brand accent orange */
  --amber-dim:  #FEF0D0;
  --red:        #EF4444;
  --red-dim:    #FEE2E2;
  --green:      #22C55E;
  --green-dim:  #DCFCE7;
  --slate:      #5A7089;
  --slate-light:#94A3B8;
  --slate-dim:  #EEF4FA;   /* very light blue-tinted bg */
  --white:      #FFFFFF;
  --ink:        #0C2D54;   /* same as navy for headings */
  --ink-soft:   #1E4473;

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

  --shadow-sm:  0 1px 3px rgba(27,116,187,.10), 0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 4px 16px rgba(27,116,187,.13), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:  0 20px 60px rgba(0,0,0,.15), 0 8px 24px rgba(0,0,0,.10);

  --sidebar-w:  240px;
  --topbar-h:   60px;
  --font:       'DM Sans', system-ui, sans-serif;
  --mono:       'DM Mono', monospace;
}

/* ═══════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); background: #EEF4FA; color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ═══════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════ */
#app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0C2D54 0%, #0A2548 60%, #082040 100%);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  transition: transform .25s ease;
  z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-mark {
  display: flex; align-items: center; gap: 10px;
}
.logo-icon {
  width: 36px; height: 36px; background: var(--teal);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.logo-text { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.2; }
.logo-sub  { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 1px; }

.sidebar-user {
  margin: 12px 12px 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: white; flex-shrink: 0;
}
.user-info .user-name  { font-size: 12px; font-weight: 600; color: white; }
.user-info .user-role  { font-size: 11px; color: rgba(255,255,255,.45); text-transform: capitalize; }

.sidebar-nav { padding: 8px; flex: 1; }
.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: rgba(255,255,255,.3); text-transform: uppercase;
  padding: 12px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
  color: rgba(255,255,255,.6); font-size: 13px; font-weight: 500;
  margin-bottom: 2px; user-select: none;
}
.nav-item:hover  { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: var(--teal); color: white; }
.nav-item .nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--amber);
  color: var(--navy); font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px; line-height: 1.4;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  width: 100%; padding: 9px; background: rgba(255,255,255,.07);
  border: none; border-radius: var(--radius-sm); color: rgba(255,255,255,.6);
  font-size: 12px; font-weight: 500; display: flex; align-items: center;
  justify-content: center; gap: 6px; transition: background .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

/* Main content */
#main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
#topbar {
  height: var(--topbar-h); background: white;
  border-bottom: 2px solid #DDEEF9;
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px; flex-shrink: 0;
  box-shadow: 0 1px 8px rgba(27,116,187,.08);
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--ink); flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--slate); }
#content { flex: 1; overflow-y: auto; padding: 24px; }

/* Mobile topbar toggle */
.menu-toggle {
  display: none; background: none; border: none;
  font-size: 20px; padding: 4px; color: var(--ink);
}
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}

/* ═══════════════════════════════════════════════════════
   COMPONENTS
═══════════════════════════════════════════════════════ */

/* Cards */
.card {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.card-body  { padding: 20px; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
}
.stat-card.teal   { border-color: var(--teal); }
.stat-card.amber  { border-color: var(--amber); }
.stat-card.green  { border-color: var(--green); }
.stat-card.red    { border-color: var(--red); }
.stat-card.navy   { border-color: #0C2D54; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--slate); margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; border: none;
  transition: all .15s; white-space: nowrap;
}
.btn-primary   { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); }
.btn-teal      { background: var(--teal); color: white; }
.btn-teal:hover { background: var(--teal-light); }
.btn-ghost     { background: transparent; color: var(--slate); border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: var(--slate-dim); }
.btn-danger    { background: var(--red-dim); color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-icon      { padding: 7px; border-radius: var(--radius-sm); }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.badge-new      { background: var(--teal-dim);  color: #0f766e; }
.badge-assigned { background: var(--amber-dim); color: #92400e; }
.badge-open     { background: var(--amber-dim); color: #92400e; }
.badge-completed { background: var(--green-dim); color: #15803d; }
.badge-closed   { background: #f1f5f9; color: var(--slate); }
.badge-cancelled { background: var(--red-dim); color: #991b1b; }
.badge-follow-up { background: #ede9fe; color: #6d28d9; }
.badge-admin    { background: #0C2D54; color: white; }
.badge-supervisor { background: #DDEEF9; color: #1B74BB; }
.badge-cleaner  { background: var(--slate-dim); color: var(--slate); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: #f8fafc; padding: 10px 14px;
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--slate); border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
td {
  padding: 11px 14px; border-bottom: 1px solid #f1f5f9;
  color: var(--ink-soft); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.td-mono { font-family: var(--mono); font-size: 12px; color: var(--slate); }

/* Forms */
.form-grid   { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-label  { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.form-label.required::after { content: " *"; color: var(--red); }
.form-control {
  padding: 9px 12px; border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm); font-size: 13px;
  color: var(--ink); background: white;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}
.form-control::placeholder { color: var(--slate-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--slate); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .15s ease;
}
.modal {
  background: white; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: slideUp .2s ease;
}
.modal-lg { max-width: 700px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--slate-dim); border: none; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--slate); transition: background .15s;
}
.modal-close:hover { background: #e2e8f0; }
.modal-body   { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f1f5f9;
  display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0;
}

/* Alert modal (confirm/warn) */
.alert-modal { max-width: 380px; }
.alert-icon  { font-size: 36px; text-align: center; margin-bottom: 12px; }
.alert-msg   { font-size: 14px; color: var(--ink-soft); text-align: center; line-height: 1.6; }

/* Empty state */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--slate);
}
.empty-icon  { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; }

/* Search & filter bar */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar .form-control { max-width: 240px; }
.filter-bar select.form-control { max-width: 160px; }

/* Login page */
#login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: linear-gradient(150deg, #0C2D54 0%, #1B74BB 55%, #FAA31B 100%);
}
.login-card {
  background: white; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 400px;
  padding: 40px 36px;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .logo-icon-lg {
  width: 56px; height: 56px; background: var(--teal);
  border-radius: var(--radius); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: #0C2D54; }
.login-logo p  { font-size: 13px; color: var(--slate); margin-top: 2px; }
.login-form .form-group { margin-bottom: 14px; }
.btn-login {
  width: 100%; padding: 11px;
  background: linear-gradient(135deg, #1B74BB, #FAA31B);
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; margin-top: 4px;
  transition: opacity .15s;
}
.btn-login:hover { opacity: .9; }
.login-hint {
  text-align: center; font-size: 12px; color: var(--slate);
  margin-top: 20px; padding-top: 16px; border-top: 1px solid #f1f5f9;
}

/* ── Password field with eye toggle ──────────────────── */
.password-wrap {
  position: relative; display: flex; align-items: center;
}
.password-wrap .form-control { padding-right: 42px; }
.eye-btn {
  position: absolute; right: 0; top: 0;
  height: 100%; width: 40px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--slate);
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color .15s;
}
.eye-btn:hover { color: var(--teal); }

/* ── Login error banner ──────────────────────────────── */
.login-error {
  display: none;
  font-size: 13px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 8px;
  animation: fadeIn .2s ease;
}

/* ── Profile modal ───────────────────────────────────── */
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, #1B74BB, #FAA31B);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: white;
  margin: 0 auto 12px;
}
.profile-name  { text-align:center; font-size:16px; font-weight:700; color:var(--ink); }
.profile-role  { text-align:center; font-size:12px; color:var(--slate); margin-bottom:20px; }
.change-pw-link {
  display: inline-block; font-size: 13px;
  color: var(--teal); cursor: pointer;
  text-decoration: underline;
  margin-top: 4px;
}
.password-wrap {
  position: relative; display: flex; align-items: center;
}
.password-wrap .form-control {
  padding-right: 42px;
}
.eye-btn {
  position: absolute; right: 0; top: 0; height: 100%;
  width: 40px; background: none; border: none;
  cursor: pointer; font-size: 16px; color: var(--slate);
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color .15s;
}
.eye-btn:hover { color: var(--teal); }
.login-error {
  min-height: 20px;
  font-size: 13px;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 8px;
  display: none;
  animation: fadeIn .2s ease;
}

/* Timeline / detail view */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.detail-item .detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); }
.detail-item .detail-value { font-size: 14px; color: var(--ink); margin-top: 2px; }

/* Job card for supervisor */
.job-card {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px 20px;
  border-left: 4px solid #FAA31B;
  margin-bottom: 14px; transition: box-shadow .15s;
}
.job-card:hover { box-shadow: var(--shadow); }
.job-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.job-card-title  { font-size: 15px; font-weight: 600; color: var(--ink); }
.job-card-meta   { font-size: 12px; color: var(--slate); margin-top: 4px; }
.job-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* Cleaner name badges — used in jobs table team column */
.name-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: var(--teal-dim);
  color: #0f6b90;
  white-space: nowrap;
}

/* Cleaner chips */
.cleaner-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cleaner-chip {
  background: var(--slate-dim); border: 1px solid #e2e8f0;
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 5px;
}
.cleaner-chip .remove-chip {
  background: none; border: none; color: var(--slate);
  font-size: 14px; cursor: pointer; padding: 0; line-height: 1;
}
.cleaner-chip .remove-chip:hover { color: var(--red); }

/* Attendance grid */
.att-grid {
  display: grid;
  grid-template-columns: 180px repeat(31, 32px);
  gap: 2px; font-size: 11px; overflow-x: auto;
}
.att-grid-header { font-weight: 600; color: var(--slate); text-align: center; padding: 4px 2px; }
.att-name  { font-weight: 500; color: var(--ink); padding: 4px 8px 4px 0; display: flex; align-items: center; white-space: nowrap; }
.att-cell  { border-radius: 4px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 11px; }
.att-P     { background: var(--green-dim); color: #15803d; }
.att-A     { background: var(--red-dim); color: #991b1b; }
.att-dash  { background: #f1f5f9; color: var(--slate-light); }

/* Animations */
@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { opacity:0; transform: translateY(20px) } to { opacity:1; transform: translateY(0) } }
@keyframes pulse   { 0%,100% { opacity:1 } 50% { opacity:.5 } }

/* Toast */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: white;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; box-shadow: var(--shadow);
  animation: slideUp .2s ease; max-width: 320px;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
.toast.warning { background: #92400e; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.section-title { font-size: 18px; font-weight: 700; color: var(--ink); }
.section-sub   { font-size: 13px; color: var(--slate); margin-top: 2px; }

/* Divider */
.divider { border: none; border-top: 1px solid #f1f5f9; margin: 16px 0; }

/* Mobile */
@media (max-width: 768px) {
  #sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #sidebar-overlay.show { display: block; }
  .menu-toggle { display: block; }
  #content { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
  .att-grid    { grid-template-columns: 140px repeat(31, 28px); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
