/* ── Variables ── */
:root {
  --bg:        #0f0f14;
  --surface:   #17171f;
  --surface2:  #1e1e28;
  --surface3:  #25252f;
  --border:    rgba(255,255,255,0.07);
  --accent:    #c9a96e;
  --accent2:   #e8c98a;
  --text:      #e8e8f0;
  --text2:     #9090a8;
  --text3:     #5a5a72;
  --danger:    #e05c5c;
  --success:   #5cb87a;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 8px 32px rgba(0,0,0,0.4);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --sidebar-w: 320px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
  letter-spacing: 0.01em;
}

.logo svg { width: 32px; height: 32px; flex-shrink: 0; }

.btn-new {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.btn-new:hover { background: var(--accent2); transform: scale(1.05); }
.btn-new svg { width: 18px; height: 18px; }

/* ── Search ── */
.search-wrap {
  position: relative;
  padding: 12px 16px;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 28px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text3);
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 36px 9px 36px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
#search-input::placeholder { color: var(--text3); }
#search-input:focus { border-color: var(--accent); }

.clear-btn {
  position: absolute;
  right: 26px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  padding: 2px; display: flex;
  transition: color 0.2s;
}
.clear-btn:hover { color: var(--text); }
.clear-btn svg { width: 14px; height: 14px; }

/* ── Category Filter Dropdown ── */
.filter-wrap {
  padding: 0 16px 10px;
  flex-shrink: 0;
}

.cat-filter-row {
  display: flex;
  gap: 6px;
}

.cat-dropdown {
  position: relative;
  flex: 1;
}

.cat-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text2);
  font-family: var(--font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-dropdown-btn:hover { border-color: var(--accent); color: var(--accent); }
.cat-dropdown-btn.cat-active { border-color: var(--accent); color: var(--accent); background: rgba(201,169,110,0.08); }
.cat-dropdown-btn svg { flex-shrink: 0; transition: transform 0.2s; }

.cat-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 60;
  overflow: hidden;
}
.cat-dropdown-menu.open { display: block; }

.cat-dropdown-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.cat-dropdown-search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
}
.cat-dropdown-search-wrap input:focus { border-color: var(--accent); }
.cat-dropdown-search-wrap input::placeholder { color: var(--text3); }

.cat-dropdown-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.cat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  transition: background 0.1s;
}
.cat-dropdown-item:hover { background: var(--surface2); }

.cat-dropdown-item input[type=checkbox] {
  accent-color: var(--accent);
  width: 14px; height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.cat-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item-count { color: var(--text3); font-size: 11px; flex-shrink: 0; }

.cat-dropdown-empty {
  padding: 16px;
  text-align: center;
  color: var(--text3);
  font-size: 12px;
}

.cat-dropdown-footer {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}

.cat-footer-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.cat-footer-btn:hover { color: var(--text); background: var(--surface2); }
.cat-footer-manage { color: var(--accent); }
.cat-footer-manage:hover { color: var(--accent2); background: rgba(201,169,110,0.1); }

/* ── Category Manager ── */
.cat-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.cat-add-row input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
}
.cat-add-row input:focus { border-color: var(--accent); }
.cat-add-row input::placeholder { color: var(--text3); }

.cat-manage-list {
  max-height: 360px;
  overflow-y: auto;
}

.cat-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.cat-manage-item:last-child { border-bottom: none; }

.cat-manage-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-manage-count {
  color: var(--text3);
  font-size: 11.5px;
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

.cat-manage-rename,
.cat-manage-delete {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.cat-manage-rename:hover { color: var(--accent); background: rgba(201,169,110,0.1); }
.cat-manage-delete:hover { color: var(--danger); background: rgba(224,92,92,0.1); }

.cat-manage-empty {
  text-align: center;
  padding: 24px;
  color: var(--text3);
  font-size: 13px;
}

/* ── Form Select ── */
.form-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239090a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-select:focus { border-color: var(--accent); }
.form-select option { background: var(--surface2); color: var(--text); }

/* ── Contact List ── */
.contact-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
  margin-bottom: 2px;
}
.contact-item:hover { background: var(--surface2); }
.contact-item.active { background: var(--surface3); border-color: var(--border); }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface3), var(--surface2));
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.contact-info { min-width: 0; flex: 1; }
.contact-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-sub {
  font-size: 11.5px;
  color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.loading-state, .empty-msg {
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  padding: 40px 16px;
}

.load-more-wrap { padding: 8px 8px 16px; }
.btn-load-more {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-load-more:hover { border-color: var(--accent); color: var(--accent); }

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 11.5px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.offline-count {
  font-size: 10px;
  color: var(--text3);
  display: none;
}
.offline-count.visible { display: block; }

/* ── Sync Status ── */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--text3);
  opacity: 0;
  transition: opacity 0.3s;
}
.sync-status.sync-active { opacity: 1; }

.sync-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-dot.sync-online { background: var(--success); }
.sync-dot.sync-offline { background: var(--danger); }
.sync-dot.sync-pending { background: var(--accent); }
.sync-dot.sync-syncing { background: var(--accent); animation: syncPulse 1s infinite; }

@keyframes syncPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Detail Panel ── */
#detail-panel {
  flex: 1;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  position: relative;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text3);
}
.empty-state svg { width: 80px; height: 80px; opacity: 0.4; }
.empty-state p { font-family: var(--font-display); font-size: 18px; color: var(--text2); }
.empty-state span { font-size: 13px; }

/* ── Contact Detail ── */
.detail-header {
  padding: 32px 40px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface3), var(--surface2));
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.detail-title { flex: 1; min-width: 0; }
.detail-name {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
}
.detail-company {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 6px;
}
.detail-cat {
  display: inline-block;
  background: rgba(201,169,110,0.12);
  color: var(--accent);
  border: 1px solid rgba(201,169,110,0.25);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── Detail Sections ── */
.detail-body { padding: 24px 40px 40px; }

.detail-section {
  margin-bottom: 28px;
}
.section-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.2s;
}
.info-card:hover { border-color: rgba(201,169,110,0.3); }

.info-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
}

.info-value {
  font-size: 13.5px;
  color: var(--text);
  word-break: break-word;
}

.info-value a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.info-value a:hover { color: var(--accent2); }

.notes-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.6;
  white-space: pre-wrap;
}

.child-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.child-name { font-size: 13.5px; font-weight: 500; }
.child-meta { font-size: 11.5px; color: var(--text3); margin-top: 1px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

@media (max-width: 700px) {
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal {
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text);
}

.modal-body {
  overflow-y: auto;
  padding: 20px 24px;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Form ── */
.form-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.form-section-label:first-child { margin-top: 0; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.form-group input,
.form-group textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-group textarea { resize: vertical; min-height: 72px; }
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text3); }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--text2); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(224,92,92,0.3);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  margin-right: auto;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(224,92,92,0.1); border-color: var(--danger); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text);
  z-index: 200;
  transition: transform 0.3s ease;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(92,184,122,0.4); color: var(--success); }
.toast.error { border-color: rgba(224,92,92,0.4); color: var(--danger); }

/* ── Mobile Back Button ── */
.mobile-back {
  display: none !important;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 50;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.mobile-back svg { width: 20px; height: 20px; }

/* ── Responsive / Mobile ── */
@media (max-width: 700px) {
  body { position: relative; overflow: hidden; }

  #sidebar {
    position: fixed; inset: 0;
    width: 100%; min-width: unset;
    z-index: 10;
    transform: translateX(0);
  }
  #sidebar.hidden { transform: translateX(-100%); }

  #detail-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    height: 100%;
    height: 100dvh;
    z-index: 20;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #detail-panel.visible { transform: translateX(0); }

  .mobile-back.visible { display: flex !important; }

  .detail-header { padding: 72px 20px 20px; }
  .detail-body { padding: 20px 20px 20px; padding-bottom: max(40px, calc(20px + env(safe-area-inset-bottom))); }

  .detail-actions { gap: 6px; }
}

/* ── Phone/Email Picker ── */
.picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.12s ease;
}

.picker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow);
  animation: slideUp 0.15s ease;
  overflow: hidden;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.picker-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
}

.picker-close { width: 30px; height: 30px; }
.picker-close svg { width: 14px; height: 14px; }

.picker-list {
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 12px 20px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  font-family: var(--font-body);
}
.picker-item:hover { background: var(--surface2); }

.picker-item-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
}

.picker-item-value {
  font-size: 15px;
  color: var(--accent);
}

/* ── Auth Pages ── */
.auth-body {
  display: block;
  height: auto;
  overflow: auto;
}

.auth-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  box-sizing: border-box;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
}

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--text);
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.auth-field input:focus {
  border-color: var(--accent);
}

.auth-field input::placeholder {
  color: var(--text3);
}

.auth-code-input {
  text-align: center;
  font-size: 24px !important;
  letter-spacing: 0.3em;
  font-family: var(--font-display) !important;
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  margin-top: 8px;
}

.auth-links {
  text-align: center;
  margin-top: 20px;
}

.auth-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.auth-links a:hover {
  color: var(--accent2);
}

.auth-flash {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}

.auth-flash-error {
  background: rgba(224,92,92,0.08);
  border-color: rgba(224,92,92,0.3);
  color: var(--danger);
}

.auth-flash-success {
  background: rgba(92,184,122,0.08);
  border-color: rgba(92,184,122,0.3);
  color: var(--success);
}

.auth-flash-info {
  background: rgba(201,169,110,0.08);
  border-color: rgba(201,169,110,0.3);
  color: var(--accent);
}

.auth-qr-wrap {
  text-align: center;
  margin: 24px 0;
}

.auth-qr {
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 12px;
  width: 250px;
  height: 250px;
  image-rendering: pixelated;
}

.auth-manual-key {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text2);
}

.auth-manual-key summary {
  cursor: pointer;
  color: var(--accent);
  margin-bottom: 8px;
}

.auth-card--wide {
  max-width: 560px;
}

.admin-section {
  margin-bottom: 24px;
}

.admin-subtitle {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text2);
  margin-bottom: 10px;
}

.auth-secret {
  display: block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}
