/* ==========================================================================
   Hytta.online — Beitostølen Mountain Theme
   Mobile-first dashboard with glassmorphism
   ========================================================================== */

:root {
    /* Mountain palette */
    --bg-deep:        #0b1120;
    --bg-mountain:    #111827;
    --bg-card:        rgba(255, 255, 255, 0.06);
    --bg-card-hover:  rgba(255, 255, 255, 0.10);
    --bg-card-active: rgba(255, 255, 255, 0.14);
    --bg-modal:       rgba(11, 17, 32, 0.97);
    --bg-input:       rgba(255, 255, 255, 0.08);

    --text-primary:   #e8ecf4;
    --text-secondary: #8892a8;
    --text-muted:     #5a6478;

    --accent-amber:   #f0a050;
    --accent-blue:    #60a5fa;
    --accent-green:   #4ade80;
    --accent-red:     #f87171;
    --accent-cyan:    #22d3ee;

    --border:         rgba(255, 255, 255, 0.08);
    --border-light:   rgba(255, 255, 255, 0.12);

    --radius:         16px;
    --radius-sm:      10px;
    --radius-lg:      24px;

    --shadow:         0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg:      0 8px 48px rgba(0, 0, 0, 0.5);

    --font:           'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

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

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100dvh;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Mountain background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(180deg,
            var(--bg-deep) 0%,
            #0e1525 30%,
            #121d33 60%,
            #0f1729 100%
        );
    z-index: -2;
}

/* Mountain silhouette */
body::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40vh;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath fill='rgba(255,255,255,0.015)' d='M0,320 L0,240 Q120,140 240,200 Q360,120 480,180 Q540,100 600,160 Q720,60 840,140 Q960,80 1080,120 Q1200,40 1320,100 Q1380,60 1440,80 L1440,320 Z'/%3E%3Cpath fill='rgba(255,255,255,0.01)' d='M0,320 L0,260 Q180,180 360,220 Q480,160 600,200 Q720,140 840,180 Q960,120 1080,160 Q1200,100 1320,140 L1440,120 L1440,320 Z'/%3E%3C/svg%3E") no-repeat bottom center;
    background-size: 100% 100%;
    z-index: -1;
    pointer-events: none;
}

/* ==========================================================================
   Login page
   ========================================================================== */

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .icon-mountain {
    width: 48px;
    height: 48px;
    color: var(--accent-amber);
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* ==========================================================================
   Form elements
   ========================================================================== */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px; /* Prevents zoom on iOS */
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-error {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 6px;
    display: none;
}

.form-error.visible {
    display: block;
}

.form-message {
    color: var(--accent-blue);
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: var(--radius-sm);
    display: none;
}

.form-message.visible {
    display: block;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    box-shadow: 0 2px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: white;
    box-shadow: 0 2px 12px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

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

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
}

.btn + .btn {
    margin-top: 10px;
}

.btn-row {
    display: flex;
    gap: 10px;
}

.btn-row .btn {
    margin-top: 0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

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

.dashboard {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 16px 100px;
}

.header {
    padding: 20px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-left p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   Weather hero
   ========================================================================== */

.weather-hero {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.weather-hero:hover {
    background: var(--bg-card-hover);
}

.weather-hero:active {
    background: var(--bg-card-active);
}

.weather-current {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weather-icon-large {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.weather-info {
    flex: 1;
}

.weather-temp {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
}

.weather-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.weather-details {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.weather-details span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.weather-details svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Card grid
   ========================================================================== */

.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.card:active {
    transform: translateY(0);
    background: var(--bg-card-active);
}

.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.card-icon svg {
    width: 20px;
    height: 20px;
}

.card-icon.amber   { background: rgba(240, 160, 80, 0.15); color: var(--accent-amber); }
.card-icon.blue    { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); }
.card-icon.green   { background: rgba(74, 222, 128, 0.15); color: var(--accent-green); }
.card-icon.red     { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }
.card-icon.cyan    { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.card-icon.purple  { background: rgba(168, 128, 255, 0.15); color: #a880ff; }

.card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.card-value {
    font-size: 13px;
    color: var(--text-secondary);
}

.card-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 20px;
}

.card-status.online  { background: rgba(74, 222, 128, 0.12); color: var(--accent-green); }
.card-status.offline { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.card-status.idle    { background: rgba(136, 146, 168, 0.12); color: var(--text-secondary); }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Full width card */
.card-full {
    grid-column: 1 / -1;
}

/* ==========================================================================
   Modal (bottom sheet style)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92dvh;
    background: var(--bg-modal);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 1px solid var(--border-light);
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-overlay.active + .modal-sheet,
.modal-sheet.active {
    transform: translateY(0);
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 32px;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Floor plan — CSS absolute positioning (exact cabin geometry)
   Measurements converted from original vw-based layout:
   Container: 95vw x 41.8vw → percentages: x/95*100, y/41.8*100
   ========================================================================== */

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

.floor-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/*
 * All percentages derived from original CSS:
 *   Container: 95vw × 41.8vw → X% = vw/95*100, Y% = vw/41.8*100
 *   7.524vw=18%, 10.165vw=24.3%, 10.925vw=26.1%, 5.852vw=14%
 *   18.05vw=19%, 36.1vw=38%, 22.8vw=24%, 47.5vw=50%
 */

/* 1st floor container — exact 95:41.8 ratio */
.cabin-plan-1 {
    position: relative;
    width: 100%;
    font-family: var(--font);
}
.cabin-plan-1::before {
    content: '';
    display: block;
    padding-top: 44%; /* 41.8/95 — exact original ratio */
}

/* 2nd floor container — sits above the center section of 1st floor (24% of width) */
.cabin-plan-2 {
    position: relative;
    width: 24%;
    margin-left: 38%; /* aligned with center section */
    font-family: var(--font);
    border: 2px solid rgba(255,255,255,0.25);
}
.cabin-plan-2::before {
    content: '';
    display: block;
    padding-top: 183.3%; /* 41.8/22.8 */
}

/* ---- Outer walls (1st floor) ---- */
.cw { position: absolute; }
.corner-tl { top:0; left:0; width:38%; height:18%; border-bottom:2px solid rgba(255,255,255,0.25); border-right:2px solid rgba(255,255,255,0.25); }
.corner-tr { top:0; right:0; width:38%; height:18%; border-bottom:2px solid rgba(255,255,255,0.25); border-left:2px solid rgba(255,255,255,0.25); }
.corner-bl { bottom:0; left:0; width:50%; height:18%; border-top:2px solid rgba(255,255,255,0.25); border-right:2px solid rgba(255,255,255,0.25); }
.corner-br { bottom:0; right:0; width:38%; height:18%; border-top:2px solid rgba(255,255,255,0.25); border-left:2px solid rgba(255,255,255,0.25); }
.wall-t { position:absolute; height:2px; background:rgba(255,255,255,0.25); top:0; left:38%; right:38%; }
.wall-b { position:absolute; height:2px; background:rgba(255,255,255,0.25); bottom:0; left:50%; right:38%; }
.wall-l { position:absolute; width:2px; background:rgba(255,255,255,0.25); left:0; top:18%; bottom:18%; }
.wall-r { position:absolute; width:2px; background:rgba(255,255,255,0.25); right:0; top:18%; bottom:18%; }

/* ---- Rooms (clickable) ---- */
.cr, .cd {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    background: transparent;
}

.cr {
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.10);
    z-index: 2;
    transition: background 0.2s ease;
}

.cr:hover {
    background: rgba(96, 165, 250, 0.08);
}

.cr:active {
    background: rgba(96, 165, 250, 0.12);
}

.cd {
    pointer-events: none;
}

/* Room labels */
.rl     { font-size: 8px; font-weight: 600; color: var(--text-secondary); line-height: 1.1; word-break: break-word; max-width: 100%; padding: 0 1px; }
.rl-xs  { font-size: 7px; font-weight: 500; color: var(--text-muted); line-height: 1.1; }
.rv     { font-size: 14px; font-weight: 700; color: var(--accent-amber); line-height: 1.1; }
.rv-sm  { font-size: 10px; font-weight: 700; color: var(--accent-amber); line-height: 1.1; }
.rt     { font-size: 7px; color: rgba(255,255,255,0.7); line-height: 1.1; }

/* Temperature color coding */
.fp-cold { color: var(--accent-blue) !important; }
.fp-cool { color: var(--accent-cyan) !important; }
.fp-warm { color: var(--accent-amber) !important; }
.fp-hot  { color: var(--accent-red) !important; }

/* ---- 1st floor rooms — exact % from original vw values ---- */

/* Utebod: bottom:0, left:38%, width:6%, height:18% */
.utebod   { bottom:0; left:38%; width:6%; height:18%; border:2px solid rgba(255,255,255,0.25); }

/* Stue: L-shaped area clipped to stay inside walls.
   Element is width:62% height:82% of container, so clip-path % are element-relative:
   Container x=38% → element x = 38/62*100 = 61.3%
   Container y=18% → element y = 18/82*100 = 22%
   Container x=62% → element x = 100% */
.stue     { top:0; left:0; width:62%; bottom:18%; z-index:1;
            clip-path: polygon(
                0% 22%, 61.3% 22%, 61.3% 0%, 100% 0%,
                100% 100%, 0% 100%
            ); }

/* Emilias rom: top:18%, left:62%, width:19%, height:24.3% */
.sov3     { top:18%; left:62%; width:19%; height:24.3%; border-left:1px solid rgba(255,255,255,0.1); }

/* Gjesterom: top:18%, left:81%, width:19%, height:24.3% */
.sov2     { top:18%; left:81%; width:19%; height:24.3%; border-left:1px solid rgba(255,255,255,0.1); }

/* Garderobe-sov-1: bottom:50%, left:92%, width:8%, height:7% */
.gard1    { bottom:50%; left:92%; width:8%; height:7%; border-left:1px solid rgba(255,255,255,0.1); border-top:1px solid rgba(255,255,255,0.1); border-bottom:1px dashed rgba(255,255,255,0.06); }

/* Garderobe-sov-2: bottom:50%, left:86%, width:6%, height:7% */
.gard2    { bottom:50%; left:86%; width:6%; height:7%; border-bottom:1px solid rgba(255,255,255,0.1); border-top:1px dashed rgba(255,255,255,0.06); }

/* Korridor: bottom:44%, left:62%, width:24%, height:14% */
.korridor { bottom:44%; left:62%; width:24%; height:14%; border-top:1px solid rgba(255,255,255,0.1); border-bottom:1px solid rgba(255,255,255,0.1); border-right:1px solid rgba(255,255,255,0.1); }

/* Bad og badstu: bottom:18%, left:62%, width:19%, height:26.1% */
.bad-nede { bottom:18%; left:62%; width:19%; height:26.1%; border-left:1px solid rgba(255,255,255,0.1); }

/* Hovedsoverom: bottom:18%, left:81%, width:19%, height:26.1% */
.sov1     { bottom:18%; left:81%; width:19%; height:26.1%; border-left:1px solid rgba(255,255,255,0.1); }

/* Vaskerom: bottom:17.1%, right:38%, width:6%, height:27.8% */
.vaskerom { bottom:17.1%; right:38%; width:6%; height:27.8%; border-top:1px solid rgba(255,255,255,0.1); border-bottom:1px solid rgba(255,255,255,0.1); border-left:1px solid rgba(255,255,255,0.1); }

/* Gang: bottom:17.1%, left:38%, width:12%, height:27.8% */
.inngang  { bottom:17.1%; left:38%; width:12%; height:27.8%; border-top:1px solid rgba(255,255,255,0.1); }

/* ---- 2nd floor rooms ---- */
/* Original: loftstue 22.8vw wide, rooms positioned within. Converted to % of 22.8: */

/* Loftstue: fills entire 2nd floor as background layer */
.loftstue { top:0; left:0; width:100%; height:100%; z-index:1; border:none; }

/* Elines rom: top-left, 50% wide, 30% tall */
.sov4     { top:0; left:0; width:50%; height:30%; border-bottom:1px solid rgba(255,255,255,0.15); border-right:1px solid rgba(255,255,255,0.15); }

/* Elises rom: top-right, 50% wide, 30% tall */
.sov5     { top:0; left:50%; width:50%; height:30%; border-bottom:1px solid rgba(255,255,255,0.15); }

/* Bad oppe: below right bedroom (top:30%, left:70.8%, width:29.2%, height:33%) */
.bad-oppe { top:30%; left:70.8%; width:29.2%; height:33%; border-bottom:1px solid rgba(255,255,255,0.15); border-left:1px solid rgba(255,255,255,0.15); }

/* Bod/staircase: below bathroom (top:63%, same x position) */
.bod-oppe { top:63%; left:70.8%; width:29.2%; height:18%; border-bottom:1px solid rgba(255,255,255,0.1); border-left:1px solid rgba(255,255,255,0.1); }

.outdoor-temp-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.outdoor-temp-bar .label {
    font-size: 13px;
    color: var(--text-secondary);
}

.outdoor-temp-bar .value {
    font-size: 18px;
    font-weight: 700;
}

/* ==========================================================================
   Room temperature control (sub-modal)
   ========================================================================== */

.temp-control {
    text-align: center;
    padding: 20px 0;
}

.temp-display {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
    margin: 20px 0;
    letter-spacing: -2px;
}

.temp-display .unit {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-secondary);
}

.temp-current-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.temp-slider-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}

.temp-slider-row .btn-icon {
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
}

.temp-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
}

.temp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 3px solid var(--bg-deep);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.4);
    cursor: pointer;
}

.temp-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 3px solid var(--bg-deep);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.4);
    cursor: pointer;
}

/* ==========================================================================
   Door lock modal
   ========================================================================== */

.lock-visual {
    text-align: center;
    padding: 32px 0;
}

.lock-icon-big {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    transition: var(--transition);
}

.lock-icon-big svg {
    width: 40px;
    height: 40px;
}

.lock-icon-big.locked {
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent-green);
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.1);
}

.lock-icon-big.unlocked {
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-red);
    box-shadow: 0 0 40px rgba(248, 113, 113, 0.1);
}

.lock-status-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* ==========================================================================
   Blinds modal
   ========================================================================== */

.blind-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blind-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.blind-name {
    font-size: 14px;
    font-weight: 500;
}

.blind-position {
    font-size: 13px;
    color: var(--text-secondary);
}

.blind-slider {
    width: 80px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
}

.blind-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-amber);
    border: 2px solid var(--bg-deep);
    cursor: pointer;
}

/* ==========================================================================
   Camera card
   ========================================================================== */

.card-camera {
    padding: 0;
    min-height: 110px;
}

.card-camera-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    transition: opacity 0.3s;
}

.card-camera:hover .card-camera-bg {
    opacity: 0.45;
}

.card-camera-overlay {
    position: relative;
    z-index: 1;
    padding: 18px;
}

/* ==========================================================================
   Camera modal
   ========================================================================== */

#modal-camera .modal-body {
    padding: 0 0 16px;
}

.camera-feed {
    width: 100%;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}

.camera-feed img,
.camera-feed video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-feed video {
    pointer-events: none;
}

.camera-preview {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.camera-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.camera-placeholder {
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.camera-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
    opacity: 0.3;
}

.camera-spinner {
    animation: camera-spin 1.5s linear infinite;
    opacity: 0.7;
    margin-bottom: 8px;
}

@keyframes camera-spin {
    to { transform: rotate(360deg); }
}

/* Fullscreen button */
.camera-fullscreen-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}

.camera-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Fullscreen mode */
.camera-feed:fullscreen,
.camera-feed:-webkit-full-screen {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-feed:fullscreen video,
.camera-feed:-webkit-full-screen video {
    object-fit: contain;
}

.camera-feed:fullscreen .camera-preview,
.camera-feed:-webkit-full-screen .camera-preview,
.camera-feed:fullscreen .camera-loading,
.camera-feed:-webkit-full-screen .camera-loading {
    display: none;
}

.camera-feed:fullscreen .camera-fullscreen-btn,
.camera-feed:-webkit-full-screen .camera-fullscreen-btn {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
}

/* Controls row */
.camera-controls {
    padding: 0 20px;
}

.camera-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 20px;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==========================================================================
   Schedule / Arrival modal
   ========================================================================== */

.schedule-option {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.schedule-option h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.schedule-option p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.datetime-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 16px;
    outline: none;
    color-scheme: dark;
}

.datetime-input:focus {
    border-color: var(--accent-blue);
}

.schedule-active {
    padding: 16px;
    background: rgba(74, 222, 128, 0.06);
    border: 1px solid rgba(74, 222, 128, 0.2);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.schedule-active h3 {
    color: var(--accent-green);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* ==========================================================================
   WiFi modal
   ========================================================================== */

.wifi-info {
    text-align: center;
    padding: 16px 0;
}

.wifi-qr {
    width: 200px;
    height: 200px;
    background: white;
    border-radius: var(--radius);
    padding: 12px;
    margin: 20px auto;
}

.wifi-qr img {
    width: 100%;
    height: 100%;
}

.wifi-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wifi-detail .label {
    font-size: 13px;
    color: var(--text-secondary);
}

.wifi-detail .value {
    font-size: 14px;
    font-weight: 600;
    font-family: monospace;
}

/* ==========================================================================
   Settings / Passkeys
   ========================================================================== */

.passkey-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.passkey-info {
    flex: 1;
}

.passkey-name {
    font-size: 14px;
    font-weight: 500;
}

.passkey-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.passkey-delete {
    color: var(--accent-red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

/* ==========================================================================
   Weather forecast (detailed)
   ========================================================================== */

.forecast-day {
    margin-bottom: 16px;
}

.forecast-day-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-amber);
    text-transform: capitalize;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.forecast-hour {
    display: flex;
    align-items: center;
    padding: 8px 0;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 14px;
}

.forecast-hour:last-child {
    border-bottom: none;
}

.forecast-time {
    width: 45px;
    color: var(--text-secondary);
    font-size: 13px;
    flex-shrink: 0;
}

.forecast-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.forecast-temp {
    width: 50px;
    font-weight: 600;
    flex-shrink: 0;
}

.forecast-precip {
    flex: 1;
    color: var(--accent-blue);
    font-size: 13px;
}

.forecast-wind {
    width: 60px;
    text-align: right;
    color: var(--text-muted);
    font-size: 13px;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.text-center { text-align: center; }
.text-muted  { color: var(--text-secondary); }
.text-sm     { font-size: 13px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-8        { margin-bottom: 8px; }
.mb-16       { margin-bottom: 16px; }
.hidden      { display: none !important; }

.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.08) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 20px;
    background: rgba(30, 40, 60, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    z-index: 2000;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Safe area / notch handling
   ========================================================================== */

@supports (padding-top: env(safe-area-inset-top)) {
    .dashboard { padding-top: env(safe-area-inset-top); }
    .modal-body { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   Scrollbar styling
   ========================================================================== */

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ==========================================================================
   Shutdown confirmation
   ========================================================================== */

.shutdown-confirm {
    text-align: center;
    padding: 24px 0;
}

.shutdown-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.12);
    color: var(--accent-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.shutdown-icon svg {
    width: 32px;
    height: 32px;
}

.shutdown-actions {
    list-style: none;
    text-align: left;
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.shutdown-actions li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.shutdown-actions li svg {
    width: 16px;
    height: 16px;
    color: var(--accent-red);
}

/* ==========================================================================
   Action result feedback
   ========================================================================== */

.action-result {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.action-result.success {
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: var(--accent-green);
}

.action-result.error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--accent-red);
}
