  :root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3345;
    --text: #e4e6f0;
    --text-muted: #8b8fa3;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --toured: #00b894;
    --scheduled: #6c5ce7;
    --untoured: #fdcb6e;
    --danger: #e17055;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    max-width: 100vw;
  }

  header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(15, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .lang-toggle {
    display: flex;
    background: var(--surface2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
  }

  .lang-toggle button {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }

  .lang-toggle button.active {
    background: var(--accent);
    color: white;
  }

  .lang-toggle button:hover:not(.active) {
    color: var(--text);
  }

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

  .view-toggle button {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
  }

  .view-toggle button.active {
    background: var(--accent);
    color: white;
  }

  .view-toggle button:hover:not(.active) {
    color: var(--text);
  }

  .layout {
    display: flex;
    height: 100vh;
    padding-top: 64px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    width: 440px;
    min-width: 440px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
  }

  .sidebar::-webkit-scrollbar { width: 6px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }

  .sidebar-header {
    padding: 20px 20px 12px;
    position: sticky;
    top: 0;
    background: rgba(15, 17, 23, 0.92);
    backdrop-filter: blur(12px);
    z-index: 10;
  }

  .sidebar-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
  }

  .legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
  }

  .legend-dot.toured { background: var(--toured); }
  .legend-dot.scheduled { background: var(--scheduled); }
  .legend-dot.untoured { background: var(--untoured); }

  .card {
    margin: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s ease;
    cursor: pointer;
    min-width: 0;
    max-width: 100%;
  }

  .card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow);
    transform: translateY(-2px);
  }

  .card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow);
  }

  .card-images {
    position: relative;
    height: 200px;
    overflow: hidden;
  }

  .card-images .carousel {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
  }

  .card-images .carousel img {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
  }

  .carousel-nav:hover { background: rgba(0,0,0,0.8); }
  .carousel-nav.prev { left: 8px; }
  .carousel-nav.next { right: 8px; }

  .carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 2;
  }

  .carousel-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: background 0.2s;
  }

  .carousel-dots .dot.active { background: white; }

  .carousel-counter {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.6);
    padding: 3px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
  }

  .status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
  }

  .status-badge.toured { background: var(--toured); color: #1a1d27; }
  .status-badge.scheduled { background: var(--scheduled); color: white; }
  .status-badge.untoured { background: var(--untoured); color: #1a1d27; }

  .card-body { padding: 16px; min-width: 0; overflow-wrap: break-word; }

  .card-body h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
  }

  .card-body .address {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
  }

  .card-body .details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
  }

  .detail-tag {
    background: var(--surface2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
  }

  .detail-tag.period {
    background: rgba(162, 155, 254, 0.12);
    color: var(--accent-light);
    border: 1px solid rgba(162, 155, 254, 0.25);
  }

  .card-extras {
    position: relative;
    padding-top: 4px;
    margin: 0 16px;
  }

  .card-extras::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
  }

  .fengshui-section {
    padding: 0 0 4px;
  }

  .fengshui-toggle, .photos-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 0;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: color 0.2s;
  }

  .fengshui-toggle:hover, .photos-toggle:hover { color: var(--accent-light); }

  .fengshui-toggle .arrow, .photos-toggle .arrow {
    font-size: 10px;
    transition: transform 0.25s ease;
    display: inline-block;
  }

  .fengshui-toggle .arrow.open, .photos-toggle .arrow.open { transform: rotate(90deg); }

  .fengshui-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
    padding-bottom: 0;
  }

  .fengshui-fields.open {
    max-height: 300px;
    opacity: 1;
    padding-bottom: 10px;
  }

  .fs-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .fs-field label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .fs-field input, .fs-field select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    transition: border-color 0.2s;
  }

  .fs-field input:focus, .fs-field select:focus {
    outline: none;
    border-color: var(--accent);
  }

  .fs-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
  }

  .fs-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8fa3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
  }

  .fs-field select option {
    background: var(--surface);
    color: var(--text);
  }

  .detail-tag.reno-new {
    background: rgba(0, 184, 148, 0.12);
    color: var(--toured);
    border: 1px solid rgba(0, 184, 148, 0.25);
  }

  .detail-tag.reno-original {
    background: rgba(253, 203, 110, 0.10);
    color: var(--untoured);
    border: 1px solid rgba(253, 203, 110, 0.2);
  }

  .card-body .amenities-preview {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .pricing-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
  }

  .price-box {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
  }

  .price-box:hover {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.08);
  }

  .price-box .price-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 4px;
  }

  .price-box .price-range {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
  }

  .price-box .price-link {
    font-size: 10px;
    color: var(--accent-light);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
  }

  .card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }

  .btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
  }

  .tour-status-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
  }

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

  .btn-status.untoured {
    background: rgba(253, 203, 110, 0.15);
    color: var(--untoured);
    border: 1px solid rgba(253, 203, 110, 0.3);
  }

  .btn-status.scheduled {
    background: rgba(108, 92, 231, 0.15);
    color: var(--scheduled);
    border: 1px solid rgba(108, 92, 231, 0.3);
  }

  .btn-status.toured {
    background: rgba(0, 184, 148, 0.15);
    color: var(--toured);
    border: 1px solid rgba(0, 184, 148, 0.3);
  }

  .btn-status:hover { opacity: 0.85; }

  .tour-date-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
  }

  .tour-date-group label {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
  }

  .tour-date-group input[type="date"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
  }

  .tour-date-group input[type="date"]:focus {
    border-color: var(--accent);
    outline: none;
  }

  .tour-date-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
  }

  .btn-reset-tour {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    opacity: 0.6;
  }

  .btn-reset-tour:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(225, 112, 85, 0.1);
  }

  .photos-section {
    padding: 0 0 4px;
  }

  .photos-fields {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
    padding-bottom: 0;
  }

  .photos-fields.open {
    max-height: 500px;
    opacity: 1;
    padding-bottom: 8px;
  }

  .photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
    padding: 0 0 4px;
  }

  .photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
  }

  .photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .photo-thumb .photo-delete {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .photo-thumb:hover .photo-delete { display: flex; }

  .photo-add-btn {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px dashed var(--border);
    background: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }

  .photo-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .btn-website {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .btn-website:hover { color: var(--text); border-color: var(--text-muted); }

  .comments-section {
    padding: 0 0 16px;
  }

  .comments-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
  }

  .comments-section textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s;
  }

  .comments-section textarea:focus {
    outline: none;
    border-color: var(--accent);
  }

  .comments-section textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
  }

  .save-indicator {
    font-size: 11px;
    color: var(--toured);
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.3s;
  }

  .save-indicator.show { opacity: 1; }

  #map {
    flex: 1;
    height: calc(100vh - 64px);
    z-index: 1;
  }

  .layout.card-view .sidebar {
    width: 100%;
    min-width: unset;
    height: calc(100vh - 64px);
    border-right: none;
  }

  .layout.card-view #cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
    padding: 16px;
  }

  .layout.card-view .card {
    margin: 0;
    cursor: default;
    display: flex;
    flex-direction: column;
  }

  .layout.card-view .card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .layout.card-view .card .card-actions {
    margin-top: auto;
  }

  .layout.card-view .card:hover {
    transform: none;
  }

  .layout.card-view #map {
    display: none;
  }

  .leaflet-popup-content-wrapper {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow) !important;
  }

  .leaflet-popup-tip {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
  }

  .leaflet-popup-content {
    margin: 12px 14px !important;
    font-family: inherit !important;
  }

  .popup-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
  }

  .popup-address {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
  }

  .popup-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .popup-status.toured { background: var(--toured); color: #1a1d27; }
  .popup-status.scheduled { background: var(--scheduled); color: white; }
  .popup-status.untoured { background: var(--untoured); color: #1a1d27; }

  .custom-marker {
    position: relative;
  }

  .marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -26px 0 0 -18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }

  .marker-pin.toured { background: var(--toured); }
  .marker-pin.scheduled { background: var(--scheduled); }
  .marker-pin.untoured { background: var(--untoured); }

  .marker-pin::after {
    content: '';
    width: 14px;
    height: 14px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    transform: rotate(45deg);
  }

  .marker-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
  }

  .marker-pulse.toured { background: var(--toured); }
  .marker-pulse.scheduled { background: var(--scheduled); }
  .marker-pulse.untoured { background: var(--untoured); }

  @keyframes pulse {
    0% { transform: scale(0.5); opacity: 0.6; }
    100% { transform: scale(2); opacity: 0; }
  }

  .leaflet-control-zoom a {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }

  .leaflet-control-zoom a:hover {
    background: var(--surface2) !important;
  }

  @media (max-width: 900px) {
    .layout { flex-direction: column-reverse; }
    .sidebar {
      width: 100%;
      min-width: unset;
      max-width: 100vw;
      height: 45vh;
      border-right: none;
      border-top: 1px solid var(--border);
    }
    #map { height: 55vh; }
    .card-images { height: 160px; }
    .card { margin: 12px 8px; }
    .card-extras { margin: 0 8px; }
    .layout.card-view #cards-container {
      grid-template-columns: 1fr;
      padding: 8px;
    }
    .layout.card-view .sidebar {
      height: calc(100vh - 64px);
      border-top: none;
    }
    .tour-date-group {
      flex-wrap: wrap;
    }
    .pricing-row {
      gap: 6px;
    }
    .price-box {
      padding: 8px 10px;
    }
    .price-box .price-range {
      font-size: 13px;
    }
  }

  #auth-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
  }
  #auth-gate.hidden { display: none; }
  #auth-gate h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  #auth-gate form {
    display: flex;
    gap: 10px;
  }
  #auth-gate input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 16px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    width: 220px;
    transition: border-color 0.2s;
  }
  #auth-gate input:focus { border-color: var(--accent); }
  #auth-gate button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s;
  }
  #auth-gate button:hover { opacity: 0.85; }
  #auth-gate .auth-error {
    color: var(--danger);
    font-size: 13px;
    height: 18px;
  }
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
  }
  .shake { animation: shake 0.4s ease; }
