/* ── CONFIG ── */
:root {
  --bg:        #0a0a0f;
  --surface:   #13131c;
  --border:    #2a2a3a;
  --accent:    #4f8ef7;
  --accent2:   #7c3aed;
  --ok:        #22c55e;
  --warn:      #f59e0b;
  --err:       #ef4444;
  --text:      #e8e8f0;
  --muted:     #6b6b80;
  --radius:    14px;
  --font:      'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,10,15,0.9);
}

.logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.logo span { color: var(--accent); }

.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.3s;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
}

.pill.online  .dot { background: var(--ok);   box-shadow: 0 0 6px var(--ok); }
.pill.offline .dot { background: var(--err); }
.pill.syncing .dot { background: var(--warn); animation: pulse 1s infinite; }
.pill.error   .dot { background: var(--err); }

@keyframes pulse {
  0%,100% { opacity:1; } 50% { opacity:0.4; }
}

.counter {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.counter b { color: var(--accent); }

/* ── EYE BUTTON ── */
.eye-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.eye-btn:active { transform: scale(0.93); }

.eye-btn.privacy-on {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── TABS ── */
.tabs {
  display: flex;
  padding: 16px 24px 0;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── VIEWS ── */
.view { display: none; flex: 1; padding: 24px; flex-direction: column; }
.view.active { display: flex; }

/* ── FORM ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
}

.form-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

.field { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"] {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px; /* prevent zoom on iOS */
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,0.15);
}

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active    { transform: scale(0.98); background: #3d7de8; }
.btn-primary:disabled  { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.btn-secondary:active { transform: scale(0.98); }

.btn-danger {
  background: transparent;
  color: var(--err);
  border: 1px solid var(--err);
  margin-top: 10px;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ok);
  color: #fff;
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--err); }

/* ── LIST ── */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.list-title { font-size: 18px; font-weight: 600; }

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}

.badge.pending { background: var(--warn); color: #000; }

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.contact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}

.contact-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.contact-info    { flex: 1; min-width: 0; }
.contact-name    { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-company { font-size: 12px; color: var(--muted); margin-top: 2px; }
.contact-email   { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sync-icon { font-size: 16px; flex-shrink: 0; }

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 12px;
  text-align: center;
  padding: 40px;
}

.empty-icon { font-size: 48px; }

/* ── SETTINGS ── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  max-width: 540px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.settings-row {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.settings-row:last-child { border-bottom: none; }

.settings-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.settings-input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  -webkit-appearance: none;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-hint {
  font-size: 11px;
  color: var(--muted);
}

.settings-user {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
}

.sync-all-btn {
  max-width: 540px;
  margin: 0 auto;
  width: 100%;
}

.log-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  height: 100px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-ok   { color: var(--ok); }
.log-err  { color: var(--err); }
.log-info { color: var(--accent); }

/* ── LOGIN PAGE ── */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 32px;
}

.login-logo {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-logo span { color: var(--accent); }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.login-error {
  font-size: 13px;
  color: var(--err);
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
}

.login-error.visible { display: block; }

.ms-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: #2f2f2f;
  border: 1px solid #444;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.ms-btn:hover   { background: #3a3a3a; }
.ms-btn:active  { background: #252525; }
.ms-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ms-logo {
  width: 20px; height: 20px;
  flex-shrink: 0;
}
