/*
Theme Name: Apt Tracker
Theme URI: https://nativeweb.design
Author: nativeweb.design
Author URI: https://nativeweb.design
Description: A clean, minimal apartment tracking application built as a WordPress theme. Track listings, statuses, notes, and more.
Version: 2.0.8
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: apt-tracker
Tags: apartment, tracker, custom-post-type, minimal
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Geist:wght@400;500;600;700&display=swap');

/* =========================================
   CSS CUSTOM PROPERTIES
   ========================================= */
:root {
  --color-bg: #fafaf8;
  --color-surface: #ffffff;
  --color-surface-2: #f4f3f0;
  --color-border: #e8e6e1;
  --color-border-light: #f0eee9;
  --color-text: #1a1a18;
  --color-text-secondary: #6b6b67;
  --color-text-muted: #9c9c98;

  --color-accent: #2d5a3d;
  --color-accent-light: #e8f0eb;
  --color-accent-hover: #234830;

  /* Status colors */
  --status-interested: #3b6ea5;
  --status-interested-bg: #eaf0f8;
  --status-applied: #7c4dbd;
  --status-applied-bg: #f0eafa;
  --status-toured: #b07d2e;
  --status-toured-bg: #faf3e6;
  --status-rejected: #c0392b;
  --status-rejected-bg: #faecea;
  --status-leaning-yes: #2d7a4f;
  --status-leaning-yes-bg: #e8f5ee;
  --status-default: #6b6b67;
  --status-default-bg: #f4f3f0;

  --font-display: 'Geist', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);

  --transition: 150ms ease;
  --transition-md: 250ms ease;

  --container-max: 1200px;
  --sidebar-width: 280px;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', var(--font-body), system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--color-accent-hover); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { list-style: none; }

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

h1, h2, h3, h4, h5, h6 {
  font-family: 'Geist', var(--font-display), system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text);
}

/* =========================================
   LAYOUT
   ========================================= */
.apt-wrapper {
  display: flex;
  min-height: 100vh;
}

.apt-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}

.apt-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.apt-content {
  padding: 2.5rem 2.5rem;
  flex: 1;
  max-width: var(--container-max);
  width: 100%;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar-header {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
}

.sidebar-logo {
  font-family: 'Geist', var(--font-display), system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.sidebar-tagline {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
}

.sidebar-nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.sidebar-nav-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 450;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 500;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-item .nav-count {
  margin-left: auto;
  font-size: 0.6875rem;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.nav-item.active .nav-count {
  background: var(--color-accent);
  color: #fff;
}

/* Status filter items */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.user-actions a {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.user-actions a:hover { color: var(--color-text); }

/* =========================================
   PAGE HEADER
   ========================================= */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.page-header-left p {
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-danger {
  background: #faecea;
  color: var(--color-status-rejected, #c0392b);
  border-color: #f5c6c2;
}

.btn-danger:hover {
  background: #f5c6c2;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* =========================================
   FILTER BAR
   ========================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.filter-search input {
  width: 100%;
  padding: 0.5625rem 1rem 0.5625rem 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.875rem;
  transition: border-color var(--transition);
  outline: none;
}

.filter-search input:focus {
  border-color: var(--color-accent);
}

.filter-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  width: 15px;
  height: 15px;
}

.filter-select {
  padding: 0.5625rem 2rem 0.5625rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface) 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='%236b6b67' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.625rem center;
  color: var(--color-text);
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--color-accent); }

.view-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
}

.view-toggle-btn {
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.view-toggle-btn.active,
.view-toggle-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* =========================================
   STATUS BADGE
   ========================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.interested {
  background: var(--status-interested-bg);
  color: var(--status-interested);
}
.status-badge.interested::before { background: var(--status-interested); }

.status-badge.applied {
  background: var(--status-applied-bg);
  color: var(--status-applied);
}
.status-badge.applied::before { background: var(--status-applied); }

.status-badge.toured {
  background: var(--status-toured-bg);
  color: var(--status-toured);
}
.status-badge.toured::before { background: var(--status-toured); }

.status-badge.rejected {
  background: var(--status-rejected-bg);
  color: var(--status-rejected);
}
.status-badge.rejected::before { background: var(--status-rejected); }

.status-badge.leaning-yes {
  background: var(--status-leaning-yes-bg);
  color: var(--status-leaning-yes);
}
.status-badge.leaning-yes::before { background: var(--status-leaning-yes); }

.status-badge.saved,
.status-badge.default {
  background: var(--status-default-bg);
  color: var(--status-default);
}
.status-badge.saved::before,
.status-badge.default::before { background: var(--status-default); }

/* =========================================
   LISTING GRID
   ========================================= */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.listing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.listing-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border);
  transform: translateY(-1px);
}

.listing-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--color-surface-2);
  position: relative;
}

.listing-card-image-placeholder {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, var(--color-surface-2) 0%, var(--color-border-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.listing-card-body {
  padding: 1rem 1.125rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.listing-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.listing-card-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.3;
}

.listing-card-address {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.listing-card-address svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.listing-card-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.listing-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.listing-meta-label {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.listing-meta-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

.listing-meta-value.rent {
  color: var(--color-accent);
}

.listing-card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.listing-card-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* =========================================
   LISTING TABLE (list view)
   ========================================= */
.listings-table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.listings-table {
  width: 100%;
  border-collapse: collapse;
}

.listings-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2);
  white-space: nowrap;
}

.listings-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.listings-table th.sortable:hover { color: var(--color-text); }

.listings-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.875rem;
  color: var(--color-text);
  vertical-align: middle;
}

.listings-table tr:last-child td { border-bottom: none; }

.listings-table tbody tr {
  transition: background var(--transition);
}

.listings-table tbody tr:hover {
  background: var(--color-surface-2);
}

.listing-table-name {
  font-weight: 500;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.listing-table-name span {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.listing-table-actions {
  display: flex;
  gap: 0.375rem;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--transition);
}

.listings-table tr:hover .listing-table-actions { opacity: 1; }

/* =========================================
   STATS CARDS
   ========================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.stat-card-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.stat-card-accent { border-left: 3px solid var(--color-accent); }

/* =========================================
   EMPTY STATE
   ========================================= */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.3;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* =========================================
   SINGLE APARTMENT
   ========================================= */
.apt-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.apt-detail-main {}

.apt-detail-sidebar {}

.detail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
}

.detail-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-card-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text);
}

.detail-card-body {
  padding: 1.25rem;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 1rem;
}

.detail-field:last-child { margin-bottom: 0; }

.detail-field-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
}

.detail-field-value {
  font-size: 0.9375rem;
  color: var(--color-text);
}

.detail-field-value.large {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-accent);
}

.detail-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.notes-area {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.6;
}

.notes-area:focus { border-color: var(--color-accent); }

/* Map */
#apt-map {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  overflow: hidden;
}

/* =========================================
   FORM (Add/Edit)
   ========================================= */
.apt-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.form-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border-light);
}

.form-section:last-child { border-bottom: none; }

.form-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 1.25rem;
  color: var(--color-text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-field.span-2 { grid-column: span 2; }

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-status-rejected, #c0392b);
}

.form-input,
.form-select,
.form-textarea {
  padding: 0.5625rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent);
}

.form-select {
  appearance: none;
  -webkit-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='%236b6b67' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.form-actions {
  padding: 1.25rem 1.5rem;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

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

.login-tagline {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.login-form .form-field { margin-bottom: 1rem; }

.login-form .form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: block;
  margin-bottom: 0.375rem;
}

.login-form .form-input {
  width: 100%;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 1.5rem;
  padding: 0.75rem;
}

.login-error {
  background: var(--status-rejected-bg);
  color: var(--status-rejected);
  border: 1px solid #f5c6c2;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.login-register {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* =========================================
   MOBILE MENU
   ========================================= */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 90;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--color-text);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}

/* =========================================
   NOTIFICATIONS / ALERTS
   ========================================= */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.alert-success {
  background: var(--status-leaning-yes-bg);
  color: var(--status-leaning-yes);
  border: 1px solid #b8dfca;
}

.alert-error {
  background: var(--status-rejected-bg);
  color: var(--status-rejected);
  border: 1px solid #f5c6c2;
}

/* =========================================
   PRIORITY INDICATOR
   ========================================= */
.priority-indicator {
  display: flex;
  gap: 2px;
}

.priority-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
}

.priority-dot.filled { background: var(--color-accent); }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
  .apt-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-md);
  }

  .apt-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.visible { display: block; }

  .apt-main { margin-left: 0; }

  .mobile-header { display: flex; }

  .apt-content { padding: 1.25rem 1rem; }

  .apt-detail-grid { grid-template-columns: 1fr; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: span 1; }

  .listings-grid { grid-template-columns: 1fr; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .listings-table th:nth-child(n+4),
  .listings-table td:nth-child(n+4) { display: none; }

  /* ── iOS zoom fix ────────────────────────────────
     iOS Safari zooms in on any input with font-size < 16px.
     Force all interactive fields to 16px on mobile.
     We use a viewport-relative approach so the visual size
     stays in proportion with the rest of the UI.
  ─────────────────────────────────────────────────── */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Keep the visual rhythm consistent at 16px baseline */
  .form-input,
  .form-select,
  .form-textarea,
  .filter-select,
  .notes-area,
  .parse-text-input,
  .parse-url-input {
    font-size: 16px !important;
  }

  /* Tighten padding on form sections for small screens */
  .form-section { padding: 1.125rem 1rem; }
  .form-actions { padding: 1rem; }

  /* Parse panel tabs — stack if very narrow */
  .parse-tabs { flex-wrap: wrap; }

  /* Filter bar — full width search on mobile */
  .filter-search { min-width: 100%; }
  .filter-bar { flex-wrap: wrap; }

  /* Page header tighten */
  .page-header { margin-bottom: 1.25rem; }
  .page-header-left h1 { font-size: 1.5rem; }

  /* Stat cards smaller on mobile */
  .stat-card { padding: 0.875rem 1rem; }
  .stat-card-value { font-size: 1.5rem; }

  /* Detail card body padding */
  .detail-card-body { padding: 1rem; }
  .detail-card-header { padding: 0.875rem 1rem; }

  /* Listing card meta wraps */
  .listing-card-meta { flex-wrap: wrap; gap: 0.625rem; }

  /* Update form */
  .update-form-inner { padding: 1rem; }
}

@media (max-width: 480px) {
  .apt-content { padding: 1rem 0.875rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { gap: 0.5rem; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .parse-input-row { flex-direction: column; }
  .parse-input-row .btn { width: 100%; justify-content: center; }

  /* Login card full width */
  .login-card { padding: 1.75rem 1.25rem; }

  /* Hide table on very small screens, show grid instead */
  .listings-table-wrap { display: none; }
}

/* =========================================
   PARSE PANEL
   ========================================= */
.parse-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: box-shadow var(--transition-md);
}

.parse-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.parse-panel-header:hover {
  background: var(--color-surface-2);
}

.parse-panel-header-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.parse-panel-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.parse-panel-title {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.parse-panel-subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}

.parse-panel-chevron {
  color: var(--color-text-muted);
  transition: transform var(--transition-md);
  flex-shrink: 0;
}

.parse-panel-chevron.open {
  transform: rotate(180deg);
}

.parse-panel-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--color-border-light);
  display: none;
}

.parse-panel-body.open {
  display: block;
}

/* Tabs */
.parse-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
}

.parse-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.parse-tab:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.parse-tab.active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-color: transparent;
}

.parse-tab-content {
  display: none;
}

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

.parse-input-row {
  display: flex;
  gap: 0.625rem;
  align-items: center;
}

.parse-url-input {
  flex: 1;
}

.parse-text-input {
  width: 100%;
  min-height: 120px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.parse-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* No API key notice */
.parse-no-key-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: var(--status-toured-bg);
  color: var(--status-toured);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  margin-top: 1rem;
  border: 1px solid #e8d5aa;
}

.parse-no-key-notice a {
  color: var(--status-toured);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Status messages */
.parse-status {
  margin-top: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.parse-status.loading {
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
}

.parse-status.error {
  background: var(--status-rejected-bg);
  color: var(--status-rejected);
  border: 1px solid #f5c6c2;
}

.parse-status.success {
  background: var(--status-leaning-yes-bg);
  color: var(--status-leaning-yes);
  border: 1px solid #b8dfca;
}

/* Spinner */
@keyframes apt-spin {
  to { transform: rotate(360deg); }
}

.parse-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: apt-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Preview grid */
.parse-preview {
  margin-top: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.parse-preview-header {
  padding: 0.75rem 1rem;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.parse-preview-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.parse-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0;
}

.parse-preview-field {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-border-light);
  border-right: 1px solid var(--color-border-light);
}

.parse-preview-field:last-child {
  border-bottom: none;
}

.parse-preview-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.parse-preview-value {
  font-size: 0.8125rem;
  color: var(--color-text);
  word-break: break-word;
}

.parse-preview-value.found {
  color: var(--status-leaning-yes);
}

.parse-preview-value.not-found {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Applied flash animation */
@keyframes apt-field-flash {
  0%   { background: var(--color-accent-light); }
  100% { background: transparent; }
}

.field-applied {
  animation: apt-field-flash 1.2s ease-out forwards;
  border-radius: var(--radius-sm);
}

/* =========================================
   CONTACTED STATUS
   ========================================= */
:root {
  --status-contacted: #0e7e74;
  --status-contacted-bg: #e6f5f4;
}

.status-badge.contacted {
  background: var(--status-contacted-bg);
  color: var(--status-contacted);
}
.status-badge.contacted::before { background: var(--status-contacted); }

/* =========================================
   UPDATES FEATURE
   ========================================= */
.update-form {
  border-top: 1px solid var(--color-border-light);
}

.update-form-inner {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background: var(--color-surface-2);
}

/* File drop zone */
.update-file-drop {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.update-file-drop:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.update-image {
  max-height: 180px;
  width: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  display: block;
  margin-top: 0.5rem;
}

.update-image-link {
  display: inline-block;
  margin-top: 0.625rem;
}

/* Updates list */
.updates-list {
  padding: 0;
}

.updates-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.updates-empty svg { opacity: 0.3; }

.update-entry {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border-light);
  transition: background var(--transition);
}

.update-entry:hover {
  background: var(--color-surface-2);
}

.update-entry:first-child {
  border-top: 1px solid var(--color-border-light);
}

.update-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.update-entry-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.update-author {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

.update-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.update-entry-note {
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.delete-update-btn {
  opacity: 0;
  transition: opacity var(--transition);
  color: var(--color-text-muted);
  padding: 0.25rem;
}

.update-entry:hover .delete-update-btn { opacity: 1; }

/* Shared font updates — login card */
.login-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

/* Detail card headers — tighten up */
.detail-card-header h3 {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Listing card title — sans weight */
.listing-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

/* Detail field value large — sans weight */
.detail-field-value.large {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-accent);
}

/* Parse panel info state (blocked site notice) */
.parse-status.info {
  background: var(--status-interested-bg);
  color: var(--status-interested);
  border: 1px solid #c2d5ed;
}

/* =========================================
   PARSE PANEL — IMAGE TAB
   ========================================= */
.parse-image-drop {
  display: flex;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-surface);
  text-align: center;
  user-select: none;
}

.parse-image-drop:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.parse-image-drop-text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.parse-image-drop-text strong {
  color: var(--color-text);
}

.parse-image-drop-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* =========================================
   COLLAPSIBLE FORM SECTIONS
   ========================================= */
.form-collapsible {
  border: none;
  padding: 0;
  margin: 0;
}

.form-collapsible-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  padding: 1.125rem 1.5rem;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  user-select: none;
  transition: background var(--transition);
}

/* Remove default marker in all browsers */
.form-collapsible-title::-webkit-details-marker { display: none; }
.form-collapsible-title::marker { display: none; content: ''; }

.form-collapsible-title:hover {
  background: var(--color-surface-2);
}

.form-collapsible-chevron {
  color: var(--color-text-muted);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

details[open] > .form-collapsible-title .form-collapsible-chevron {
  transform: rotate(180deg);
}

.form-collapsible-body {
  padding: 0 1.5rem 1.5rem;
}

/* Divider between summary and body */
details.form-collapsible[open] > summary {
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 1.25rem;
}

@media (max-width: 900px) {
  .form-collapsible-title { padding: 1rem; }
  .form-collapsible-body  { padding: 0 1rem 1rem; }
}
