/*
 * AssetPipe Module 1 — Page-specific styles
 * Built on top of design-system.css tokens
 */

/* ========================================================================
   Auth Pages
   ======================================================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F8FAFB 0%, #E5E7EB 100%);
    padding: var(--space-6);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-primary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    justify-content: center;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-gis);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: var(--bg-primary);
}

.auth-logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    text-align: center;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-6);
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 14px;
    color: var(--text-tertiary);
}

.auth-footer a {
    color: var(--accent-geo);
    font-weight: 500;
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-brand h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}

.auth-brand p {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ========================================================================
   Dashboard
   ======================================================================== */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-primary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-lg);
    padding: var(--space-5);
    border-left: 4px solid var(--accent-gis);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dashboard-section {
    margin-bottom: var(--space-8);
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.dashboard-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Activity feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: var(--border-subtle);
    font-size: 14px;
    color: var(--text-secondary);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.activity-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--accent-gis); }
.activity-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.activity-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }
.activity-icon.info { background: rgba(59, 130, 246, 0.15); color: var(--accent-geo); }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: var(--space-3);
}

/* ========================================================================
   Estate List & Detail
   ======================================================================== */

.estate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-6);
}

.estate-card {
    background: var(--bg-secondary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    text-decoration: none;
    color: inherit;
    display: block;
}

.estate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    color: inherit;
}

.estate-card-map {
    height: 180px;
    background: var(--bg-tertiary);
    position: relative;
}

.estate-card-body {
    padding: var(--space-4);
}

.estate-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.estate-card-location {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-3);
}

.estate-card-stats {
    display: flex;
    gap: var(--space-4);
    font-size: 14px;
}

.estate-card-stat {
    display: flex;
    flex-direction: column;
}

.estate-card-stat-value {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.estate-card-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Estate detail header */
.estate-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: 0;
    padding: var(--space-6);
    background: var(--bg-primary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: var(--shadow-sm);
}

.estate-header-info {
    flex: 1;
    min-width: 200px;
}

.estate-header-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    letter-spacing: -0.02em;
}

.estate-header-location {
    font-size: 14px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.estate-header-location i {
    color: var(--accent-gis);
}

/* ========================================================================
   Tab Navigation
   ======================================================================== */

.tab-nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-primary);
    border-left: var(--border-subtle);
    border-right: var(--border-subtle);
    padding: 0 var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-nav-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-decoration: none;
    user-select: none;
}

.tab-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-nav-item.is-active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 600;
}

.tab-nav-item i {
    width: 16px;
    height: 16px;
}

.tab-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--border-radius-full);
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.tab-nav-item.is-active .tab-nav-badge {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
}

.tab-panel {
    display: none;
    background: var(--bg-primary);
    border: var(--border-subtle);
    border-top: none;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    min-height: 400px;
}

.tab-panel.is-active {
    display: block;
}

/* Overview tab grid */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

@media (max-width: 1024px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

/* Mini stat cards for overview */
.mini-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.mini-stat {
    background: var(--bg-secondary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-md);
    padding: var(--space-4);
    text-align: center;
    transition: all 0.2s ease;
}

.mini-stat:hover {
    box-shadow: var(--shadow-sm);
}

.mini-stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    line-height: 1.2;
}

.mini-stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: var(--space-1);
}

.mini-stat.accent-green { border-left: 3px solid var(--accent-gis); }
.mini-stat.accent-blue { border-left: 3px solid var(--accent-primary); }
.mini-stat.accent-amber { border-left: 3px solid var(--accent-warning); }
.mini-stat.accent-red { border-left: 3px solid var(--accent-danger); }

/* Stands tab - map + list layout */
.stands-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-4);
}

.stands-map-container {
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: var(--border-subtle);
}

.stands-list-panel {
    display: flex;
    flex-direction: column;
    max-height: 600px;
    background: var(--bg-secondary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.stands-list-panel-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: var(--border-subtle);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.stands-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

@media (max-width: 1200px) {
    .stands-layout {
        grid-template-columns: 1fr;
    }
    .stands-list-panel {
        max-height: 350px;
    }
}

/* Section title within tabs */
.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-title i {
    color: var(--accent-primary);
    width: 18px;
    height: 18px;
}

/* Progress ring for overview */
.progress-ring-container {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--space-6);
}

.progress-ring-text {
    flex: 1;
}

.progress-ring-label {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
}

.progress-ring-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-gis);
}

/* Map tab full width */
.map-tab-container {
    margin: calc(-1 * var(--space-6));
    height: 600px;
}

.map-tab-container .map-container {
    height: 100%;
    border-radius: 0;
}

/* ========================================================================
   Stand List
   ======================================================================== */

.stand-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.stand-filters {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--border-radius-pill);
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
}

.filter-chip.is-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-gis);
    border-color: rgba(16, 185, 129, 0.3);
}

.stand-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stand-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.stand-card-number {
    font-size: 16px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.stand-card-meta {
    display: flex;
    gap: var(--space-4);
    font-size: 13px;
    color: var(--text-tertiary);
}

.stand-card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* ========================================================================
   Map + List Split View (Estate Detail)
   ======================================================================== */

.split-view {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 0;
    height: calc(100vh - var(--navbar-height));
    margin: calc(-1 * var(--space-6));
}

.split-view-map {
    position: relative;
}

.split-view-panel {
    background: var(--bg-secondary);
    border-left: var(--border-subtle);
    overflow-y: auto;
    padding: var(--space-4);
}

@media (max-width: 1024px) {
    .split-view {
        grid-template-columns: 1fr;
        grid-template-rows: 40vh 1fr;
    }
    .split-view-panel {
        border-left: none;
        border-top: var(--border-subtle);
    }
}

/* ========================================================================
   Search Bar
   ======================================================================== */

.search-bar {
    position: relative;
    max-width: 400px;
}

.search-bar-input {
    width: 100%;
    height: 40px;
    background: var(--bg-tertiary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-pill);
    padding: 0 var(--space-4) 0 40px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.search-bar-input:focus {
    outline: none;
    border-color: var(--accent-geo);
    background: var(--bg-secondary);
}

.search-bar-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ========================================================================
   Invite / Team Management
   ======================================================================== */

.team-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.team-member {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: var(--border-subtle);
    transition: background 0.15s ease;
}

.team-member:last-child {
    border-bottom: none;
}

.team-member:hover {
    background: var(--bg-secondary);
}

.team-member-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-geo) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

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

.team-member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.team-member-email {
    font-size: 13px;
    color: var(--text-tertiary);
}

.team-member-actions {
    display: flex;
    gap: var(--space-2);
}

/* ========================================================================
   QA Validation Queue
   ======================================================================== */

.qa-queue-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: var(--border-subtle);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--space-3);
    transition: background var(--transition-fast);
}

.qa-queue-item:hover {
    background: var(--bg-tertiary);
}

.qa-queue-item-map {
    width: 160px;
    height: 120px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.qa-queue-item-info {
    flex: 1;
    min-width: 0;
}

.qa-queue-item-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    justify-content: center;
}

/* ========================================================================
   Field Capture (Mobile-optimized)
   ======================================================================== */

.capture-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--navbar-height));
    margin: calc(-1 * var(--space-6));
}

.capture-map {
    flex: 1;
    position: relative;
    min-height: 300px;
}

.capture-controls {
    background: var(--bg-secondary);
    border-top: var(--border-default);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.capture-accuracy {
    text-align: center;
}

.capture-beacon-count {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.capture-beacon-count strong {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

/* Beacon list during documentation step */
.beacon-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.beacon-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border: var(--border-subtle);
}

.beacon-item-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gis);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.beacon-item-coords {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.beacon-item-photo {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
    border: var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}

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


/* ========================================================================
   Wizard / Stepped Form
   ======================================================================== */

.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    padding: var(--space-4) 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.wizard-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: var(--border-default);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.wizard-step.is-active {
    color: var(--accent-gis);
}
.wizard-step.is-active .wizard-step-number {
    background: var(--accent-gis);
    border-color: var(--accent-gis);
    color: white;
}

.wizard-step.is-complete {
    color: var(--text-secondary);
}
.wizard-step.is-complete .wizard-step-number {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-gis);
    color: var(--accent-gis);
}

.wizard-step-connector {
    width: 40px;
    height: 2px;
    background: var(--bg-tertiary);
}
.wizard-step-connector.is-complete {
    background: var(--accent-gis);
}


/* ========================================================================
   Notification Panel
   ======================================================================== */

.notification-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background: var(--surface-elevated);
    border: var(--border-default);
    border-radius: var(--border-radius-md);
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: var(--z-dropdown);
}
.notification-panel.is-open {
    display: block;
}

.notification-panel-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
}

.notification-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: var(--border-subtle);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.notification-item:hover {
    background: rgba(255, 255, 255, 0.03);
}
.notification-item.is-unread {
    background: rgba(59, 130, 246, 0.05);
}

.notification-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-geo);
    flex-shrink: 0;
    margin-top: 6px;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notification-item-message {
    font-size: 13px;
    color: var(--text-tertiary);
}

.notification-item-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}


/* ========================================================================
   CSV Upload Preview
   ======================================================================== */

.csv-preview {
    margin-top: var(--space-4);
    max-height: 400px;
    overflow: auto;
}

.csv-preview-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: rgba(16, 185, 129, 0.08);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-4);
    font-size: 14px;
    color: var(--accent-gis);
}

.csv-error-row {
    background: rgba(239, 68, 68, 0.05) !important;
}


/* ========================================================================
   Responsive overrides
   ======================================================================== */

@media (max-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: var(--space-6);
    }

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

    .qa-queue-item {
        flex-direction: column;
    }

    .qa-queue-item-map {
        width: 100%;
        height: 160px;
    }

    .notification-panel {
        width: calc(100vw - var(--space-8));
        right: calc(-1 * var(--space-4));
    }
}


/* ========================================================================
   Miningo Design System Extensions
   ======================================================================== */

/* Page Hero (Dark forest green header) */
.page-hero {
    background: var(--forest-dark);
    padding: 48px 32px;
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Ccircle cx='50' cy='50' r='40' fill='none' stroke='%23C9A84C' stroke-width='0.3' opacity='0.1'/%3E%3Ccircle cx='50' cy='50' r='30' fill='none' stroke='%23C9A84C' stroke-width='0.3' opacity='0.1'/%3E%3C/svg%3E");
    background-size: 100px 100px;
}

.page-hero-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
}

.page-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 40px;
    font-weight: 600;
    color: var(--parchment);
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
}

.page-hero-subtitle {
    color: var(--gold);
    font-size: 16px;
    opacity: 0.9;
}

.page-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(201, 168, 76, 0.15);
    border: 1px solid rgba(201, 168, 76, 0.3);
    color: var(--gold-light);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 20px;
}

/* Gold Button */
.btn-gold {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gold);
    color: var(--forest-dark);
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-gold:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 168, 76, 0.4);
}

/* Outline Button (for dark backgrounds) */
.btn-outline-light {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--parchment);
    border: 1px solid rgba(201, 168, 76, 0.4);
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-outline-light:hover {
    background: rgba(201, 168, 76, 0.1);
    border-color: var(--gold);
}

/* Tab Navigation (Dark) */
.tab-nav-dark {
    display: flex;
    gap: 4px;
    padding: 0 32px;
    background: var(--forest);
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.tab-nav-dark .tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    color: var(--parchment);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-nav-dark .tab-item:hover {
    color: var(--gold);
    background: rgba(201, 168, 76, 0.1);
}

.tab-nav-dark .tab-item.is-active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: rgba(201, 168, 76, 0.1);
}

.tab-badge {
    background: var(--gold);
    color: var(--forest-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    margin-left: 4px;
}

.estate-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Forest Card (Dark card on light background) */
.forest-card {
    background: var(--forest-dark);
    border-radius: 16px;
    padding: 28px;
    color: var(--parchment);
}

.forest-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 24px 0;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Info Row (for forest card) */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
}

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

.info-label {
    font-size: 13px;
    color: var(--gold);
    opacity: 0.8;
}

.info-value {
    font-weight: 500;
    font-size: 14px;
    color: var(--parchment);
}

/* Activity Item */
.activity-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: white;
    border: 1px solid var(--beige);
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.15s;
}

.activity-row:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(13, 41, 30, 0.08);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.success { background: #ECFDF5; color: #059669; }
.activity-icon.danger { background: #FEE2E2; color: #DC2626; }
.activity-icon.warning { background: #FEF3C7; color: #D97706; }
.activity-icon.info { background: #EFF6FF; color: #2563EB; }

.activity-content { flex: 1; min-width: 0; }

.activity-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

.activity-time {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    white-space: nowrap;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================================================
   Shared Dashboard Card Components (used by dashboard + estate detail)
   ======================================================================== */
.dash-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}
.dash-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid #F3F4F6;
}
.dash-card-header h3 {
    font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; margin: 0; color: var(--text-primary);
}
.dash-card-body { padding: 24px; }

/* Activity Items (shared) */
.dash-activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F3F4F6; }
.dash-activity-item:last-child { border-bottom: none; }
.dash-activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: #D1D5DB; }
.dash-activity-dot.success { background: #059669; }
.dash-activity-dot.danger { background: #DC2626; }
.dash-activity-dot.warning { background: #D97706; }
.dash-activity-dot.neutral { background: #9CA3AF; }
.dash-activity-text { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.dash-activity-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.dash-activity-time { font-size: 11px; color: var(--text-muted); font-weight: 500; white-space: nowrap; margin-top: 2px; }

/* ========================================================================
   Global Search Results Dropdown
   ======================================================================== */
.search-bar { position: relative; }
.gs-results {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--bg-primary); border: 1px solid #E5E7EB; border-radius: 12px;
    box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; z-index: 1000;
}
.gs-results.is-open { display: block; }
.gs-group {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); padding: 10px 16px 4px;
}
.gs-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    text-decoration: none; color: inherit; transition: background 0.12s;
}
.gs-item:hover { background: var(--bg-secondary); }
.gs-item-text { flex: 1; min-width: 0; }
.gs-item-title { font-size: 14px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-sub { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   AssetOps shared components (used by every /ops/* page)
   ============================================================ */

.ops-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.ops-kpi {
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ops-kpi:hover {
    border-color: #D1D5DB;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.ops-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ops-kpi-body { min-width: 0; }
.ops-kpi-value {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary, #111827);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.ops-kpi-label {
    font-size: 11px;
    color: var(--text-tertiary, #6B7280);
    font-weight: 600;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Compact stat-card row used at the top of list/index pages.
   Each card carries (icon, label, value) and an optional accent colour. */
.ops-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.ops-stat {
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.ops-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(107, 114, 128, 0.08);
    color: #6B7280;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ops-stat-body { min-width: 0; line-height: 1.2; }
.ops-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #111827);
    font-variant-numeric: tabular-nums;
}
.ops-stat-label {
    font-size: 11px;
    color: var(--text-tertiary, #6B7280);
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ops-stat--success .ops-stat-icon { background: rgba(16,185,129,0.10); color: #059669; }
.ops-stat--warning .ops-stat-icon { background: rgba(245,158,11,0.10); color: #D97706; }
.ops-stat--danger  .ops-stat-icon { background: rgba(220,38,38,0.10); color: #DC2626; }
.ops-stat--info    .ops-stat-icon { background: rgba(59,130,246,0.10); color: #3B82F6; }
.ops-stat--purple  .ops-stat-icon { background: rgba(124,58,237,0.10); color: #7C3AED; }

/* Legacy meta-bar pattern, kept for back-compat. New pages should use
   .ops-stat-row above. */
.ops-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 20px;
    padding: 12px 14px;
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 10px;
}
.ops-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.06);
    color: var(--text-secondary, #374151);
    font-size: 12px;
    font-weight: 600;
}

/* Cards used on the dashboard for paired sections */
.ops-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.ops-card {
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
    border-top: 3px solid var(--gold-light, #D4AF37);
    border-radius: 12px;
    overflow: hidden;
}
.ops-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #F3F4F6;
    background: linear-gradient(180deg, #FDFCF8 0%, white 100%);
}
.ops-card-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary, #111827);
}
.ops-card-body { padding: 18px 20px; }
.ops-issue,
.ops-check {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #F3F4F6;
}
.ops-issue:last-child,
.ops-check:last-child { border-bottom: none; padding-bottom: 0; }
.ops-check { align-items: flex-start; }

.ops-table { width: 100%; border-collapse: collapse; }
.ops-table th,
.ops-table td {
    padding: 10px 0;
    border-bottom: 1px solid #F3F4F6;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}
.ops-table th {
    font-size: 11px;
    color: var(--text-tertiary, #6B7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ops-table tr:last-child td { border-bottom: none; }
.ops-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ops-pill--critical { background: rgba(220,38,38,0.08); color: #DC2626; }
.ops-pill--warning  { background: rgba(217,119,6,0.10); color: #D97706; }
.ops-pill--info     { background: rgba(59,130,246,0.10); color: #3B82F6; }
.ops-pill--ok       { background: rgba(5,150,105,0.10); color: #059669; }
.ops-empty {
    padding: 18px;
    border: 1px dashed #CBD5E1;
    border-radius: 10px;
    background: #FAFAF9;
}
.ops-empty strong { display: block; font-size: 14px; color: var(--text-primary, #111827); margin-bottom: 4px; }

@media (max-width: 1024px) {
    .ops-grid-2 { grid-template-columns: 1fr; }
}
