﻿:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --line: #dde7e0;
  --line-strong: #c8d8cd;
  --text: #122118;
  --muted: #6f8374;
  --brand: #10a216;
  --brand-soft: rgba(16, 162, 22, 0.1);
  --shadow: 0 18px 60px rgba(18, 33, 24, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --row-height: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, rgba(16, 162, 22, 0.12), transparent 26%), linear-gradient(180deg, #f9fbfa 0%, var(--bg) 100%);
}

button, input { font: inherit; }

[hidden] { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(480px, 100%);
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(221, 231, 224, 0.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
}

.auth-logo {
  margin-inline: auto;
  margin-bottom: 16px;
}

.auth-card h1 {
  margin: 0 0 10px;
  color: var(--brand);
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.auth-error {
  min-height: 24px;
  color: #b42318;
}

.primary-btn {
  min-width: 220px;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #17a91f, #0c7e13);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 360px) minmax(380px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 8px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(200, 216, 205, 0.9);
}

.topbar-side {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  width: 142px;
  max-width: 100%;
  object-fit: contain;
}

.brand-copy h1 {
  margin: 0;
  font-size: 24px;
  line-height: 26px;
  font-weight: 500;
  color: var(--brand);
}

.menu-list {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-menu {
  justify-content: center;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 160px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 14px 16px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
}

.menu-item.active,
.menu-item:hover {
  background: var(--brand-soft);
  border-color: rgba(16, 162, 22, 0.22);
}

.menu-label { font-weight: 700; }

.menu-count {
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--brand);
  font-weight: 800;
}

.search-hero {
  position: relative;
  display: block;
}

.search-hero input {
  width: 100%;
  height: 56px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 64px 0 24px;
  font-size: 16px;
}

.search-hero input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(16, 162, 22, 0.12);
}

.search-icon {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  color: var(--muted);
}

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(200, 216, 205, 0.95);
  background: rgba(255, 255, 255, 0.88);
}

.session-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.session-copy strong,
.session-copy span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-copy strong {
  font-size: 13px;
}

.session-copy span {
  color: var(--muted);
  font-size: 12px;
}

.signout-btn {
  white-space: nowrap;
}

.content-grid {
  padding: 24px;
  min-height: 0;
  overflow: hidden;
}

.main-panel,
.view-card,
.table-shell,
.table-viewport {
  min-height: 0;
}

.main-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  height: 100%;
}

.card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(221, 231, 224, 0.95);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-chip {
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}

.filter-reset-btn {
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.filter-reset-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.view-card {
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  height: 100%;
}

.view-card-active { display: grid; }

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.table-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

.table-viewport {
  overflow: auto;
  position: relative;
  min-height: 0;
  height: 100%;
}

.contacts-row {
  display: grid;
  grid-template-columns: 1.3fr 1.1fr 0.95fr 1fr 1fr 0.8fr 0.6fr;
  gap: 18px;
  align-items: center;
}

.accounts-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.9fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.contacts-head,
.accounts-head {
  padding: 12px 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfb 0%, #f6faf7 100%);
}

.virtual-spacer { position: relative; }

.virtual-inner {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
}

.contact-row,
.account-row {
  min-height: var(--row-height);
  padding: 0 20px;
  border-bottom: 1px solid #eff4f0;
  background: rgba(255,255,255,0.72);
}

.contact-row:hover,
.account-row:hover { background: rgba(16, 162, 22, 0.05); }

.contact-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-name,
.account-display-name {
  font-size: 13px;
  font-weight: 700;
}

.account-name,
.contact-phone,
.contact-email,
.contact-updated,
.contact-favorite,
.account-id {
  color: var(--muted);
  font-size: 12px;
}

.contact-favorite,
.account-action {
  display: flex;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-active { color: #118f17; background: rgba(17,143,23,0.1); }
.status-inactive { color: #8b6d00; background: rgba(211,162,0,0.12); }
.status-suspended { color: #925c00; background: rgba(230,132,0,0.12); }

.action-btn {
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--brand);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}

.action-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.empty-state {
  padding: 36px 24px;
  color: var(--muted);
  text-align: center;
}

.auth-dialog {
  border: 0;
  padding: 0;
  border-radius: 22px;
  box-shadow: 0 32px 80px rgba(18, 33, 24, 0.22);
}

.auth-dialog::backdrop {
  background: rgba(9, 18, 12, 0.35);
}

.auth-dialog-inner {
  width: min(420px, calc(100vw - 32px));
  padding: 26px;
  display: grid;
  gap: 16px;
  text-align: center;
}

.google-button-mount {
  display: flex;
  justify-content: center;
}

@media (max-width: 1280px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar-side { grid-template-columns: 1fr; }
  .topbar-menu { justify-content: flex-start; flex-wrap: wrap; }
  .content-grid { overflow: auto; }
}

@media (max-width: 900px) {
  .app-shell { min-height: auto; }
  body { overflow: auto; }
  .content-grid { display: flex; flex-direction: column; }
  .menu-list { align-items: stretch; }
  .menu-item {
    min-width: 0;
    width: 100%;
  }
  .contacts-row,
  .contacts-head {
    grid-template-columns: 1.3fr 1fr 1fr;
  }
  .contacts-head span:nth-child(n + 4),
  .contact-row > :nth-child(n + 4) {
    display: none;
  }
  .accounts-row,
  .accounts-head {
    grid-template-columns: 1.3fr 1fr;
  }
  .accounts-head span:nth-child(n + 3),
  .account-row > :nth-child(n + 3) {
    display: none;
  }
}

.toolbar-primary-btn {
  min-width: 0;
  padding-inline: 18px;
}

.form-dialog {
  border: 0;
  padding: 0;
  border-radius: 26px;
  background: transparent;
  box-shadow: 0 32px 80px rgba(18, 33, 24, 0.22);
  overflow: visible;
}

.form-dialog::backdrop {
  background: rgba(9, 18, 12, 0.42);
}

.form-dialog-inner {
  width: min(560px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  background: rgba(255, 255, 255, 0.98);
  padding: 26px;
  border-radius: 26px;
  display: grid;
  gap: 16px;
  position: relative;
  overflow: visible;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-head h2 {
  margin: 0 0 6px;
}

.dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.field-group {
  display: grid;
  gap: 8px;
}

.field-group > span {
  font-size: 13px;
  font-weight: 700;
}

.field-group input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: white;
  padding: 0 16px;
}

.field-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(16, 162, 22, 0.12);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.autocomplete-field {
  position: relative;
  z-index: 5;
}

.autocomplete-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.99);
  box-shadow: 0 18px 44px rgba(18, 33, 24, 0.12);
  padding: 8px;
}

.autocomplete-option {
  border: 0;
  background: transparent;
  text-align: right;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
  background: var(--brand-soft);
  outline: none;
}

.autocomplete-option strong {
  font-size: 13px;
}

.autocomplete-option span {
  font-size: 12px;
  color: var(--muted);
}

.form-error,
.form-success,
.duplicate-check {
  margin: 0;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
}

.form-error {
  color: #b42318;
  background: rgba(180, 35, 24, 0.08);
}

.form-success {
  color: #0c7e13;
  background: rgba(16, 162, 22, 0.08);
}

.duplicate-check {
  color: #925c00;
  background: rgba(230, 132, 0, 0.12);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .view-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-primary-btn,
  .dialog-actions .primary-btn,
  .dialog-actions .filter-reset-btn {
    width: 100%;
  }
}

.contact-row {
  cursor: pointer;
}

.contact-row:focus-visible {
  outline: 2px solid rgba(16, 162, 22, 0.4);
  outline-offset: -2px;
}



#createContactEmail {
  direction: ltr;
  text-align: left;
}

.danger-btn {
  border: 1px solid rgba(180, 35, 24, 0.25);
  background: rgba(180, 35, 24, 0.08);
  color: #b42318;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

.danger-btn:hover {
  background: rgba(180, 35, 24, 0.14);
  border-color: rgba(180, 35, 24, 0.4);
}
