/* ===== LIGHT THEME TOKENS ===== */
:root {
  /* Greens */
  --green-900: #052e16;
  --green-800: #14532d;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --green-300: #86efac;
  --green-200: #bbf7d0;
  --green-100: #dcfce7;

  /* Blues */
  --blue-400: #3b82f6;
  --blue-300: #93c5fd;

  /* Layout backgrounds - LIGHT */
  --bg-page:    #f1f5f2;
  --bg-darkest: #f1f5f2;
  --bg-dark:    #e8f0eb;
  --bg-card:    #ffffff;
  --bg-card2:   #f6faf7;
  --bg-hover:   #edf6ef;

  /* Borders */
  --border:       #d1e8d9;
  --border-light: #b8dcc4;

  /* Text */
  --text-primary:   #0d2118;
  --text-secondary: #3a6b50;
  --text-muted:     #7a9e8a;

  /* Semantic colors */
  --yellow:   #d97706;
  --orange:   #ea580c;
  --red:      #dc2626;
  --red-soft: #ef4444;
  --purple:   #7c3aed;
  --cyan:     #0891b2;
  --teal:     #0d9488;

  --status-excellent: #15803d;
  --status-good:      #16a34a;
  --status-medium:    #ca8a04;
  --status-weak:      #ea580c;
  --status-danger:    #dc2626;

  /* Sidebar stays DARK for professional two-tone look */
  --sidebar-bg:      #0d2b1a;
  --sidebar-border:  #1a4a2a;
  --sidebar-text:    #a7d4b8;
  --sidebar-muted:   #4d7a5d;
  --sidebar-active:  #4ade80;
  --sidebar-hover:   rgba(255,255,255,.06);

  --sidebar-w:   260px;
  --topbar-h:    62px;
  --radius:      12px;
  --radius-sm:   8px;

  --shadow:    0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  --glow-green: 0 0 0 3px rgba(22,163,74,.12);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ===== SIDEBAR (stays dark) ===== */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; flex-shrink: 0;
  overflow-y: auto; z-index: 100; transition: width .3s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-bottom: 1px solid var(--sidebar-border); }
.logo-icon { font-size: 28px; filter: drop-shadow(0 0 8px rgba(74,222,128,.4)); }
.logo-name { display: block; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--green-300); }
.logo-sub { font-size: .68rem; color: var(--sidebar-muted); letter-spacing: .05em; }
.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-group { margin-bottom: 2px; }
.nav-group-label { display: block; padding: 10px 16px 3px; font-size: .62rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: .82rem; font-weight: 500;
  color: var(--sidebar-text); transition: all .15s; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: rgba(74,222,128,.12);
  color: var(--sidebar-active);
  border-left: 3px solid var(--sidebar-active);
}
.nav-icon { font-size: .95rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; background: rgba(255,255,255,.06); border-radius: var(--radius-sm); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--green-700), var(--green-500)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .72rem; color: #fff; flex-shrink: 0; }
.user-name { display: block; font-size: .8rem; font-weight: 600; color: #fff; }
.user-role { font-size: .68rem; color: var(--sidebar-muted); }

/* ===== MAIN ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: .8rem; color: var(--text-muted); }
.bc-active { color: var(--green-700); font-weight: 600; }
.btn-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-card2); border: 1px solid var(--border);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  font-size: .9rem; transition: all .15s;
}
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-icon.notif { position: relative; }
.btn-icon.notif .badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: .58rem;
  font-weight: 700; width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.search-global {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 12px; height: 36px; width: 260px; font-size: .82rem; color: var(--text-muted);
  transition: border-color .15s;
}
.search-global:focus-within { border-color: var(--green-600); box-shadow: var(--glow-green); }
.search-global input { background: none; border: none; outline: none; color: var(--text-primary); width: 100%; }
.lang-switch { font-size: .73rem; font-weight: 700; color: var(--green-700); cursor: pointer; background: var(--green-100); padding: 5px 10px; border-radius: 6px; }

/* ===== SCREENS ===== */
.screen { display: none; flex: 1; overflow-y: auto; padding: 24px; animation: fadeIn .25s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.45rem; font-weight: 700; color: var(--text-primary); }
.page-header p { font-size: .82rem; color: var(--text-muted); margin-top: 3px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--green-600));
  border-radius: var(--radius) var(--radius) 0 0;
}
.kpi-icon { font-size: 1.4rem; margin-bottom: 10px; }
.kpi-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1; color: var(--text-primary); }
.kpi-label { font-size: .68rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi-delta { font-size: .72rem; margin-top: 6px; }
.kpi-delta.up { color: var(--status-good); }
.kpi-delta.down { color: var(--red-soft); }

/* ===== CARDS ===== */
.card {
  background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.card-title-lg { font-family: 'Space Grotesk', sans-serif; font-size: .98rem; font-weight: 700; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ===== STATUS BADGES ===== */
.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 600; padding: 3px 9px; border-radius: 20px;
}
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.s-excellent { background: #dcfce7; color: var(--status-excellent); }
.s-good      { background: #dcfce7; color: var(--status-good); }
.s-medium    { background: #fef9c3; color: var(--status-medium); }
.s-weak      { background: #ffedd5; color: var(--status-weak); }
.s-danger    { background: #fee2e2; color: var(--status-danger); }
.s-online    { background: #dcfce7; color: var(--status-good); }
.s-offline   { background: #f3f4f6; color: #9ca3af; }
.s-adopted   { background: #ede9fe; color: var(--purple); }

/* ===== TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th { padding: 10px 12px; text-align: left; font-size: .67rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border); background: var(--bg-card2); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }
.tree-code { font-family: monospace; font-size: .75rem; color: var(--green-700); font-weight: 700; }
.td-actions { display: flex; gap: 6px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s;
}
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,128,61,.25); }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--green-600); color: var(--green-700); background: var(--green-100); }
.btn-danger { background: #fee2e2; color: var(--red); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 12px; font-size: .75rem; }
.btn-xs { padding: 3px 8px; font-size: .7rem; }

/* ===== ALERT ITEMS ===== */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--border);
  margin-bottom: 8px; transition: all .15s; box-shadow: var(--shadow);
}
.alert-item:hover { border-color: var(--border-light); transform: translateX(2px); }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.alert-dot.danger { background: var(--red); box-shadow: 0 0 0 3px #fee2e2; animation: pulse 1.5s infinite; }
.alert-dot.high { background: var(--orange); box-shadow: 0 0 0 3px #ffedd5; }
.alert-dot.medium { background: var(--yellow); }
.alert-body { flex: 1; }
.alert-title { font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.alert-sub { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.alert-time { font-size: .68rem; color: var(--text-muted); flex-shrink: 0; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ===== TASK CARDS ===== */
.task-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 10px; transition: all .15s;
  box-shadow: var(--shadow);
}
.task-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.task-img { width: 50px; height: 50px; border-radius: var(--radius-sm); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex-shrink: 0; }
.task-meta { font-size: .72rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.priority-chip { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .68rem; font-weight: 700; }
.p-urgent { background: #fee2e2; color: var(--red); }
.p-high   { background: #ffedd5; color: var(--orange); }
.p-medium { background: #fef9c3; color: var(--yellow); }
.p-low    { background: #dcfce7; color: var(--status-good); }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: -16px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); border: 2px solid var(--green-400); }
.tl-date { font-size: .68rem; color: var(--text-muted); margin-bottom: 2px; }
.tl-title { font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.tl-desc { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-chip {
  padding: 5px 12px; border-radius: 20px; font-size: .75rem; font-weight: 500;
  background: #fff; border: 1px solid var(--border); color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.filter-chip:hover, .filter-chip.active { background: var(--green-100); border-color: var(--green-600); color: var(--green-800); }
.filter-input {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); padding: 6px 12px; font-size: .8rem; outline: none; transition: border-color .15s;
}
.filter-input:focus { border-color: var(--green-600); box-shadow: var(--glow-green); }

/* ===== MAP ===== */
.leaflet-container { background: #e8f0eb; }
.map-tools {
  position: absolute; top: 12px; right: 12px; z-index: 1000; display: flex; flex-direction: column; gap: 6px;
}
.map-tool-btn {
  width: 36px; height: 36px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-size: .9rem; cursor: pointer; color: var(--text-secondary); transition: all .15s; box-shadow: var(--shadow);
}
.map-tool-btn:hover { background: var(--bg-hover); color: var(--green-700); }
.map-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .75rem; color: var(--text-secondary); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ===== TREE POPUP ===== */
.tree-popup { min-width: 200px; }
.tree-popup-img { width: 100%; height: 80px; background: linear-gradient(135deg, var(--green-200), var(--green-100)); border-radius: 6px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.tree-popup h4 { font-size: .85rem; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.tree-popup .tp-row { display: flex; justify-content: space-between; font-size: .72rem; padding: 4px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.tree-popup .tp-row span:last-child { color: var(--text-primary); font-weight: 500; }
.tree-popup .tp-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ===== LAYER TOGGLE ===== */
.layer-toggle { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: .78rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.toggle-switch { width: 34px; height: 18px; background: var(--border); border-radius: 20px; position: relative; cursor: pointer; transition: background .2s; }
.toggle-switch.on { background: var(--green-600); }
.toggle-switch::after { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-switch.on::after { left: 18px; }

/* ===== TREE PROFILE ===== */
.tree-profile-header {
  display: flex; gap: 20px; margin-bottom: 20px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow);
}
.tree-profile-photo { width: 150px; height: 150px; border-radius: var(--radius); background: linear-gradient(135deg, var(--green-200), var(--green-100)); display: flex; align-items: center; justify-content: center; font-size: 5rem; flex-shrink: 0; }
.tree-meta-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tree-meta-item { background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.tm-label { font-size: .67rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tm-value { font-size: .88rem; font-weight: 600; margin-top: 3px; color: var(--text-primary); }

/* ===== SENSOR / IOT ===== */
.sensor-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.sensor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sensor-value { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.sensor-unit { font-size: .75rem; color: var(--text-muted); }
.gauge-bar { height: 8px; background: var(--bg-dark); border-radius: 4px; }
.gauge-fill { height: 100%; border-radius: 4px; transition: width .8s ease; }

/* ===== COMMUNITY ===== */
.incident-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; transition: all .15s; box-shadow: var(--shadow); }
.incident-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.incident-img { width: 50px; height: 50px; border-radius: var(--radius-sm); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.incident-row { display: flex; gap: 12px; }
.incident-meta { font-size: .72rem; color: var(--text-muted); margin-top: 4px; }

/* ===== PROGRESS ===== */
.progress-bar { height: 8px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }

/* ===== DONUT LEGEND ===== */
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.dl-item { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; }
.dl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-right: 8px; }
.dl-label { flex: 1; color: var(--text-secondary); display: flex; align-items: center; }
.dl-val { font-weight: 700; color: var(--text-primary); }

/* ===== SECTION LABEL ===== */
.section-label { font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 10px; }

/* ===== QR MOCK ===== */
.qr-mock { width: 80px; height: 80px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }

/* ===== LOGin SCREEN ===== */
.login-fullscreen { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f0fdf4 100%); overflow: hidden; }
.login-bg { position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%2316a34a' fill-opacity='0.06'%3E%3Ccircle cx='40' cy='40' r='3'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"); }
.login-card {
  position: relative; z-index: 1;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: 20px; padding: 36px; width: 440px;
  box-shadow: 0 8px 40px rgba(0,0,0,.1), 0 2px 8px rgba(0,0,0,.06);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { font-size: 3rem; margin-bottom: 8px; }
.login-logo-text { font-family: 'Space Grotesk', sans-serif; font-size: 1.7rem; font-weight: 800; color: var(--green-800); }
.login-logo-sub { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.login-welcome { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.login-sub { font-size: .8rem; color: var(--text-muted); margin-bottom: 20px; }
.login-roles { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.login-roles-label { font-size: .72rem; color: var(--text-muted); margin-bottom: 10px; }
.login-role-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.role-chip { padding: 6px 14px; border-radius: 20px; font-size: .75rem; font-weight: 600; background: var(--bg-card2); border: 1px solid var(--border); color: var(--text-secondary); cursor: pointer; transition: all .15s; }
.role-chip:hover { background: var(--green-100); border-color: var(--green-600); color: var(--green-800); }
.login-features { position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); display: flex; gap: 24px; z-index: 1; white-space: nowrap; }
.lf-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); }

/* ===== FORM STYLES ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .73rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .05em; }
.form-input { width: 100%; background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); padding: 9px 13px; font-size: .85rem; outline: none; transition: border-color .15s; }
.form-input:focus { border-color: var(--green-600); box-shadow: var(--glow-green); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a9e8a' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-color: #fff; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-section { margin-bottom: 24px; }
.form-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ===== NOTIFICATION PANEL ===== */
.notif-panel {
  position: absolute; top: var(--topbar-h); right: 16px; z-index: 200;
  width: 360px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12); overflow: hidden; animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .88rem; background: var(--bg-card2); }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: #f0fdf4; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.notif-body { flex: 1; }
.notif-title { font-size: .8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-sub { font-size: .72rem; color: var(--text-muted); line-height: 1.4; }
.notif-time { font-size: .68rem; color: var(--text-muted); margin-top: 4px; }

/* ===== QUICK ACTIONS ===== */
.quick-actions-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  width: 220px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1); overflow: hidden; animation: slideDown .2s ease;
}
.qa-item { padding: 11px 16px; font-size: .82rem; color: var(--text-secondary); cursor: pointer; transition: all .1s; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); }
.qa-item:hover { background: var(--bg-hover); color: var(--green-800); }
.qa-item:last-child { border-bottom: none; }

/* ===== GLOBAL SEARCH ===== */
.search-global { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 200;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1); overflow: hidden; max-height: 380px; overflow-y: auto;
  animation: slideDown .2s ease;
}
.sr-section { padding: 8px 12px 4px; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); background: var(--bg-card2); }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; transition: background .1s; }
.sr-item:hover { background: var(--bg-hover); }
.sr-icon { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.sr-label { font-size: .82rem; font-weight: 500; color: var(--text-primary); }
.sr-sub { font-size: .7rem; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.35); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; animation: fadeIn .2s ease; }
.modal-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); width: 640px; max-width: 92vw; max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.15); animation: slideDown .25s ease; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 700; background: var(--bg-card2); }
#modalBody { padding: 20px; }

/* ===== CALENDAR ===== */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.cal-header-cell { text-align: center; font-size: .68rem; font-weight: 700; color: var(--text-muted); padding: 8px 4px; text-transform: uppercase; letter-spacing: .06em; }
.cal-cell { min-height: 90px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; cursor: pointer; transition: border-color .15s; }
.cal-cell:hover { border-color: var(--border-light); background: var(--bg-hover); }
.cal-cell.today { border-color: var(--green-600); border-width: 2px; background: #f0fdf4; }
.cal-cell.other-month { opacity: .4; background: var(--bg-card2); }
.cal-day { font-size: .75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.cal-cell.today .cal-day { color: var(--green-700); font-weight: 800; }
.cal-task-chip { font-size: .63rem; font-weight: 600; padding: 2px 6px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; cursor: pointer; }
.cal-chip-urgent { background: #fee2e2; color: var(--red); }
.cal-chip-high   { background: #ffedd5; color: var(--orange); }
.cal-chip-medium { background: #fef9c3; color: var(--yellow); }
.cal-chip-low    { background: #dcfce7; color: var(--status-good); }

/* ===== SLA ===== */
.sla-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sla-label { font-size: .72rem; color: var(--text-muted); width: 90px; flex-shrink: 0; }
.sla-track { flex: 1; height: 8px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; }
.sla-fill { height: 100%; border-radius: 4px; }
.sla-value { font-size: .72rem; font-weight: 700; width: 50px; text-align: right; flex-shrink: 0; }

/* ===== CHECKLIST ===== */
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 5px; background: var(--bg-card2); border: 1px solid var(--border); transition: all .15s; }
.checklist-item.done { opacity: .6; }
.checklist-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green-600); cursor: pointer; flex-shrink: 0; }
.checklist-item label { font-size: .8rem; cursor: pointer; flex: 1; color: var(--text-primary); }
.checklist-item.done label { text-decoration: line-through; color: var(--text-muted); }

/* ===== PHOTO GRID ===== */
.photo-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.photo-cell { aspect-ratio: 4/3; background: var(--bg-hover); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 2rem; cursor: pointer; border: 1px solid var(--border); transition: border-color .15s; overflow: hidden; position: relative; }
.photo-cell:hover { border-color: var(--green-600); }
.photo-add { border: 2px dashed var(--border-light); color: var(--text-muted); font-size: 1.5rem; }
.photo-label { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px; background: rgba(0,0,0,.5); font-size: .63rem; color: #fff; }

/* ===== MOBILE MOCKUP ===== */
.mobile-showcase { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; padding: 20px 0; }
.phone-frame { width: 330px; min-height: 660px; background: #fff; border-radius: 36px; border: 2px solid var(--border-light); box-shadow: 0 20px 60px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.08); overflow: hidden; position: relative; flex-shrink: 0; }
.phone-notch { height: 26px; background: var(--bg-card2); display: flex; align-items: center; justify-content: center; }
.phone-notch-inner { width: 90px; height: 16px; background: var(--bg-dark); border-radius: 0 0 10px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.phone-speaker { width: 36px; height: 3px; background: var(--border-light); border-radius: 2px; }
.phone-camera { width: 7px; height: 7px; border-radius: 50%; background: var(--border-light); }
.phone-body { height: calc(100% - 26px); overflow-y: auto; }
.phone-status-bar { display: flex; justify-content: space-between; padding: 5px 16px; font-size: .63rem; color: var(--text-muted); background: var(--bg-card2); border-bottom: 1px solid var(--border); }
.phone-screen { background: var(--bg-page); min-height: 560px; }
.phone-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.phone-title { font-family: 'Space Grotesk', sans-serif; font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.phone-section { padding: 0 14px 14px; }
.phone-label { font-size: .63rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); padding: 10px 0 6px; }
.phone-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.phone-kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.phone-kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.phone-kpi-val { font-family: 'Space Grotesk', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.phone-kpi-label { font-size: .63rem; color: var(--text-muted); margin-top: 2px; }
.phone-task-item { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
.phone-btn { width: 100%; padding: 12px; border-radius: 10px; font-size: .88rem; font-weight: 700; text-align: center; cursor: pointer; border: none; margin-bottom: 8px; }
.phone-btn-primary { background: var(--green-700); color: #fff; }
.phone-btn-outline { background: transparent; border: 1.5px solid var(--border-light); color: var(--text-secondary); }
.phone-checklist { display: flex; flex-direction: column; gap: 6px; }
.phone-check-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.phone-check-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0; }
.phone-qr-scan { background: var(--bg-card2); border: 1px solid var(--border); border-radius: 12px; height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; position: relative; overflow: hidden; }
.qr-scan-line { position: absolute; left: 10%; right: 10%; height: 2px; background: linear-gradient(90deg, transparent, var(--green-600), transparent); animation: scanMove 2s linear infinite; }
@keyframes scanMove { 0%,100% { top: 20%; } 50% { top: 80%; } }
.phone-bottomnav { display: flex; justify-content: space-around; padding: 10px 0; background: #fff; border-top: 1px solid var(--border); }
.phone-nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .6rem; color: var(--text-muted); cursor: pointer; padding: 4px 10px; }
.phone-nav-item.active { color: var(--green-700); }
.phone-nav-icon { font-size: 1.1rem; }

/* ===== ADMIN ===== */
.role-matrix { width: 100%; border-collapse: collapse; font-size: .78rem; }
.role-matrix th { padding: 10px 12px; text-align: left; font-size: .67rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border); background: var(--bg-card2); }
.role-matrix td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.role-matrix tr:hover td { background: var(--bg-hover); }
.perm-check { font-size: 1rem; text-align: center; }

/* ===== WORK ORDER ===== */
.wo-status-bar { display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.wo-step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; position: relative; }
.wo-step::after { content: ''; position: absolute; top: 14px; left: 50%; right: -50%; height: 2px; background: var(--border); }
.wo-step:last-child::after { display: none; }
.wo-step.done::after { background: var(--green-600); }
.wo-step-circle { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; z-index: 1; border: 2px solid var(--border); background: #fff; color: var(--text-muted); }
.wo-step.done .wo-step-circle { background: var(--green-600); border-color: var(--green-700); color: #fff; }
.wo-step.active .wo-step-circle { background: var(--green-100); border-color: var(--green-600); color: var(--green-700); animation: pulse 1.5s infinite; }
.wo-step-label { font-size: .63rem; color: var(--text-muted); text-align: center; }
.wo-step.done .wo-step-label, .wo-step.active .wo-step-label { color: var(--green-700); font-weight: 600; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .logo-text,.nav-group-label,.nav-item span:not(.nav-icon),.user-info { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
