:root {
  --bg: #e8edf5;
  --sidebar: #1f2630;
  --sidebar-2: #2a3340;
  --card: #ffffff;
  --text: #1e2530;
  --muted: #7b8698;
  --line: #e4e9f2;
  --primary: #4c6fff;
  --primary-2: #3b5bdb;
  --success: #2fbf71;
  --danger: #f25c5c;
  --warning: #f5a524;
  --info: #3db6e8;
  --star: #ffb400;
  --shadow: 0 10px 30px rgba(31, 38, 48, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
}

button, input, select { font-family: inherit; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, #171c24 100%);
  color: #d7deea;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  min-height: 100vh;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 8px 22px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4c6fff, #7a5cff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.brand strong { display: block; color: #fff; font-size: 15px; }
.brand span { font-size: 12px; color: #8b95a7; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #c5cedb;
  text-decoration: none;
  font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item.active { background: rgba(76, 111, 255, 0.18); color: #fff; }
.file-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--sidebar-2);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
}
.import-btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px #3a4554; }
.import-btn.danger {
  background: transparent;
  color: #ff8b8b;
  box-shadow: inset 0 0 0 1px rgba(242, 92, 92, 0.45);
}
.import-btn.danger:hover { background: rgba(242, 92, 92, 0.16); }
.import-btn svg { width: 18px; height: 18px; }
.import-btn:hover { background: #323c4c; }
.drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 38, 48, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  z-index: 30;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  padding: 24px;
}
.drop-overlay[hidden] { display: none; }

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 28px 40px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -0.03em; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.topbar-search {
  position: relative;
  width: min(420px, 100%);
}
.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.topbar-search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px 10px 38px;
  font-size: 14px;
  outline: none;
}
.topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(76, 111, 255, 0.12); }

.widgets {
  display: grid;
  grid-template-columns: 1.1fr repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.card, .widget {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.widget { padding: 18px 18px 16px; }
.weather-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.city-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f25c5c;
  box-shadow: 0 0 0 4px rgba(242, 92, 92, 0.15);
}
.weather-date { margin-top: 10px; color: var(--muted); font-size: 13px; }
.weather-time { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; margin: 2px 0 12px; }
.weather-now { display: flex; align-items: center; gap: 12px; }
.weather-icon { font-size: 28px; line-height: 1; }
.weather-now strong { display: block; font-size: 22px; }
.weather-now span { color: var(--muted); font-size: 13px; }

.kpi-head { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.kpi-ico svg { width: 18px; height: 18px; }
.kpi-blue { background: #edf1ff; color: var(--primary); }
.kpi-yellow { background: #fff6e5; color: #c47b00; }
.kpi-green { background: #e8f8ef; color: var(--success); }
.kpi-red { background: #fdecec; color: var(--danger); }
.kpi-value { font-size: 36px; font-weight: 700; letter-spacing: -0.04em; margin-top: 10px; }
.kpi-value.success { color: var(--success); }
.kpi-value.warning { color: #c47b00; }
.kpi-value.danger { color: var(--danger); }
.kpi-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }

.filters {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.filters-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filters-title { font-weight: 600; font-size: 14px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  appearance: none;
  border: 0;
  background: #eef1f7;
  color: #5b6578;
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 36px;
  min-width: 92px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}
.chip:hover { background: #e4e9f2; color: var(--text); }
.chip.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(76, 111, 255, 0.22);
}
.date-fields { display: flex; gap: 10px; }
.date-fields label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.date-fields input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  background: #fff;
}

.days-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 6px;
}
.day-pill {
  min-width: 132px;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
}
.day-pill strong { display: block; font-size: 13px; margin-bottom: 4px; }
.day-pill span { color: var(--muted); }

.filter-card {
  padding: 14px 18px 16px;
  margin-bottom: 12px;
  position: relative;
  z-index: 6;
  overflow: visible;
}
.filter-card-head {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
}
.table-card { overflow: hidden; }
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  align-items: flex-end;
}
.table-toolbar h2 { margin: 0; font-size: 16px; }
.table-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.table-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  position: relative;
  z-index: 5;
}
.ms { position: relative; min-width: 0; }
.ms-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ms-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.ms.open .ms-btn { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(76, 111, 255, 0.12); }
.ms-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted); }
.ms.open .ms-caret { transform: rotate(180deg); color: var(--primary); }
.ms-drop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(31, 38, 48, 0.16);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}
.ms-drop[hidden] { display: none; }
.ms-search {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}
.ms-options { overflow: auto; padding: 6px; }
.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.ms-option:hover { background: #f6f8ff; }
.ms-check {
  width: 16px;
  height: 16px;
  border: 1.5px solid #c5cddb;
  border-radius: 4px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: #fff;
}
.ms-option[aria-selected="true"] .ms-check {
  background: var(--primary);
  border-color: var(--primary);
}
.ms-check svg { width: 10px; height: 10px; color: #fff; display: none; }
.ms-option[aria-selected="true"] .ms-check svg { display: block; }
.ms-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.table-wrap { overflow: auto; max-height: calc(100vh - 420px); min-height: 280px; }
table { width: 100%; border-collapse: collapse; min-width: 1280px; }
th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f7f9fc;
  padding: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr { background: #fff; }
tbody tr:hover { background: #f6f8ff; }
.name {
  font-weight: 600;
  color: var(--text);
}
.city { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.cats { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.tag {
  background: #eef2fb;
  color: #44527a;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 500;
}
.rating { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.star { color: var(--star); font-size: 14px; }
.award {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #2a3346;
  font-size: 11px;
  font-weight: 600;
}
.award-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}
.phone,
.phone a {
  white-space: nowrap;

}
.phone a { color: var(--primary); text-decoration: none; font-weight: 600; }
.muted { color: var(--muted); }
.metro {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.metro-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  flex-shrink: 0;
}
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 7px;
  color: #44527a;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.link-chip:hover { border-color: var(--primary); color: var(--primary); }
.status-select {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  min-width: 124px;
}
.status-new { background: #edf1ff; color: var(--primary); }
.status-in_progress { background: #fff6e5; color: #c47b00; }
.status-success { background: #e8f8ef; color: #1f8a4c; }
.status-rejected { background: #fdecec; color: #c43b3b; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px !important; }
.pager {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
}
.pager button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.pager button[disabled] { opacity: .4; cursor: default; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #1f2630;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  font-size: 13px;
  z-index: 20;
}

@media (max-width: 1180px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow-x: hidden; overflow-y: auto; }
  .widgets { grid-template-columns: 1fr 1fr; }
  .sidebar { display: none; }
  .main {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: visible;
    height: auto;
  }
  .topbar, .widgets, .filters, .filter-card, .table-card, .days-strip { margin-bottom: 0; }
  .table-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-card { flex: none; overflow: visible; }
  .table-wrap {
    max-height: min(70dvh, 640px);
    min-height: 280px;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 720px) {
  .main { padding: 12px; gap: 12px; }
  .widgets { grid-template-columns: 1fr 1fr; gap: 12px; }
  .widget.weather { grid-column: 1 / -1; }
  .filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .table-toolbar, .topbar { display: block; }
  .topbar-search { width: 100%; margin-top: 12px; }
  .date-fields { margin-top: 0; flex-wrap: wrap; }
  .table-filters { grid-template-columns: 1fr 1fr; gap: 12px; }
}
