:root {
  --font-main: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --bg: #f5f7fa;
  --bg-elev: #ffffff;
  --bg-soft: #edf2f8;
  --text: #162334;
  --muted: #627489;
  --accent: #2d74d8;
  --accent-soft: #d9e7fb;
  --border: #d5deea;
  --danger: #ff5e5e;
  --sidebar-bg: linear-gradient(180deg, #11284a 0%, #0d1f39 100%);
  --sidebar-border: #1e3b63;
  --card-shadow: 0 8px 24px rgba(21, 52, 94, 0.08);
}

* {
  box-sizing: border-box;
  font-family: var(--font-main);
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, p {
  margin: 0;
}

.muted {
  color: var(--muted);
  margin-top: 6px;
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 320px 1fr;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 16px;
  transition: width 0.2s ease;
}

.sidebar.collapsed {
  width: 78px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.logo {
  background: rgba(36, 133, 97, 0.15);
  color: #58c48f;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.icon-btn,
.btn,
.tab-btn,
.mobile-tab-btn {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}

.icon-btn {
  padding: 8px 10px;
}

.sidebar .icon-btn {
  background: rgba(10, 26, 49, 0.5);
  border-color: rgba(198, 216, 240, 0.25);
  color: #dce9fb;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  text-decoration: none;
  color: #c6d8f0;
  padding: 10px 12px;
  border-radius: 10px;
}

.nav-item.active,
.nav-item:hover,
.tab-btn.active,
.mobile-tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.contacts-panel,
.content-panel {
  padding: 16px;
}

.content-panel {
  background: var(--bg);
}

.contacts-panel {
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}

.panel-header {
  margin-bottom: 14px;
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.autocomplete {
  position: absolute;
  width: 100%;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
  z-index: 2;
}

.autocomplete.visible {
  display: block;
}

.autocomplete li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.autocomplete li:last-child {
  border-bottom: none;
}

.contacts-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.contact-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.badge {
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.btn {
  padding: 10px 14px;
}

.tabs {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  padding: 8px 12px;
}

.tab-content {
  display: none;
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--card-shadow);
}

.tab-content.active {
  display: block;
}

.client-page {
  display: flex;
  justify-content: center;
  padding: 20px 12px 90px;
}

.mobile-shell {
  width: min(100%, 420px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  min-height: 80vh;
  box-shadow: var(--card-shadow);
}

.mobile-header {
  margin-bottom: 12px;
}

.mobile-tab-content {
  display: none;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: 12px;
  min-height: 180px;
}

.mobile-tab-content.active {
  display: block;
}

.mobile-tabs {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mobile-tab-btn {
  padding: 9px 6px;
  font-size: 13px;
}

@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 78px 1fr;
  }

  .contacts-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    grid-column: span 2;
  }

  .content-panel {
    grid-column: span 2;
  }
}
