
:root {
  --gold: #D4A017;
  --gold-light: #F5C842;
  --dark: #111110;
  --dark2: #1C1C1A;
  --mid: #4A4A45;
  --muted: #7C7A72;
  --line: #E5E1D8;
  --surface: #FAFAF7;
  --white: #FFFFFF;
  --danger: #C0392B;
  --danger-pale: #FDF0EE;
  --success: #1E7A4E;
  --success-pale: #EAF5EF;
  --info: #1A5EA8;
  --info-pale: #EBF2FC;
  --warn: #B06000;
  --warn-pale: #FDF4E3;
  --radius: 10px;
  --radius-lg: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--surface); color: var(--dark); font-size: 14px; line-height: 1.55; }

/* ── SIDEBAR ── */
.sidebar {
  width: 220px; background: var(--dark); color: white;
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 100;
}
.sidebar-header { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.brand { font-weight: 800; color: var(--gold-light); letter-spacing: .04em; font-size: 15px; }
.sub { font-size: 11px; color: rgba(255,255,255,.38); margin-top: 2px; }
.nav { padding: 10px 0; flex: 1; }
.nav-section { padding: 10px 18px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.28); }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 18px; cursor: pointer;
  color: rgba(255,255,255,.62); font-size: 13px;
  text-decoration: none; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: rgba(212,160,23,.13); color: var(--gold-light); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; background: var(--gold); border-radius: 0 2px 2px 0; }
.nav-item { position: relative; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.user-block { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.user-name { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.8); }
.user-plan { font-size: 10px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .06em; }
.btn-logout { background: none; border: none; color: rgba(255,255,255,.3); font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.btn-logout:hover { color: rgba(255,255,255,.6); }
.usage-bar { margin-top: 8px; }
.usage-label { font-size: 10px; color: rgba(255,255,255,.35); margin-bottom: 4px; display: flex; justify-content: space-between; }
.usage-track { height: 3px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.usage-fill { height: 100%; background: var(--gold); border-radius: 2px; transition: width .3s; }

/* ── MAIN ── */
.main { margin-left: 220px; min-height: 100vh; padding: 32px 32px 60px; }

/* ── HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--dark); letter-spacing: -.02em; margin: 0; }
.page-subtitle { font-size: 13px; color: var(--muted); margin: 2px 0 0; }

/* ── FILTERS ── */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--line); background: white; color: var(--mid);
  cursor: pointer; transition: all .15s; letter-spacing: .02em;
}
.filter-btn:hover { border-color: var(--gold); color: var(--gold); }
.filter-btn.active { background: var(--dark); border-color: var(--dark); color: var(--gold-light); }
.search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.search-wrap input {
  width: 100%; padding: 7px 12px 7px 34px;
  border: 1.5px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--dark); background: white;
  outline: none; transition: border-color .15s;
}
.search-wrap input:focus { border-color: var(--gold); }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }

/* ── BTN ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 700; cursor: pointer; border: none; transition: all .15s; }
.btn-gold { background: var(--gold); color: var(--dark); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--mid); }
.btn-outline:hover { border-color: var(--mid); color: var(--dark); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── STATS ROW ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.stat-val { font-size: 24px; font-weight: 800; color: var(--dark); }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── CLIENTS GRID ── */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.client-skeleton {
  height: 148px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg,#f0ede8 25%,#fafaf7 50%,#f0ede8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── CLIENT CARD ── */
.client-card {
  background: white; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; cursor: pointer; transition: all .18s; position: relative;
  text-decoration: none; color: inherit; display: block;
}
.client-card:hover { border-color: var(--gold); box-shadow: 0 4px 16px rgba(212,160,23,.1); transform: translateY(-1px); }
.client-card:focus-visible { outline: 3px solid rgba(212,160,23,.35); outline-offset: 2px; }
.client-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.client-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--dark); color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0; letter-spacing: -.02em;
}
.client-status { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; letter-spacing: .04em; }
.status-active { background: var(--success-pale); color: var(--success); }
.status-paused { background: var(--warn-pale); color: var(--warn); }
.status-done { background: var(--line); color: var(--muted); }
.status-new { background: var(--info-pale); color: var(--info); }
.status-deleted { background: var(--line); color: var(--muted); }
.client-company { font-size: 15px; font-weight: 800; color: var(--dark); margin-bottom: 2px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-niche { font-size: 12px; color: var(--muted); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-service-alert {
  display: grid;
  grid-template-columns: 10px minmax(0, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 26px;
  margin: -2px 0 10px;
  padding: 5px 8px;
  border: 1px solid #F3C5BD;
  border-radius: 8px;
  background: var(--danger-pale);
  color: var(--danger);
  font-size: 11px;
  font-weight: 900;
}
.client-service-alert small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.client-service-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
.client-maps-cta {
  width: 100%;
  min-height: 34px;
  margin: 2px 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: var(--dark);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.client-maps-cta:hover { background: var(--gold-light); }
.client-meta { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.client-meta-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mid); }
.client-meta-icon { font-size: 13px; color: var(--muted); width: 16px; text-align: center; flex-shrink: 0; }
.client-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  border-top: 1px solid var(--line);
  margin-top: 12px; padding-top: 12px;
}
.client-action {
  height: 28px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--white); color: var(--mid);
  font-size: 11px; font-weight: 800; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.client-action:hover { border-color: var(--gold); color: var(--dark); }
.client-action.primary { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.client-action.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-pale); }
.client-score { display: flex; align-items: center; gap: 6px; }
.score-bar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; max-width: 80px; }
.score-fill { height: 100%; border-radius: 2px; background: var(--gold); }
.task-badge {
  position: absolute; top: 14px; right: 14px;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 800; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; color: var(--line); }
.empty-title { font-size: 18px; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.empty-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; max-width: 340px; margin-left: auto; margin-right: auto; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: var(--radius-lg); padding: 28px 28px 24px;
  width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto;
}
.modal-locations { max-width: 860px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--white); color: var(--mid);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { border-color: var(--gold); color: var(--dark); }
.modal-title { font-size: 18px; font-weight: 800; color: var(--dark); margin: 0 0 20px; }
.modal-subtitle { font-size: 13px; color: var(--muted); margin: -12px 0 20px; max-width: 560px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--mid); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--radius);
  font-size: 14px; color: var(--dark); outline: none; transition: border-color .15s; font-family: inherit;
}
.form-input:focus { border-color: var(--gold); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }

.locations-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr); gap: 16px; }
.locations-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}
.locations-panel-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.locations-list { display: flex; flex-direction: column; gap: 8px; }
.locations-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
  background: var(--white);
}
.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
}
.location-main { min-width: 0; }
.location-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 2px;
}
.location-details {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.location-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--success-pale);
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.limit-note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: -6px 0 18px;
  background: #FFF8E6;
  color: var(--mid);
  font-size: 12px;
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--dark); color: white; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  z-index: 9999; opacity: 0; transform: translateY(8px);
  transition: all .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ── LOADING ── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LIMIT BAR ── */
.limit-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255,255,255,.4); margin-bottom: 3px; }
.limit-name { width: 52px; }
.limit-track { flex: 1; height: 3px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.limit-fill { height: 100%; background: var(--gold); border-radius: 2px; }
.limit-count { min-width: 30px; text-align: right; font-size: 10px; }

@media (max-width: 768px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; padding: 20px 16px 40px; }
  .clients-grid { grid-template-columns: 1fr; }
  .locations-layout { grid-template-columns: 1fr; }
  .location-item { align-items: flex-start; flex-direction: column; }
  .location-item .client-action { width: 100%; }
}
@media (max-width: 600px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .modal { padding: 22px 18px 18px; }
}
