* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #3d5a9e;
  --primary-light: #5674ba;
  --primary-dark: #2c4070;
  --accent: #e8a838;
  --accent-light: #f0c060;
  --bg: #f4f6fa;
  --card: #ffffff;
  --card-bg: #ffffff;
  --text: #1a202c;
  --text-light: #718096;
  --border: #dce2f0;
  --success: #48bb78;
  --warning: #ecc94b;
  --danger: #f56565;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
#sidebar {
  width: 240px;
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: var(--primary);
}
.logo-text { font-size: 18px; font-weight: 700; }
nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.15); color: white; border-left-color: var(--accent); }
.nav-icon {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.search-box { position: relative; }
.search-box input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 13px;
  outline: none;
}
.search-box input::placeholder { color: rgba(255,255,255,0.5); }
.search-results {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: white;
  color: var(--text);
  border-radius: 6px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 200;
}
.search-results.hidden { display: none; }
.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.search-result-item:hover { background: var(--bg); }
.search-result-item .result-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 600;
}

#menuToggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
}

#mainContent {
  margin-left: 240px;
  flex: 1;
  padding: 24px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header .header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header-logo {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: contain;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p { color: var(--text-light); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 13px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.card .number { font-size: 28px; font-weight: 700; }
.card .number.green { color: var(--success); }
.card .number.blue { color: var(--primary-light); }
.card .number.gold { color: var(--accent); }

.briefing-card {
  background: linear-gradient(135deg, var(--primary), #1a365d);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(44, 82, 130, 0.3);
}
.briefing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.briefing-header h2 { font-size: 20px; margin: 0; color: white; }
.briefing-date { font-size: 13px; opacity: 0.8; }
.briefing-body { margin-bottom: 16px; }
.briefing-item { padding: 6px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.briefing-dot { width: 8px; height: 8px; border-radius: 50%; background: #48bb78; flex-shrink: 0; }
.briefing-actions { display: flex; gap: 8px; }
.briefing-actions .btn { color: white; border-color: rgba(255,255,255,0.4); }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.module-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.module-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.module-card .module-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  margin-bottom: 12px;
}
.module-card h3 { font-size: 16px; margin-bottom: 4px; }
.module-card p { font-size: 13px; color: var(--text-light); }

.section { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.section h2 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; border-bottom: 2px solid var(--border); color: var(--text-light); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge.paid, .badge.completed { background: #c6f6d5; color: #276749; }
.badge.pending, .badge.draft { background: #fefcbf; color: #975a16; }
.badge.overdue { background: #fed7d7; color: #9b2c2c; }
.badge.sent { background: #d4e2fc; color: #3d5a9e; }
.badge.deposit { background: #e9d8fd; color: #553c9a; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: var(--primary); }
.btn-accent:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary-light); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { font-size: 20px; margin-bottom: 20px; }
.modal .btn-group { margin-top: 20px; }

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.empty-state h3 { font-size: 16px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

.invoice-preview {
  font-size: 12px;
  line-height: 1.6;
  font-family: 'Courier New', monospace;
  padding: 20px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-light);
  transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.tech-guide {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.tech-guide h4 { font-size: 14px; margin-bottom: 8px; }
.tech-guide p { font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.tech-guide .safety { color: var(--danger); font-weight: 700; }

.store-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.store-item:last-child { border-bottom: none; }
.store-item .item-info h4 { font-size: 14px; }
.store-item .item-info p { font-size: 12px; color: var(--text-light); }
.store-item .item-price { font-size: 16px; font-weight: 700; color: var(--primary); }

/* === AI CHAT === */
#chatButton {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 250;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chatButton .chat-btn-label {
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}
#chatButton:hover { transform: scale(1.1); }
#chatButton .badge-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid white;
}
#chatHeader button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.9;
}
#chatHeader button:hover { opacity: 1; text-decoration: underline; }
#chatUploadBtn, #chatSend {
  font-size: 12px !important;
  font-weight: 700;
  min-width: 44px;
  padding: 0 10px;
}
#menuToggle {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  min-width: auto;
}

#chatPanel {
  position: fixed;
  bottom: 90px; right: 24px;
  width: 380px;
  height: 520px;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  z-index: 260;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#chatPanel.open { display: flex; }

#chatHeader {
  background: var(--primary);
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#chatHeader h3 { font-size: 15px; }
#chatHeader button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
}
#chatHeader button:hover { opacity: 1; }

#chatMessages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  white-space: pre-wrap;
}
.chat-msg.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot {
  background: var(--bg);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.bot strong {
  color: var(--primary);
}
.chat-msg.typing {
  background: var(--bg);
  color: var(--text-light);
  align-self: flex-start;
  font-style: italic;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  align-self: flex-start;
}
.chat-chip {
  background: #e8edf8;
  border: 1px solid #d0daf0;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}
.chat-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

#chatUploadBtn {
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
}
#chatUploadBtn:hover { background: var(--bg); border-color: var(--primary-light); }

.file-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  font-size: 13px;
}
.chat-msg.user .file-attachment { background: rgba(255,255,255,0.2); }
.file-icon { font-size: 18px; flex-shrink: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.file-size { font-size: 11px; opacity: 0.7; flex-shrink: 0; }
.file-download {
  color: inherit;
  text-decoration: none;
  font-size: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}
.file-download:hover { opacity: 1; }

#chatInputArea {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  align-items: center;
}
#chatMic, #chatSpeakToggle, #chatUploadBtn {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
#chatMic.listening {
  background: #fed7d7;
  border-color: #e53e3e;
  color: #9b2c2c;
  animation: pulse-mic 1s infinite;
}
#chatSpeakToggle.active {
  background: #c6f6d5;
  border-color: #276749;
  color: #276749;
}
@keyframes pulse-mic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
#chatInput {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
#chatInput:focus { border-color: var(--primary-light); }
#chatSend {
  width: 40px; height: 40px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#chatSend:hover { background: var(--primary-light); }

/* === BOTTOM NAV (mobile) === */
#bottomNav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 150;
  padding: 4px 0 env(safe-area-inset-bottom, 4px) 0;
  justify-content: space-around;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--text-light);
  font-size: 10px;
  transition: color 0.2s;
  min-width: 56px;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item.active { color: var(--primary); }
.bnav-icon {
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
}
.bnav-item.active .bnav-icon {
  background: var(--primary);
  color: white;
}
.bnav-label { font-size: 10px; font-weight: 500; }

/* === MORE MENU (mobile) === */
.more-menu {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  z-index: 160;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 70vh;
  overflow-y: auto;
}
.more-menu.hidden { display: none; }
.more-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  background: var(--bg);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.more-item:active { background: var(--border); }
.more-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.more-close {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* === MOBILE TABLES -> CARDS === */
@media (max-width: 768px) {
  body { padding-bottom: 64px; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #menuToggle { display: block; }
  #mainContent { margin-left: 0; padding: 12px; padding-top: 52px; }
  .form-row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards .card { padding: 14px; }
  .card .number { font-size: 22px; }
  
  /* Bottom nav */
  #bottomNav { display: flex; }
  
  /* Table -> stacked cards on mobile */
  .section { padding: 12px; overflow: hidden; }
  .section table, .section thead, .section tbody, .section th, .section td, .section tr { display: block; }
  .section thead { display: none; }
  .section table tr {
    display: flex;
    flex-direction: column;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
  }
  .section table tr:hover td { background: transparent; }
  .section table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border: none;
    font-size: 13px;
    gap: 8px;
  }
  .section table td:empty { display: none; }
  .section table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }
  .section table td:last-child {
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
    justify-content: flex-end;
    gap: 8px;
  }
  .section table td:last-child::before { display: none; }
  
  /* Page header mobile */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn-group { width: 100%; }
  .page-header .btn-group .btn { flex: 1; text-align: center; justify-content: center; padding: 12px; }
  
  /* Module grid mobile */
  .modules-grid { grid-template-columns: 1fr; }
  .module-card { padding: 16px; }
  
  /* Modal makes full-screen */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-overlay .modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
  }
  
  /* Bigger touch targets in forms */
  .form-group input, .form-group textarea, .form-group select { padding: 12px; font-size: 15px; }
  .form-group label { font-size: 14px; }
  .btn { padding: 12px 20px; font-size: 14px; }
  .btn-sm { padding: 8px 14px; font-size: 13px; }
  
  /* Tech guides on mobile */
  .tech-guide { padding: 12px; }
  
  /* Invoice preview scrollable */
  .invoice-preview { font-size: 11px; padding: 12px; }
  
  /* Chat full-screen on mobile */
  #chatButton { bottom: 72px; right: 16px; width: 52px; height: 52px; font-size: 22px; }
  #chatPanel {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    left: 0;
    top: 0;
    border-radius: 0;
    animation: mobileSlideUp 0.3s ease;
  }
  @keyframes mobileSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  #chatPanel .chat-msg { font-size: 15px; padding: 12px 16px; }
  #chatInput { font-size: 16px; /* prevent zoom on iOS */ }
  #chatMessages { padding: 16px; }
  #chatHeader { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
  #chatInputArea { padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .chat-chip { padding: 8px 16px; font-size: 13px; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .modules-grid { grid-template-columns: 1fr; }
  .more-menu-grid { grid-template-columns: 1fr 1fr; }
  .chat-msg { font-size: 14px; padding: 10px 14px; }
}
.autocomplete-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
}
.autocomplete-input:focus {
  border-color: var(--primary);
}
.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.autocomplete-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--bg);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--primary); color: #fff; }
.autocomplete-item.disabled { color: var(--text-light); cursor: default; }
.autocomplete-item.disabled:hover { background: transparent; color: var(--text-light); }

body.loading #sidebar, body.loading #chatButton, body.loading #bottomNav, body.loading #menuToggle { display: none !important; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }
.toast.error { background: #9b2c2c; }
.toast.success { background: #276749; }

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--text-light);
  font-size: 14px;
}

/* Revenue bar chart */
.chart-container { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding: 8px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%; max-width: 48px;
  background: linear-gradient(to top, var(--primary), var(--primary-light));
  border-radius: 4px 4px 0 0;
  min-height: 8px;
  transition: height 0.3s;
  position: relative;
  cursor: pointer;
}
.chart-bar:hover { opacity: 0.8; }
.chart-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.chart-label { font-size: 10px; color: var(--text-light); margin-top: 6px; text-align: center; }

/* Alert banner */
.alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-banner.alert-danger { background: #fed7d7; color: #9b2c2c; border: 1px solid #feb2b2; }
.alert-banner.alert-warning { background: #fefcbf; color: #975a16; border: 1px solid #f6e05e; }
.alert-banner.alert-success { background: #c6f6d5; color: #276749; border: 1px solid #9ae6b4; }

/* Quick actions toolbar */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.quick-actions .btn { flex: 1; justify-content: center; min-width: 120px; }

/* Schedule cards */
.schedule-cards { display: flex; flex-direction: column; gap: 8px; }
.schedule-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
}
.schedule-card:hover { box-shadow: var(--shadow); }
.schedule-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  min-width: 70px;
  flex-shrink: 0;
}
.schedule-main { flex: 1; min-width: 0; }
.schedule-card .badge { margin-top: 4px; }

.tools-preview {
  font-size: 13px;
  line-height: 1.6;
  font-family: Arial, Helvetica, sans-serif;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
}


/* ===== Phase 1 Command Center ===== */
.command-center { max-width: 1100px; margin: 0 auto; padding-bottom: 24px; }
.cc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.cc-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
.cc-header h1 { font-size: 26px; line-height: 1.15; margin: 0 0 4px; color: var(--text); }
.cc-date { color: var(--text-light); font-size: 14px; margin: 0; }
.cc-refresh { min-height: 44px; }

.cc-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cc-alert {
  width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; background: var(--card); cursor: pointer; min-height: 52px;
  box-shadow: var(--shadow);
}
.cc-alert-title { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.cc-alert-msg { font-size: 13px; color: var(--text-light); }
.cc-alert-danger { border-left: 4px solid var(--danger); background: #fff5f5; }
.cc-alert-warning { border-left: 4px solid var(--warning); background: #fffff0; }
.cc-alert-info { border-left: 4px solid var(--primary); background: #ebf4ff; }
.cc-alert-success { border-left: 4px solid var(--success); background: #f0fff4; }

.cc-money {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px;
}
.cc-money-card {
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 12px; text-align: left; cursor: pointer; min-height: 88px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.cc-money-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-light); }
.cc-money-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.cc-money-meta { font-size: 12px; color: var(--text-light); }
.cc-money-card.danger .cc-money-value { color: #c53030; }
.cc-money-card.warn .cc-money-value { color: #b7791f; }
.cc-money-card.ok .cc-money-value { color: #276749; }

.cc-quick {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px;
}
.cc-quick-btn {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); font-weight: 700; font-size: 13px; cursor: pointer;
  color: var(--text); box-shadow: var(--shadow);
}
.cc-quick-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.cc-quick-btn:active { transform: scale(0.98); }

.cc-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; margin-bottom: 12px; }
.cc-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow); min-width: 0;
}
.cc-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cc-panel-head h2 { font-size: 15px; margin: 0; }
.cc-count {
  background: var(--primary); color: #fff; border-radius: 999px; font-size: 12px;
  font-weight: 700; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
}

.cc-job-list, .cc-queue, .cc-activity { display: flex; flex-direction: column; gap: 8px; }
.cc-job-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #fafbff;
}
.cc-job-main { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.cc-job-time {
  min-width: 64px; font-size: 12px; font-weight: 800; color: var(--primary);
  background: #e8eefc; border-radius: 8px; padding: 6px 8px; text-align: center;
}
.cc-job-client { font-weight: 700; font-size: 14px; }
.cc-job-task { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.cc-job-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-job-actions .btn, .cc-job-actions a.btn { min-height: 40px; text-decoration: none; display: inline-flex; align-items: center; }

.status-chip {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px;
  font-size: 11px; font-weight: 700; text-transform: capitalize; margin-left: auto;
  background: #edf2f7; color: #2d3748; white-space: nowrap;
}
.status-chip.status-scheduled, .status-chip.status-pending { background: #ebf8ff; color: #2b6cb0; }
.status-chip.status-completed, .status-chip.status-paid { background: #f0fff4; color: #276749; }
.status-chip.status-cancelled, .status-chip.status-overdue { background: #fff5f5; color: #c53030; }

.cc-queue-item {
  width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; background: #fff; cursor: pointer; min-height: 56px;
}
.cc-queue-title { font-weight: 700; font-size: 13px; }
.cc-queue-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.cc-activity-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.cc-activity-item:last-child { border-bottom: 0; }
.cc-activity-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--primary); flex-shrink: 0; }
.cc-activity-dot.type-paid { background: var(--success); }
.cc-activity-dot.type-overdue, .cc-activity-dot.type-draft { background: var(--danger); }
.cc-activity-dot.type-appointment { background: var(--accent); }
.cc-activity-title { font-size: 13px; font-weight: 600; }
.cc-activity-detail { font-size: 12px; color: var(--text-light); }

.cc-empty {
  color: var(--text-light); font-size: 13px; padding: 16px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cc-check-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cc-check-row .btn { min-height: 40px; }
.cc-upcoming { display: flex; flex-direction: column; gap: 8px; }
.cc-upcoming-row {
  display: grid; grid-template-columns: 90px 1fr 1fr; gap: 8px; font-size: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center;
}
.cc-chart { min-height: 160px; }
.cc-modules {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px;
}
.cc-mod {
  min-height: 56px; border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  font-weight: 700; font-size: 13px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; box-shadow: var(--shadow);
}
.cc-mod span {
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}

@media (max-width: 900px) {
  .cc-money { grid-template-columns: repeat(2, 1fr); }
  .cc-grid { grid-template-columns: 1fr; }
  .cc-quick { grid-template-columns: repeat(3, 1fr); }
  .cc-modules { grid-template-columns: repeat(2, 1fr); }
  .cc-upcoming-row { grid-template-columns: 1fr; gap: 2px; }
}
@media (max-width: 420px) {
  .cc-header h1 { font-size: 22px; }
  .cc-money-value { font-size: 18px; }
  .cc-quick { grid-template-columns: repeat(2, 1fr); }
  .cc-job-actions .btn, .cc-job-actions a.btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
}

/* Phase 2 invoice money engine */
.inv-status-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.inv-filter-chip {
  border: 1px solid var(--border); background: var(--card); border-radius: 999px;
  padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; min-height: 40px;
  color: var(--text); box-shadow: var(--shadow);
}
.inv-filter-chip span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: 6px; border-radius: 999px;
  background: #edf2f7; font-size: 11px; padding: 0 6px;
}
.inv-filter-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.inv-filter-chip.active span { background: rgba(255,255,255,0.2); color: #fff; }
.inv-row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.inv-row-actions .btn { min-height: 36px; }
.status-chip.status-partial { background: #fefcbf; color: #975a16; }
.status-chip.status-overdue { background: #fed7d7; color: #9b2c2c; }
.status-chip.status-draft { background: #e2e8f0; color: #2d3748; }
.status-chip.status-sent { background: #bee3f8; color: #2a4365; }
.status-chip.status-cancelled { background: #edf2f7; color: #718096; }
@media (max-width: 700px) {
  .inv-row-actions { flex-direction: column; }
  #inv-table-wrap table { font-size: 12px; }
}

/* build 2026-07-25-p2 */


/* Phase 3 field jobs */
.field-job-list { display: flex; flex-direction: column; gap: 10px; }
.field-job-card {
  background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--primary);
  border-radius: 14px; padding: 12px; box-shadow: var(--shadow);
}
.field-job-card.is-done { opacity: 0.72; }
.field-job-top { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.field-job-time {
  min-width: 64px; text-align: center; font-size: 12px; font-weight: 800; color: var(--primary);
  background: #e8eefc; border-radius: 10px; padding: 8px 6px;
}
.field-job-main { flex: 1; min-width: 0; }
.field-job-client { font-weight: 800; font-size: 15px; }
.field-job-task { font-size: 13px; color: var(--text); margin-top: 2px; }
.field-job-addr, .field-job-notes { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.field-job-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.field-job-actions .btn, .field-job-actions a.btn {
  min-height: 42px; text-decoration: none; display: inline-flex; align-items: center;
}
.field-day-group { margin-bottom: 14px; }
.field-day-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--primary); margin: 8px 0;
}
.cal-range-filters { margin-bottom: 12px; }
@media (max-width: 420px) {
  .field-job-actions .btn, .field-job-actions a.btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
}

/* Phase 4 client 360 + storage */
.client-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px;
}
.client-card {
  text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  padding: 14px; cursor: pointer; box-shadow: var(--shadow); min-height: 140px;
}
.client-card:active { transform: scale(0.99); }
.client-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.client-card-name { font-weight: 800; font-size: 15px; }
.client-card-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.client-card-money {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.client-card-money .lbl { display: block; font-size: 10px; text-transform: uppercase; color: var(--text-light); font-weight: 700; }
.client-card-money strong { font-size: 14px; }
.client-card-money strong.warn { color: #b7791f; }
.client-360-money { grid-template-columns: repeat(2, 1fr); }
.client-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-chip {
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  background: #edf2f7; color: #2d3748;
}
.client-card-foot {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 10px;
  font-size: 11px; color: var(--text-light);
}
.client-360-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.client-notes-box {
  white-space: pre-wrap; font-family: inherit; font-size: 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 160px; overflow: auto;
}
.storage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) {
  .storage-grid { grid-template-columns: 1fr; }
  .client-card-money { grid-template-columns: repeat(3, 1fr); }
}

/* Morning brief */
.cc-brief {
  background: linear-gradient(135deg, #ebf4ff 0%, #f7fafc 100%);
  border: 1px solid #bee3f8; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
}
.cc-brief-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary); margin-bottom: 8px; }
.cc-brief ul { margin: 0; padding-left: 18px; }
.cc-brief li { font-size: 14px; margin: 4px 0; color: var(--text); }

/* Reports + notifications */
.report-kv {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.report-kv strong { font-size: 14px; }
.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif-item {
  text-align: left; width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; padding: 10px 12px; cursor: pointer;
}
.notif-item.unread { border-left: 4px solid var(--primary); background: #f7fbff; }
.notif-title { font-weight: 700; font-size: 13px; }
.notif-msg { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* Daily ops + collect hub */
.daily-ops-panel { margin-bottom: 12px; }
.daily-ops-list { display: flex; flex-direction: column; gap: 8px; }
.daily-ops-item {
  display: flex; gap: 10px; align-items: stretch;
  border: 1px solid var(--border); border-radius: 12px; background: #fff; overflow: hidden;
}
.daily-ops-item.is-done { opacity: 0.55; }
.daily-ops-item.is-done .daily-ops-title { text-decoration: line-through; }
.daily-ops-check {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-width: 52px; background: #f7fafc; border-right: 1px solid var(--border);
  padding: 10px 6px; cursor: pointer;
}
.daily-ops-check input { width: 18px; height: 18px; }
.daily-ops-num {
  font-size: 11px; font-weight: 800; color: var(--primary);
  background: #e8eefc; border-radius: 999px; min-width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.daily-ops-body {
  flex: 1; text-align: left; border: 0; background: transparent; padding: 12px 12px 12px 0;
  cursor: pointer; min-height: 56px;
}
.daily-ops-title { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.daily-ops-detail { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.collect-hub { margin-bottom: 12px; }
.collect-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.collect-row:last-child { border-bottom: 0; }
.collect-client { font-weight: 800; font-size: 14px; }
.collect-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.collect-amt { font-weight: 800; font-size: 15px; color: #c53030; white-space: nowrap; }
.collect-actions { display: flex; gap: 6px; }
.collect-main { text-align: left; cursor: pointer; min-width: 0; }
@media (max-width: 600px) {
  .collect-row { grid-template-columns: 1fr; gap: 6px; }
  .collect-actions { width: 100%; }
  .collect-actions .btn { flex: 1; justify-content: center; min-height: 42px; }
}

/* =========================================================
   MOBILE APP SHELL — roomy, native feel (not crowded desktop)
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --radius: 16px;
    --shadow: 0 4px 16px rgba(15, 40, 80, 0.06);
    --app-pad: 18px;
    --app-gap: 16px;
    --bottom-nav-h: 72px;
  }

  html, body {
    background: #eef1f7;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
  }

  body {
    min-height: 100dvh;
  }

  /* Hide desktop chrome; phone is bottom-nav only */
  #sidebar { display: none !important; }
  #menuToggle {
    display: none !important; /* use bottom "More" instead of hamburger clutter */
  }

  #mainContent {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: calc(12px + env(safe-area-inset-top, 0px)) var(--app-pad) calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 100dvh;
  }

  /* Bottom tab bar — app style */
  #bottomNav {
    display: flex !important;
    height: auto;
    min-height: var(--bottom-nav-h);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(220, 226, 240, 0.9);
    box-shadow: 0 -8px 24px rgba(15, 40, 80, 0.06);
  }
  .bnav-item {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 14px;
    font-size: 11px;
  }
  .bnav-item.active {
    background: rgba(61, 90, 158, 0.08);
    color: var(--primary);
  }
  .bnav-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 10px;
  }
  .bnav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  /* Page headers breathe */
  .page-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px;
    margin-bottom: 18px !important;
    padding: 4px 2px 8px;
  }
  .page-header h1 {
    font-size: 28px !important;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }
  .page-header p {
    font-size: 14px !important;
    line-height: 1.4;
    margin-top: 4px;
  }
  .page-header .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-header .btn-group .btn {
    flex: 1 1 calc(50% - 10px);
    min-height: 48px;
    border-radius: 14px;
    justify-content: center;
  }

  /* Cards / sections — larger radius, more space */
  .section {
    padding: 18px !important;
    margin-bottom: var(--app-gap) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow) !important;
    border: 1px solid rgba(220, 226, 240, 0.7);
  }
  .section h2 {
    font-size: 15px !important;
    margin-bottom: 14px !important;
  }

  .cards {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 18px !important;
  }
  .cards .card {
    padding: 16px !important;
    border-radius: 16px;
  }
  .card .number { font-size: 22px !important; }

  /* Buttons — app sized */
  .btn {
    min-height: 48px;
    padding: 12px 18px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
    font-weight: 700;
  }
  .btn-sm {
    min-height: 44px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 12px !important;
  }
  .btn-group {
    gap: 10px !important;
  }

  /* Forms */
  .form-group { margin-bottom: 14px; }
  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 14px 16px !important;
    font-size: 16px !important; /* no iOS zoom */
    border-radius: 14px !important;
    min-height: 48px;
    border-color: #d5dced;
  }
  .form-group label {
    font-size: 13px !important;
    font-weight: 700;
    margin-bottom: 6px;
    color: #4a5568;
  }
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  /* Command center / Home */
  .command-center {
    max-width: 100% !important;
    padding-bottom: 8px;
  }
  .cc-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
    margin-bottom: 8px;
  }
  .cc-header h1 {
    font-size: 30px !important;
    letter-spacing: -0.03em;
  }
  .cc-date { font-size: 14px !important; line-height: 1.4; }
  .cc-refresh {
    width: 100%;
    min-height: 44px;
  }
  .cc-kicker {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .cc-brief {
    padding: 16px 18px !important;
    border-radius: 18px !important;
    margin-bottom: 16px !important;
  }
  .cc-brief li {
    font-size: 15px !important;
    margin: 8px 0 !important;
    line-height: 1.35;
  }

  .cc-alerts { gap: 12px !important; margin-bottom: 16px !important; }
  .cc-alert {
    padding: 16px !important;
    border-radius: 16px !important;
    min-height: 64px;
  }
  .cc-alert-title { font-size: 15px !important; }
  .cc-alert-msg { font-size: 14px !important; line-height: 1.35; }

  .cc-money {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  .cc-money-card {
    padding: 16px !important;
    border-radius: 18px !important;
    min-height: 100px !important;
    gap: 6px !important;
  }
  .cc-money-label { font-size: 11px !important; }
  .cc-money-value { font-size: 22px !important; }
  .cc-money-meta { font-size: 12px !important; }

  .cc-quick {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 18px !important;
  }
  .cc-quick-btn {
    min-height: 52px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
  }
  /* 5th button full width if odd */
  .cc-quick-btn:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .cc-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin-bottom: 14px !important;
  }
  .cc-panel {
    padding: 16px !important;
    border-radius: 18px !important;
    margin-bottom: 0;
  }
  .cc-panel-head {
    margin-bottom: 12px !important;
  }
  .cc-panel-head h2 {
    font-size: 16px !important;
  }

  /* Hide dense desktop extras on phone Home */
  .command-center .cc-grid + .cc-grid {
    display: none; /* recent activity + revenue chart — too desktop */
  }
  .cc-modules {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-top: 8px !important;
  }
  .cc-mod {
    min-height: 64px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
  }

  /* Daily ops roomier */
  .daily-ops-panel { margin-bottom: 16px !important; }
  .daily-ops-item {
    border-radius: 16px !important;
    min-height: 72px;
  }
  .daily-ops-check {
    min-width: 56px;
    padding: 12px 8px;
  }
  .daily-ops-body {
    padding: 14px 14px 14px 4px !important;
    min-height: 72px !important;
  }
  .daily-ops-title { font-size: 15px !important; }
  .daily-ops-detail { font-size: 13px !important; line-height: 1.35; margin-top: 4px !important; }

  .collect-hub { margin-bottom: 16px !important; }
  .collect-row {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 14px 0 !important;
  }
  .collect-client { font-size: 16px !important; }
  .collect-amt { font-size: 18px !important; }
  .collect-actions {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .collect-actions .btn {
    width: 100%;
    min-height: 48px !important;
    justify-content: center;
  }

  /* Filters as horizontal scroll chips */
  .inv-status-filters {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    gap: 10px !important;
    margin-bottom: 16px !important;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .inv-status-filters::-webkit-scrollbar { display: none; }
  .inv-filter-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 10px 16px !important;
    border-radius: 999px !important;
    font-size: 13px !important;
    white-space: nowrap;
  }

  /* Client cards */
  .client-card-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .client-card {
    padding: 18px !important;
    border-radius: 18px !important;
    min-height: 160px;
  }
  .client-card-name { font-size: 17px !important; }
  .client-card-money {
    margin-top: 14px !important;
    padding-top: 14px !important;
  }

  /* Field jobs */
  .field-job-card {
    padding: 16px !important;
    border-radius: 18px !important;
    margin-bottom: 2px;
  }
  .field-job-client { font-size: 16px !important; }
  .field-job-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }
  .field-job-actions .btn,
  .field-job-actions a.btn {
    width: 100%;
    min-height: 46px !important;
    justify-content: center;
  }

  /* Tables as roomy cards */
  .section table tr {
    padding: 16px !important;
    margin-bottom: 12px !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(15,40,80,0.04);
  }
  .section table td {
    padding: 8px 0 !important;
    font-size: 14px !important;
  }
  .inv-row-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    width: 100%;
  }
  .inv-row-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Modal = bottom sheet app style */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
    background: rgba(15, 23, 42, 0.45) !important;
  }
  .modal-overlay .modal {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 22px 22px 0 0 !important;
    max-height: 92dvh !important;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.18);
  }
  .modal-overlay .modal h2 {
    font-size: 22px !important;
    margin-bottom: 8px;
  }

  /* Chat FAB */
  #chatButton {
    bottom: calc(var(--bottom-nav-h) + 14px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    width: 58px !important;
    height: 58px !important;
    box-shadow: 0 8px 24px rgba(61, 90, 158, 0.35) !important;
  }
  #chatButton .chat-btn-label {
    font-size: 16px !important;
  }

  /* More menu sheet */
  .more-menu {
    border-radius: 22px 22px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .more-menu-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .more-item {
    min-height: 72px;
    border-radius: 16px;
    padding: 16px;
    font-size: 14px;
  }
  .more-close {
    min-height: 48px;
    border-radius: 14px;
    margin-top: 14px;
    width: 100%;
  }

  /* Toast higher above tab bar */
  .toast {
    bottom: calc(var(--bottom-nav-h) + 16px) !important;
    left: 16px !important;
    right: 16px !important;
    width: auto !important;
    border-radius: 14px;
  }

  /* Reports / storage */
  .storage-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  .report-kv { padding: 12px 0 !important; font-size: 14px !important; }
  .cc-chart { min-height: 140px; }

  /* Status chips slightly larger */
  .status-chip {
    padding: 6px 10px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  :root { --app-pad: 16px; }
  .cc-header h1 { font-size: 28px !important; }
  .page-header h1 { font-size: 26px !important; }
  .cc-money-value { font-size: 20px !important; }
  .cards { grid-template-columns: 1fr !important; }
}

/* Desktop: keep chat button clear of nothing special */
@media (min-width: 769px) {
  #bottomNav { display: none !important; }
}

/* Mobile login = app splash feel */
@media (max-width: 768px) {
  body:not(.app-desktop) #mainContent:has(#loginPass),
  #mainContent:has(#loginPass) {
    padding: 24px 20px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
  }
}
