/* ======================================================================
   TaskFlow — Multi-Tenant SaaS UI
   Theme: bg #FAFAFA, primary #2B2B2B, accent gold #C9A227
   ====================================================================== */

/* Mobile-First & Touch-Friendly Design System */
:root {
  --touch-target: 48px;
  --font-mobile-body: 16px;
  --font-mobile-btn: 20px;
  --gutter: 2.5rem;
  --container-max: 1600px;
}

@media (max-width: 1400px) {
  :root { --gutter: 2rem; }
}

@media (max-width: 1200px) {
  :root { --gutter: 1.75rem; }
}

@media (max-width: 768px) {
  :root { --gutter: 1rem; }
  body { font-size: var(--font-mobile-body) !important; }
  
  .app-main { margin-left: 0 !important; padding-bottom: 70px !important; }
  .app-content { padding: var(--gutter) !important; }
  
  .page-head { flex-direction: column; align-items: flex-start !important; gap: 1rem; margin-bottom: 2rem; }
  .page-head .actions { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
  .page-head .actions .btn { padding: 14px; font-size: 14px; width: 100%; }
  
  .card-body { padding: 1.25rem !important; }
  .page-head h1 { font-size: 24px !important; letter-spacing: -0.5px !important; }

  /* Stacked Stats on Mobile */
  .stats-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
  
  /* Mobile Bottom Navigation (optional, but good for UX) */
  .sidebar-mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 70px; background: #111; z-index: 1000;
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid #222;
  }
}

/* Grid System Overrides */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Dashboard & Activity Feed — Premium Elevate */
.card-premium {
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: 0 10px 30px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card-premium:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.05);
}

.task-card-mobile {
    border: none !important;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.task-card-mobile::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
}

/* Modern Workflow Stepper */
.workflow-modern {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 20px 0;
    margin-bottom: 30px;
}
.workflow-modern::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0;
    height: 2px;
    background: #F1F1F1;
    z-index: 1;
    transform: translateY(-50%);
}
.step-item {
    position: relative;
    z-index: 2;
    background: #FFF;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid #F1F1F1;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    transition: all 0.3s;
}
.step-item.active {
    background: #1A1A1A;
    color: #FFF;
    border-color: #1A1A1A;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.step-item.done {
    background: #F0FFF4;
    color: #2E7D32;
    border-color: #C6F6D5;
}

.empty-state-check {
    padding: 40px 20px;
    text-align: center;
    background: #F8F9FA;
    border-radius: 16px;
    border: 1px dashed rgba(0,0,0,0.1);
}
.empty-state-check i {
    font-size: 32px;
    opacity: 0.2;
    margin-bottom: 12px;
    display: block;
}

.activity-item {
    transition: background 0.2s;
    border-radius: 12px;
}
.activity-item:hover { background: rgba(0,0,0,0.02); }

.pulse-icon {
    display: inline-block;
    width: 8px; height: 8px;
    background: #2E7D32;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(46, 125, 50, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

:root {
  --bg:           #FAFAFA;
  --surface:      #FFFFFF;
  --surface-2:    #F4F4F2;
  --primary:      #2B2B2B;
  --primary-700:  #1F1F1F;
  --primary-500:  #4A4A4A;
  --accent:       #C9A227;
  --accent-700:   #A78617;
  --accent-soft:  #FBF3D6;
  --text:         #1A1A1A;
  --text-muted:   #6E6E6E;
  --border:       #E6E6E3;
  --border-strong:#D5D5D2;
  --success:      #2E7D32;
  --info:         #0277BD;
  --warning:      #ED6C02;
  --danger:       #C62828;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-pill:  999px;
  --shadow-sm:    0 1px 2px rgba(20,20,20,.05);
  --shadow:       0 6px 24px rgba(20,20,20,.06);
  --shadow-lg:    0 12px 32px rgba(20,20,20,.10);

  --sidebar-w:    256px;
  --navbar-h:     64px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: radial-gradient(circle at 0% 0%, #FAFAF9 0%, #F5F5F2 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-700); }

/* ============== App shell ============== */

.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #111111; /* Deep matte black */
  color: #ECECEA;
  display: flex;
  flex-direction: column;
  z-index: 2000;
  border-right: 1px solid #1A1A1A;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,0.4);
  }
  .app-main {
    margin-left: 0 !important;
  }
  .navbar-top {
    padding: 0 1rem;
  }
  .menu-toggle {
    display: flex !important;
  }
}

.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid #1F1F1F;
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-700) 100%);
  color: #1A1A1A; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.5px; font-size: 16px;
  box-shadow: 0 4px 12px rgba(201,162,39,.35);
}
.sidebar-brand .name { font-weight: 600; font-size: 16px; line-height: 1.1; }
.sidebar-brand .name small { display: block; font-weight: 400; font-size: 11px; color: #B5B5B0; margin-top: 2px; letter-spacing: .3px; }

.sidebar-user-brief {
  margin: 1.25rem 1rem .5rem;
  padding: .85rem;
  background: rgba(255,255,255,.03);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: .75rem;
  border: 1px solid rgba(255,255,255,.05);
}
.sidebar-user-brief .avatar {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #444 0%, #222 100%);
  color: #FFF; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.3);
}
.sidebar-user-brief .info .user-name { font-weight: 600; font-size: 13.5px; color: #FFF; line-height: 1.2; }
.sidebar-user-brief .info .user-role { font-size: 10.5px; color: #7A7A75; text-transform: uppercase; letter-spacing: .5px; margin-top: 1px; }

.sidebar-tenant {
  margin: .5rem 1rem .5rem;
  padding: .75rem .85rem;
  background: rgba(201,162,39,.08);
  border: 1px solid rgba(201,162,39,.15);
  border-radius: var(--radius-sm);
}
.sidebar-tenant.is-platform {
  background: rgba(46, 125, 50, 0.08);
  border-color: rgba(46, 125, 50, 0.15);
}
.sidebar-tenant.is-platform .name { color: #81C784; }
.sidebar-tenant .label { color: #7A7A75; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 3px; }
.sidebar-tenant .name { color: var(--accent); font-weight: 600; font-size: 13px; }

.sidebar-nav {
  list-style: none;
  padding: .5rem .75rem; margin: 0;
  flex: 1;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-nav .group-label {
  padding: 1.5rem 1rem .6rem;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px;
  color: #555550; text-transform: uppercase;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.15rem; margin: 6px 0;
  color: #A0A095; border-radius: 12px;
  font-size: 13.5px; font-weight: 500;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  letter-spacing: 0.1px;
}
.sidebar-nav a i { 
  width: 22px; text-align: center; font-size: 16px; 
  opacity: .55; transition: all .25s; 
}
.sidebar-nav a:hover { 
  background: rgba(255,255,255,.05); 
  color: #FFFFFF; 
}
.sidebar-nav a:hover i { 
  opacity: 1; 
  transform: scale(1.1); 
}
.sidebar-nav a.active { 
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-700) 100%);
  color: #000000; 
  font-weight: 700; 
  box-shadow: 0 8px 20px rgba(201,162,39,.25); 
}
.sidebar-nav a.active i { 
  opacity: 1; 
  color: #000000; 
}

/* Subtle indicator for active state */
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 20%;
  bottom: 20%;
  width: 4px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

@media (min-width: 992px) {
  .border-start-lg { border-left: 1px solid var(--border) !important; }
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.text-danger-hover:hover { background: rgba(198, 40, 40, 0.1) !important; color: #FF8A80 !important; }

.sidebar-foot {
  padding: 1rem 1.25rem; border-top: 1px solid #1F1F1F;
  font-size: 10.5px; color: #5A5A55; font-weight: 500;
}

/* ============== Navbar ============== */

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.navbar-top {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-h);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.navbar-top .page-title {
  font-size: 16px; font-weight: 600;
  color: var(--text); letter-spacing: -.2px;
  margin: 0;
}

.navbar-top .spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  border-radius: 8px; color: var(--primary-500);
  cursor: pointer; position: relative;
  transition: all .12s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--primary); border-color: var(--border); }
.menu-toggle { display: none; margin-right: .5rem; }
.icon-btn .badge-dot {
  position: absolute; top: 7px; right: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #1A1A1A;
  border-radius: 8px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: .25rem .65rem .25rem .25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  cursor: pointer;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-500) 100%);
  color: #ECECEA; font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.user-chip .who { font-size: 13px; line-height: 1.1; }
.user-chip .who small { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  font-size: 13.5px;
}
.dropdown-item { border-radius: 6px; padding: .45rem .65rem; }
.dropdown-item:hover { background: var(--surface-2); }

/* ============== Content area ============== */

.app-content {
  padding: var(--gutter) 2.5rem;
  flex: 1;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.page-head {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.page-head h1 {
  font-size: 28px; font-weight: 800;
  margin: 0; letter-spacing: -0.75px;
  color: var(--text);
}
.page-head .subtitle { font-size: 14px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

/* ============== Cards ============== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.15rem;
  font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.15rem; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-card:hover { 
  transform: translateY(-4px); 
  box-shadow: var(--shadow-lg); 
  border-color: var(--accent-soft);
}
.stat-card::after {
  content: ""; position: absolute; top: -50%; right: -50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(201,162,39,0.03) 0%, transparent 70%);
  pointer-events: none;
}
.stat-card .label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: .5rem;
}
.stat-card .value {
  font-size: 28px; font-weight: 800;
  color: var(--text); line-height: 1;
  letter-spacing: -1px;
}
.stat-card .delta {
  font-size: 12px; color: var(--text-muted);
  margin-top: .6rem; display: flex; align-items: center; gap: .35rem;
}
.stat-card .icon {
  position: absolute; top: 1.25rem; right: 1.25rem;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: transform .3s ease;
}
.stat-card:hover .icon { transform: scale(1.1) rotate(5deg); }

.stat-card.is-primary .icon { background: #F0F0F0; color: var(--primary); }
.stat-card.is-success .icon { background: #E8F5E9; color: var(--success); }
.stat-card.is-info    .icon { background: #E3F2FD; color: var(--info); }
.stat-card.is-warning .icon { background: #FFF3E0; color: var(--warning); }

/* ============== Buttons ============== */

.btn {
  font-size: 13px; font-weight: 500;
  padding: .5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all .12s ease;
}
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #FFF;
}
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #FFF; }
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: #1A1A1A; font-weight: 600;
}
.btn-accent:hover { background: var(--accent-700); border-color: var(--accent-700); color: #FFF; }
.btn-outline-dark {
  background: transparent; color: var(--primary); border-color: var(--border-strong);
}
.btn-outline-dark:hover { background: var(--primary); color: #FFF; border-color: var(--primary); }
.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--primary); }
.btn-danger-soft {
  background: #FBEAEA; color: var(--danger); border-color: #F4D2D2;
}
.btn-danger-soft:hover { background: var(--danger); color: #FFF; border-color: var(--danger); }
.btn-sm { padding: .35rem .7rem; font-size: 12px; }
.btn-icon { padding: .35rem .55rem; }

/* ============== Tables ============== */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap .table-toolbar {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
}
.table-wrap table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; }
.table-wrap thead th {
  background: var(--surface-2);
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table-wrap tbody td {
  padding: .85rem 1rem;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: #FAFAF9; }

.empty-state {
  padding: 3rem 1rem; text-align: center;
  color: var(--text-muted);
}
.empty-state .icon {
  width: 56px; height: 56px;
  background: var(--surface-2); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--text-muted); margin-bottom: 1rem;
}

/* ============== Badges ============== */

.status-badge, .priority-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}
.status-badge::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; margin-right: 6px;
}
.badge-pending    { background: #F3EAD0; color: #8A6A12; }
.badge-pending::before { background: #C9A227; }
.badge-accepted   { background: #DDEDF7; color: #0A5179; }
.badge-accepted::before { background: #0277BD; }
.badge-progress   { background: #FCEAD1; color: #8E4400; }
.badge-progress::before { background: #ED6C02; }
.badge-completed  { background: #E0F2E2; color: #1B5E20; }
.badge-completed::before { background: #2E7D32; }
.badge-cancelled  { background: #F2E0E0; color: #8E1717; }
.badge-cancelled::before { background: #C62828; }

.priority-low     { background: #ECF1F4; color: #3D5366; }
.priority-medium  { background: #DDEDF7; color: #0A5179; }
.priority-high    { background: #FCEAD1; color: #8E4400; }
.priority-urgent  { background: #F2E0E0; color: #8E1717; }

/* ============== Forms ============== */

.form-label {
  font-size: 12.5px; font-weight: 600;
  color: var(--text); margin-bottom: .35rem;
  letter-spacing: .1px;
}
.form-control, .form-select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: .55rem .8rem;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,162,39,.20);
  outline: none;
}
.form-control::placeholder { color: #A8A8A2; }
#filterPanel .form-label {
  color: var(--text-muted);
  margin-top: .5rem;
}

@media (max-width: 767px) {
  #filterPanel .row > div {
    margin-bottom: .5rem;
  }
  #filterPanel .pt-4 {
    padding-top: 1.5rem !important;
  }
}

/* ============== Auth ============== */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at 0% 0%, #1A1A1A 0%, #000000 100%);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: authFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand .logo {
  width: 42px; height: 42px; margin: 0 auto 0.75rem;
  background: var(--accent); /* SaaS "Premium Finish" & Transitions */
@keyframes authFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.app-content { animation: authFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

/* Cinematic Top Loading Bar Mock */
.app-main::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 9999;
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.5);
  animation: loadProgress 1.5s ease-out forwards;
}
@keyframes loadProgress { from { width: 0; } to { width: 100%; opacity: 0; } }

/* Proper Table Responsiveness */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  background: #FFF;
}

table {
  min-width: 800px; /* Ensure columns don't crush on mobile */
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

@media (max-width: 768px) {
  .table-wrap { 
    margin: 0 -1rem; 
    width: calc(100% + 2rem); 
    border-radius: 0; 
    border-left: none; 
    border-right: none; 
  }
  table { min-width: 700px; }
  .table-toolbar { flex-direction: column; align-items: stretch !important; gap: 1rem; }
  .table-toolbar .d-flex { flex-wrap: wrap; gap: 0.5rem; }
  .table-toolbar .btn { flex: 1; }
}

/* Fix for overlapping elements on small screens */
.navbar-top {
    overflow: hidden;
}
.navbar-top .page-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

@media (min-width: 769px) {
    .navbar-top .page-title { max-width: none; }
}
;
  box-shadow: 0 10px 20px rgba(201,162,39,.3);
}
.auth-brand h1 { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -0.5px; color: #1A1A1A; }
.auth-brand p { font-size: 12px; color: #7A7A75; margin: 2px 0 0; font-weight: 500; }

.auth-mode-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1.25rem; border-radius: var(--radius-pill);
  background: #F5F5F2; color: #5A5A55;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid var(--border);
}

.form-label { font-size: 13px; font-weight: 600; color: #5A5A55; margin-bottom: .5rem; }
.form-control {
  padding: .75rem 1rem; border-radius: 12px;
  border: 1.5px solid #E8E8E5; background: #FAFAF9;
  font-size: 14.5px; transition: all .2s;
}
.form-control:focus {
  border-color: var(--accent); background: #FFF;
  box-shadow: 0 0 0 4px rgba(201,162,39,.1);
}

/* ============== Alerts ============== */

.alert {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: 13px;
  display: flex; align-items: center; gap: .65rem;
}
.alert-success { background: #E8F5E9; border-color: #BCE0BD; color: #1B5E20; }
.alert-danger  { background: #FBEAEA; border-color: #F1C5C5; color: #8E1717; }
.alert-info    { background: #DDEDF7; border-color: #B7D7E8; color: #0A5179; }
.alert i { font-size: 16px; }

/* ============== Notifications dropdown ============== */

/* ============== Notifications dropdown ============== */
.notif-panel {
  width: 380px; max-width: 92vw;
  border: 0; border-radius: 20px;
  background: #FFFFFF; box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  padding: 0; overflow: hidden;
  margin-top: 10px !important;
}
.notif-panel .head {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid #F1F1F1;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 14px; color: #1A1A1A;
}
.notif-panel .body { max-height: 400px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 1rem; padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #F1F1F1; font-size: 13.5px;
  transition: background .2s;
}
.notif-item:hover { background: #FAFAF9; }
.notif-item.unread { background: rgba(201,162,39,.03); }
.notif-item .n-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: #F5F5F2; font-size: 14px;
}
.notif-item .n-info { flex: 1; }
.notif-item .n-time { font-size: 10.5px; color: #999; margin-top: 4px; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: #FBF7E5; }
.notif-item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  margin-top: .4rem; flex-shrink: 0;
}
.notif-item.read .dot { background: transparent; border: 1px solid var(--border-strong); }
.notif-item .content { flex: 1; min-width: 0; }
.notif-item .title { font-weight: 600; color: var(--text); }
.notif-item .msg   { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.notif-item .ts    { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.notif-panel .empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============== Task workflow ============== */
.workflow {
  display: flex; align-items: center; gap: .75rem;
  flex-wrap: wrap;
  padding: 1.25rem; background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.workflow .step {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem 1.25rem; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  transition: all .2s;
}.navbar-top {
  height: 72px; padding: 0 2rem;
  background: rgba(255,255,255,.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,.04);
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 99;
}
.page-title { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -0.5px; color: #1A1A1A; }
.spacer { flex: 1; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent;
  color: #5A5A55; transition: all .2s;
  position: relative;
}
.icon-btn:hover { background: #F5F5F2; color: #1A1A1A; border-color: #E8E8E5; }
.icon-btn i { font-size: 18px; }
.badge-dot {
  position: absolute; top: 8px; right: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--danger); border: 2px solid #FFF;
}

.user-chip {
  display: flex; align-items: center; gap: .75rem;
  padding: .4rem .75rem; border-radius: 14px;
  background: #FFF; border: 1.5px solid #E8E8E5;
  transition: all .2s; cursor: pointer;
}
.user-chip:hover { border-color: var(--accent); background: #FAFAF9; box-shadow: 0 4px 12px rgba(0,0,0,.03); }
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: #1A1A1A; color: #FFF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.user-chip .who { text-align: left; line-height: 1.2; display: none; }
@media (min-width: 768px) { .user-chip .who { display: block; } }
.user-chip .who { font-weight: 700; font-size: 13px; color: #1A1A1A; }
.user-chip .who small { display: block; font-size: 10px; font-weight: 600; color: #7A7A75; text-transform: uppercase; margin-top: 1px; }.workflow .step.active { background: var(--primary); color: #FFF; border-color: var(--primary); box-shadow: 0 4px 10px rgba(0,0,0,.15); }
.workflow .step.done   { background: #E8F5E9; color: #2E7D32; border-color: #A5D6A7; }
.workflow .arrow { color: var(--border-strong); font-size: 12px; }

/* ============== Timeline ============== */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: .5rem; bottom: .5rem;
  width: 2px; background: var(--border);
}
.timeline li {
  position: relative;
  padding: 0 0 1.5rem 2rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::after {
  content: ""; position: absolute; left: 2px; top: .25rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); z-index: 2;
}
.timeline li.active::after { border-color: var(--accent); background: var(--accent); }

/* ============== Professional Print Engine ============== */
@media print {
    .sidebar, .navbar-top, .actions, .sidebar-nav, .btn, .breadcrumb, .notif-panel {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .app-content {
        padding: 0 !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
    .card {
        border: 1px solid #EEE !important;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 20px !important;
    }
    .page-head h1 {
        font-size: 28px !important;
        margin-top: 20px !important;
    }
    .stat-card {
        border: 1px solid #EEE !important;
        box-shadow: none !important;
        flex: 1;
    }
    .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }
    .col-lg-8, .col-lg-4, .col-6, .col-lg-3 {
        width: 100% !important;
        display: block !important;
    }
    /* Force charts to be visible if possible, or hide if they break layout */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}
  background: #FFF; border: 3px solid var(--accent);
  z-index: 2;
}
.timeline li .action { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.timeline li .meta { font-size: 11.5px; color: var(--text-muted); }
.timeline li .gps { 
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: 6px; padding: 4px 8px; background: #E3F2FD;
  border-radius: 6px; color: #0277BD; font-size: 11px; font-weight: 600;
}
.timeline li .note {
  margin-top: .5rem; padding: .75rem; background: var(--surface-2);
  border-radius: 8px; font-size: 13px; line-height: 1.5; color: var(--text);
}

.dl-row { transition: background .15s; padding: .75rem 0; }
.dl-row span { font-size: 13px; color: var(--text-muted); }
.dl-row strong { font-size: 13.5px; }

/* ============== Feed ============== */
.activity-feed { position: relative; }
.feed-item { transition: background .2s ease; border-left: 3px solid transparent; }
.feed-item:hover { background: var(--bg); border-left-color: var(--accent); }
.feed-icon { 
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  flex-shrink: 0;
}

/* Glassmorphism utility */
.glass {
  background: rgba(255, 255, 255, 0.7) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ============== Responsive ============== */

@media (max-width: 991px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(0, 0, 0.2, 1);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.2); }
  .app-main { margin-left: 0; }
  .navbar-top { padding: 0 1rem; height: 64px; }
  .navbar-top .menu-toggle { display: inline-flex !important; }
  .navbar-top .page-title { font-size: 16px; }
  .app-content { padding: 1rem .75rem 2rem; }
  .page-head h1 { font-size: 19px; }
  .stat-card { padding: 1rem; }
  .stat-card .value { font-size: 22px; }
  .stat-card .icon { width: 34px; height: 34px; font-size: 14px; top: 1rem; right: 1rem; }
}

@media (max-width: 575px) {
  .page-head { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { width: 100%; justify-content: center; }
  .navbar-top .page-title { 
    max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
  }
}
.menu-toggle { display: none; }

/* Sidebar scrollbar */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 3px; }
  
/* Auth Portal Enhancements */  
.auth-mode-pill { background: var(--bg-surface); padding: 0.5rem 1rem; border-radius: 50px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }  
.tenant-chip { display: inline-block; padding: 0.4rem 0.8rem; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-main); text-decoration: none; transition: all 0.2s ease; }  
.tenant-chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); } .anim-slide-up {
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ============== Mobile Action Bar ============== */
.mobile-actions-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 1.5rem;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
  z-index: 2000;
  display: flex; gap: 0.75rem;
  border-top: 1px solid var(--border);
}
.mobile-actions-bar .btn { flex: 1; padding: 12px; font-weight: 800; border-radius: 14px; }

/* ============== Soft Badge Utilities ============== */
.bg-soft-primary { background-color: rgba(2, 119, 189, 0.1) !important; color: var(--info) !important; }
.bg-soft-success { background-color: rgba(46, 125, 50, 0.1) !important; color: var(--success) !important; }
.bg-soft-warning { background-color: rgba(237, 108, 2, 0.1) !important; color: var(--warning) !important; }
.bg-soft-danger  { background-color: rgba(198, 40, 40, 0.1) !important; color: var(--danger) !important; }
.bg-soft-accent  { background-color: rgba(201, 162, 39, 0.1) !important; color: var(--accent-700) !important; }
.bg-soft-dark    { background-color: rgba(43, 43, 43, 0.1) !important; color: var(--primary) !important; }

/* Transition Helpers */
.transition { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
.hover-bg-light:hover { background-color: rgba(0,0,0,0.02) !important; }
.border-bottom-soft { border-bottom: 1px solid rgba(0,0,0,0.04); }

/* Responsive adjustments for complex views */
@media (max-width: 991px) {
  .workflow-modern { max-width: 100% !important; }
  .workflow-modern .step-item span { display: none; }
}

@media (max-width: 768px) {
    .app-main { padding-bottom: 80px !important; }
}
