@import url("variables.css");
@import url("layout.css");
@import url("dashboard.css?v=4110");
@import url("regions.css");
@import url("map.css");
@import url("alerts.css");
@import url("responsive.css");
@import url("management.css");
@import url("estate_intelligence.css?v=4311");

/* =====================================================
   Factory Reset
===================================================== */

.factory-warning {
    background: rgba(239,68,68,.10);
    border: 2px solid rgba(239,68,68,.35);
    border-radius: 14px;
    padding: 18px;
    margin: 20px 0;
}

.factory-warning h3 {
    margin-top: 0;
    color: #ef4444;
}

.factory-warning p {
    margin: 8px 0;
    color: var(--text);
}

.factory-option {
    background: rgba(15,23,42,.70);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
    transition: .2s;
}

.factory-option:hover {
    border-color: #3b82f6;
    background: rgba(30,41,59,.90);
}

.factory-option input[type="radio"] {
    margin-right: 10px;
}

.factory-option strong {
    color: white;
}

.danger-button {
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 26px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: .2s;
}

.danger-button:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239,68,68,.35);
}

.reset-confirm {
    margin-top: 18px;
}

.reset-confirm input {
    width: 100%;
    padding: 12px;
    background: rgba(15,23,42,.85);
    color: white;
    border: 1px solid var(--border);
    border-radius: 10px;
}

#factoryResetMessage {
    min-height: 26px;
    margin-bottom: 18px;
    font-weight: bold;
}

/* =====================================================
   Setup Wizard
===================================================== */

.setup-wizard-page {
    margin-left: 0;
    max-width: 980px;
    margin: 60px auto;
}

.setup-wizard-panel {
    padding: 28px;
}

.setup-wizard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.setup-badge {
    display: inline-block;
    background: rgba(59,130,246,.14);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,.35);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.install-steps {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 22px 0;
}

.install-step {
    background: rgba(15,23,42,.75);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 13px;
    color: var(--muted);
    font-size: 13px;
}

.install-step.active {
    background: rgba(34,197,94,.12);
    color: var(--success);
    border-color: rgba(34,197,94,.35);
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.setup-card {
    background: rgba(15,23,42,.65);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
}

.setup-card h3 {
    margin-top: 0;
    color: #93c5fd;
}

.setup-card label {
    display: block;
    margin-top: 14px;
}

.setup-note {
    margin-top: 18px;
}

.setup-actions {
    margin-top: 24px;
}

/* =====================================================
   Incident Center
===================================================== */

.incident-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.incident-overview div {
    background: rgba(15,23,42,.75);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.incident-overview span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 8px;
}

.incident-overview strong {
    font-size: 28px;
    color: white;
}

.incident-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.incident-card {
    background: rgba(15,23,42,.72);
    border: 1px solid var(--border);
    border-left: 7px solid var(--accent);
    border-radius: 14px;
    padding: 18px;
}

.incident-card.open {
    border-left-color: var(--danger);
}

.incident-card.resolved {
    border-left-color: var(--success);
}

.incident-card.critical {
    box-shadow: 0 0 0 1px rgba(239,68,68,.25), 0 18px 40px rgba(239,68,68,.08);
}

.incident-card.major {
    box-shadow: 0 0 0 1px rgba(245,158,11,.18);
}

.incident-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.incident-card h3 {
    margin: 8px 0;
    color: #93c5fd;
}

.incident-card p {
    color: var(--text);
    margin-top: 8px;
}

.incident-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .06em;
    margin-right: 6px;
    border: 1px solid var(--border);
    background: rgba(148,163,184,.12);
    color: var(--muted);
}

.incident-badge.open,
.incident-badge.critical {
    background: rgba(239,68,68,.12);
    color: var(--danger);
    border-color: rgba(239,68,68,.35);
}

.incident-badge.major {
    background: rgba(245,158,11,.12);
    color: var(--warning);
    border-color: rgba(245,158,11,.35);
}

.incident-badge.warning {
    background: rgba(245,158,11,.10);
    color: var(--warning);
    border-color: rgba(245,158,11,.28);
}

.incident-badge.info {
    background: rgba(59,130,246,.12);
    color: #93c5fd;
    border-color: rgba(59,130,246,.35);
}

.incident-badge.resolved {
    background: rgba(34,197,94,.12);
    color: var(--success);
    border-color: rgba(34,197,94,.35);
}

.incident-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.incident-meta-grid div {
    background: rgba(2,6,23,.45);
    border: 1px solid rgba(51,65,85,.65);
    border-radius: 10px;
    padding: 10px;
}

.incident-meta-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 5px;
}

.incident-meta-grid strong {
    color: white;
    font-size: 13px;
}

.incident-notes {
    white-space: pre-wrap;
    background: rgba(2,6,23,.65);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    color: #cbd5e1;
    margin-top: 14px;
}

.incident-actions {
    margin-top: 16px;
}

/* Incident lifecycle enhancements */
.incident-card.acknowledged {
    border-left-color: var(--warning);
}

.incident-badge.acknowledged {
    background: rgba(245,158,11,.12);
    color: var(--warning);
    border-color: rgba(245,158,11,.35);
}

.incident-badge.incident-number {
    background: rgba(59,130,246,.12);
    color: #93c5fd;
    border-color: rgba(59,130,246,.35);
}

.incident-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.incident-timeline {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.incident-timeline-event {
    background: rgba(2,6,23,.45);
    border: 1px solid rgba(51,65,85,.65);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.incident-timeline-event span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.incident-timeline-event strong {
    color: #93c5fd;
    margin-right: 8px;
}

.incident-timeline-event em {
    color: var(--muted);
    font-style: normal;
}

.incident-timeline-event p {
    margin: 8px 0 0;
    color: #cbd5e1;
}

/* =====================================================
   Health Check Dashboard
===================================================== */

.health-check-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 22px;
    align-items: center;
    background: rgba(15,23,42,.70);
    border: 1px solid var(--border);
    border-left: 8px solid var(--warning);
    border-radius: 16px;
    padding: 22px;
    margin: 20px 0 26px;
}

.health-check-hero.pass {
    border-left-color: var(--success);
}

.health-check-hero.warn {
    border-left-color: var(--warning);
}

.health-check-hero.fail {
    border-left-color: var(--danger);
}

.health-check-hero strong {
    display: block;
    font-size: 52px;
    line-height: 1;
    margin-top: 8px;
}

.health-check-counts {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 12px;
}

.health-check-counts div {
    background: rgba(30,41,59,.85);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
}

.health-check-counts span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.health-check-counts strong {
    font-size: 28px;
    margin: 0;
}

.health-check-section {
    margin-top: 28px;
}

.health-check-section h3 {
    color: #93c5fd;
    margin-bottom: 12px;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: .04em;
}

.health-badge.pass {
    background: rgba(34,197,94,.12);
    color: var(--success);
    border: 1px solid rgba(34,197,94,.35);
}

.health-badge.warn {
    background: rgba(245,158,11,.12);
    color: var(--warning);
    border: 1px solid rgba(245,158,11,.35);
}

.health-badge.fail {
    background: rgba(239,68,68,.12);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,.35);
}

.secondary-button {
    background: rgba(148,163,184,.12);
    color: var(--text);
    border: 1px solid rgba(148,163,184,.35);
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
    transition: .2s;
}

.secondary-button:hover {
    border-color: var(--accent2);
    color: white;
}

@media (max-width: 900px) {
    .health-check-hero {
        grid-template-columns: 1fr;
    }

    .health-check-counts {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* =====================================================
   About / Platform Information
===================================================== */

.about-hero {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: center;
    background: linear-gradient(135deg, rgba(59,130,246,.16), rgba(6,182,212,.08), rgba(30,41,59,.96));
}

.about-hero h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.about-version-card {
    min-width: 230px;
    background: rgba(15,23,42,.78);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    text-align: right;
}

.about-version-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 8px;
}

.about-version-card strong {
    color: white;
    font-size: 18px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.module-card {
    background: rgba(15,23,42,.70);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.module-card strong {
    display: block;
    margin-bottom: 5px;
}

.module-card span {
    color: var(--muted);
    font-size: 12px;
}

.module-card.installed {
    border-left: 5px solid var(--success);
}

.module-card.missing {
    border-left: 5px solid var(--danger);
}

.release-notes ul {
    margin: 0;
    padding-left: 20px;
}

.release-notes li {
    margin-bottom: 8px;
}

/* =====================================================
   Factory Reset 4.0.9 Maintenance
===================================================== */

.factory-reset-panel .factory-option {
    cursor: pointer;
    border-left: 8px solid transparent;
}

.factory-reset-panel .factory-option.selected {
    border-color: rgba(59,130,246,.45);
    box-shadow: 0 0 0 1px rgba(59,130,246,.20), 0 12px 30px rgba(0,0,0,.22);
}

.factory-reset-panel .factory-option.runtime {
    border-left-color: #22c55e;
    background: rgba(34,197,94,.08);
}

.factory-reset-panel .factory-option.estate {
    border-left-color: #f59e0b;
    background: rgba(245,158,11,.08);
}

.factory-reset-panel .factory-option.factory {
    border-left-color: #ef4444;
    background: rgba(239,68,68,.10);
}

.reset-scope-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.reset-scope-grid div {
    background: rgba(15,23,42,.55);
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 10px;
    padding: 12px;
}

.reset-scope-grid ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--muted);
}

.factory-warning.runtime {
    background: rgba(34,197,94,.10);
    border-color: rgba(34,197,94,.40);
}

.factory-warning.runtime h3 {
    color: #22c55e;
}

.factory-warning.estate {
    background: rgba(245,158,11,.10);
    border-color: rgba(245,158,11,.40);
}

.factory-warning.estate h3 {
    color: #f59e0b;
}

.factory-warning.factory {
    background: rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.45);
}

.factory-warning.factory h3 {
    color: #ef4444;
}

.reset-progress {
    margin: 18px 0;
    background: rgba(15,23,42,.60);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.reset-progress-bar {
    height: 12px;
    background: rgba(15,23,42,.95);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(148,163,184,.20);
}

.reset-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    transition: width .35s ease;
}

#factoryResetProgressText {
    margin: 10px 0 0;
    color: var(--muted);
}

.danger-button:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.danger-button.armed {
    background: #ef4444;
    box-shadow: 0 8px 22px rgba(239,68,68,.30);
}

@media (max-width: 900px) {
    .reset-scope-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   4.0.10 Quality of Life Polish
===================================================== */

.inline-message {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0 18px;
    border: 1px solid var(--border);
    background: rgba(15,23,42,.70);
    color: var(--text);
}

.inline-message.success {
    border-color: rgba(34,197,94,.35);
    background: rgba(34,197,94,.10);
    color: var(--success);
}

.inline-message.error {
    border-color: rgba(239,68,68,.35);
    background: rgba(239,68,68,.10);
    color: var(--danger);
}

.inline-message.warning {
    border-color: rgba(245,158,11,.35);
    background: rgba(245,158,11,.10);
    color: var(--warning);
}

.inline-message.info {
    border-color: rgba(59,130,246,.35);
    background: rgba(59,130,246,.10);
    color: #93c5fd;
}

button.is-loading,
.save-map-button.is-loading,
.secondary-button.is-loading,
.danger-button.is-loading {
    opacity: .75;
    cursor: wait;
    transform: none !important;
}

.connection-pill.danger {
    background: rgba(239,68,68,.12);
    color: var(--danger);
    border-color: rgba(239,68,68,.35);
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.loading-card {
    color: var(--muted);
    border: 1px dashed rgba(148,163,184,.35);
    border-radius: 12px;
    padding: 18px;
    background: rgba(15,23,42,.45);
}

.release-notes-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.release-notes-list {
    display: grid;
    gap: 14px;
}

.release-note-card {
    background: rgba(15,23,42,.70);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
}

.release-note-card h3 {
    margin: 0 0 10px;
    color: #93c5fd;
}

.release-note-card ul {
    margin: 0;
    padding-left: 20px;
}

.release-note-card li {
    margin-bottom: 7px;
    color: var(--muted);
}

.toast.info {
    border-left-color: var(--accent);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@media (max-width: 760px) {
    .panel-title-row,
    .release-notes-hero {
        flex-direction: column;
    }
}

/* =====================================================
   About / Platform Identity 4.0.11
===================================================== */

.capability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.capability-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    background: rgba(15,23,42,.70);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.capability-card strong {
    display: block;
    color: white;
    margin-bottom: 6px;
}

.capability-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.capability-card em {
    flex: 0 0 auto;
    font-style: normal;
    color: var(--success);
    border: 1px solid rgba(34,197,94,.35);
    background: rgba(34,197,94,.12);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    white-space: nowrap;
}

.support-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.support-link-card {
    display: block;
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.35);
    border-radius: 12px;
    color: #bfdbfe;
    padding: 14px 16px;
    text-decoration: none;
    transition: .2s;
}

.support-link-card:hover {
    background: rgba(59,130,246,.20);
    color: white;
    transform: translateY(-2px);
}

/* Dashboard Widget Framework */
.ops-widget-preference-list .ops-pref-check span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ops-widget-preference-list .ops-pref-check small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

[data-widget][hidden] {
    display: none !important;
}

/* Dashboard Widget States - compatibility */
[data-widget].ops-widget-collapsed > :not(.ops-widget-statebar) {
    display: none !important;
}

/* =====================================================
    Avatar Listing
======================================================= */
.region-avatar-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.region-avatar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.55);
}

.region-avatar-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.16);
    font-size: 18px;
}

.region-avatar-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.region-avatar-details strong {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-avatar-details span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

/* =====================================================
   Automation Engine
===================================================== */
.automation-summary-grid,
.automation-form-grid,
.automation-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.automation-rule-list,
.automation-execution-list {
    display: grid;
    gap: 12px;
}

.automation-rule-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15,23,42,.55);
}

.automation-rule-card.enabled {
    border-left: 5px solid #22c55e;
}

.automation-rule-card.disabled {
    opacity: .72;
    border-left: 5px solid #64748b;
}

.automation-rule-card h3 {
    margin: 0 0 6px 0;
}

.automation-rule-card p,
.automation-rule-card small {
    margin: 0;
}

.automation-rule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.automation-execution-row {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15,23,42,.45);
}

.automation-execution-row.success {
    border-left: 5px solid #22c55e;
}

.automation-execution-row.error {
    border-left: 5px solid #ef4444;
}

.automation-execution-row p,
.automation-execution-row small {
    margin: 4px 0 0 0;
}

.small-danger {
    padding: 8px 12px;
    border-radius: 9px;
}


/* 4.2.3 Resident Presence & Occupancy */
.region-avatar-presence { color: var(--muted, #94a3b8); font-size: 12px; margin-top: 3px; }
.region-avatar-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.resident-badge { display: inline-flex; padding: 2px 7px; border-radius: 999px; background: rgba(148,163,184,.16); color: #e2e8f0; font-size: 11px; font-style: normal; }
.resident-badge.staff { background: rgba(59,130,246,.2); color: #bfdbfe; }
.resident-badge.favorite { background: rgba(245,158,11,.2); color: #fde68a; }
.region-presence-events { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.presence-event { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(15,23,42,.48); }
.presence-event-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 700; }
.presence-event.arrival .presence-event-icon { background: rgba(34,197,94,.16); color: #86efac; }
.presence-event.departure .presence-event-icon { background: rgba(148,163,184,.16); color: #cbd5e1; }
.presence-event > div { display: flex; flex-direction: column; min-width: 0; }
.presence-event > div span, .presence-event time { color: var(--muted, #94a3b8); font-size: 12px; }
