/* =========================================================
   DESIGN TOKENS
   ========================================================= */
:root {
    --bg-page: #f2f3f7;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-secondary: #f0f2f5;
    --text-main: #1a1c1e;
    --text-muted: #8c8c8c;
    --accent: #0067b8;
    --accent-light: #e5f0fa;
    --border-color: #eaeaea;
    --shadow-soft: 0 4px 24px rgba(0,0,0,0.05);
    --shadow-medium: 0 12px 40px rgba(0,0,0,0.10);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --sidebar-w: 88px;
}

[data-theme="dark"] {
    --bg-page: #111113;
    --bg-sidebar: #1c1c1e;
    --bg-card: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --text-main: #f5f5f7;
    --text-muted: #8e8e93;
    --accent: #4c84ff;
    --accent-light: rgba(76,132,255,0.15);
    --border-color: #2c2c2e;
    --shadow-soft: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-medium: 0 12px 40px rgba(0,0,0,0.5);
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-page);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: var(--font); }

/* =========================================================
   LOGIN VIEW
   ========================================================= */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    padding: 20px;
}

[data-theme="dark"] .login-wrapper {
    background: linear-gradient(135deg, #0d1b2e 0%, #111827 100%);
}

.login-split-card {
    display: flex;
    width: 100%;
    max-width: 900px;
    height: 560px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.15);
}

.login-visual-side {
    flex: 1.2;
    background: linear-gradient(145deg, #0067b8, #003e7e);
    color: white;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.branding-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.visual-copy h2 {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 14px;
}

.visual-copy p {
    font-size: 17px;
    opacity: 0.85;
    line-height: 1.6;
}

.login-form-side {
    flex: 1;
    background: var(--bg-card);
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-content-inner { max-width: 360px; margin: 0 auto; width: 100%; }

.welcome-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
    margin-bottom: 10px;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 36px;
}

.ms-button-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-soft);
}

.ms-button-large:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.ms-button-large img { width: 26px; height: 26px; }

/* =========================================================
   DASHBOARD WRAPPER
   ========================================================= */
.dashboard-view {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* =========================================================
   HOME PAGE — FULLSCREEN
   ========================================================= */
.home-page {
    flex: 1;
    height: 100vh;
    width: 100vw;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    overflow: hidden;
}

/* Subtle animated background gradient */
.home-bg-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 60% at 15% 20%, rgba(76,132,255,0.18) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 85% 75%, rgba(124,58,237,0.12) 0%, transparent 70%);
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

[data-theme="dark"] .home-bg-overlay {
    background:
        radial-gradient(ellipse 70% 60% at 15% 20%, rgba(76,132,255,0.25) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 85% 75%, rgba(124,58,237,0.18) 0%, transparent 70%);
}

/* Top bar */
.home-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 40px;
    z-index: 10;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    opacity: 0.7;
}

.home-brand svg { opacity: 0.8; }

.home-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.home-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

/* Center: time & date */
.home-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    text-align: center;
    gap: 8px;
}

.home-time {
    font-size: clamp(72px, 13vw, 140px);
    font-weight: 800;
    letter-spacing: -5px;
    color: var(--text-main);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.home-date {
    font-size: clamp(16px, 2.2vw, 22px);
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.2px;
}

.home-divider {
    width: 40px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    margin: 6px 0;
    opacity: 0.6;
}

.home-greeting {
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

/* Stats strip */
.home-stats-strip {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 10px 24px;
    box-shadow: var(--shadow-soft);
    z-index: 10;
    white-space: nowrap;
}

.home-stat {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 16px;
}

.home-stat svg { opacity: 0.6; flex-shrink: 0; }

.home-stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.home-time-zone {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
}

/* Home Bottom-Left Nav */
.home-nav {
    position: absolute;
    bottom: 36px;
    left: 40px;
    z-index: 20;
}

.home-nav-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px 10px;
    box-shadow: var(--shadow-medium);
}

[data-theme="dark"] .home-nav-inner {
    background: rgba(28,28,30,0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.home-nav-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 40px;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.home-nav-btn svg { fill: var(--text-muted); transition: fill 0.2s; }

.home-nav-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-main);
}

.home-nav-btn:hover svg { fill: var(--text-main); }

.home-nav-btn.active {
    background: var(--accent);
    color: white;
}

.home-nav-btn.active svg { fill: white; }

/* =========================================================
   SIDEBAR LAYOUT (Calendar + IOT)
   ========================================================= */
.sidebar-layout {
    flex: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar-brand svg { fill: var(--accent); opacity: 0.9; }

.sidebar-time {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    margin-top: 4px;
}

.sidebar-date {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    margin-top: 8px;
    width: 100%;
    padding: 0 8px;
}

.sidebar-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 14px;
    background: transparent;
    border: none;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    width: 100%;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.sidebar-nav-btn svg { fill: var(--text-muted); transition: fill 0.2s; }

.sidebar-nav-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-main);
}

.sidebar-nav-btn:hover svg { fill: var(--text-main); }

.sidebar-nav-btn.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-nav-btn.active svg { fill: var(--accent); }

.sidebar-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

/* Sidebar Main Content */
.sidebar-main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 32px 36px;
    gap: 24px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}

.page-header-left { display: flex; flex-direction: column; gap: 4px; }

.page-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* =========================================================
   CALENDAR PAGE
   ========================================================= */
.icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    transition: all 0.15s;
}

.icon-btn:hover { background: var(--bg-secondary); }
.icon-btn svg { fill: currentColor; }

.today-pill {
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.15s;
}

.today-pill:hover { opacity: 0.85; }

.calendar-container {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    min-height: 0;
}

.cal-day-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 10px;
    flex-shrink: 0;
}

.cal-day-hdr {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    gap: 5px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cal-cell {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow: hidden;
    transition: background 0.15s;
    border: 1.5px solid transparent;
    cursor: pointer;
}

.cal-cell:hover {
    background: var(--bg-card);
    border-color: var(--accent);
}

.cal-cell-empty {
    background: transparent;
    pointer-events: none;
    border: none;
}

.cal-today {
    background: var(--accent-light) !important;
    border-color: var(--accent) !important;
}

.cal-day-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    flex-shrink: 0;
}

.cal-today .cal-day-num {
    color: var(--accent);
}

.cal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.cal-event-pill {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent);
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    flex-shrink: 0;
}

.cal-event-more {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 1px 6px;
}

/* =========================================================
   IOT PAGE
   ========================================================= */
/* Global master control */
.all-master-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.all-master-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.master-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 40px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: var(--shadow-soft);
}

.master-toggle-btn svg { fill: var(--text-muted); transition: fill 0.2s; }

.master-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.master-toggle-btn:hover svg { fill: var(--accent); }

.master-toggle-btn.master-on {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.master-toggle-btn.master-on svg { fill: white; }

/* Zones container */
.iot-zones-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 12px;
}

.iot-zones-container::-webkit-scrollbar { width: 4px; }
.iot-zones-container::-webkit-scrollbar-track { background: transparent; }
.iot-zones-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

/* Zone block */
.iot-zone {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.zone-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zone-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.zone-a-color { background: #4c84ff; }
.zone-b-color { background: #34c759; }
.zone-c-color { background: #ff9f0a; }
.zone-d-color { background: #ff375f; }
.zone-e-color { background: #ac39d4; }
.zone-f-color { background: #30b0c7; }

.zone-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.zone-sub {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}

.zone-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.zone-all-btn:hover { border-color: var(--accent); color: var(--accent); }

.zone-all-btn.zone-all-on {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Device list */
.device-list {
    display: flex;
    flex-direction: column;
}

.device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

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

.device-row:hover { background: var(--bg-secondary); }

.device-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.device-icon-wrap svg { fill: var(--text-muted); transition: fill 0.2s; }

.device-icon-wrap.icon-on {
    background: var(--accent-light);
}

.device-icon-wrap.icon-on svg { fill: var(--accent); }

.device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.device-status {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.device-row.device-on .device-status { color: var(--accent); font-weight: 500; }

/* Toggle Switch (iOS-style) */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    display: block;
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), background 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(20px);
    background: white;
}

/* =========================================================
   SETTINGS MODAL
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.appearance-modal {
    background: var(--bg-card);
    border-radius: 28px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header-large {
    padding: 28px 28px 0;
}

.modal-header-large h2 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.modal-header-large .subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.modal-body-scrollable {
    padding: 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    flex: 1;
}

.settings-group { display: flex; flex-direction: column; gap: 12px; }
.settings-group.mt-4 { margin-top: 8px; }

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-text h3 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.header-text p { font-size: 13px; color: var(--text-muted); }

.select-wrapper select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 14px;
    color: var(--text-main);
    font-family: var(--font);
    cursor: pointer;
}

.theme-cards-container {
    display: flex;
    gap: 12px;
}

.theme-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 10px 8px;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.theme-card.active { border-color: var(--accent); }

.theme-preview {
    width: 100%;
    height: 48px;
    border-radius: var(--radius-sm);
}

.theme-preview.auto { background: linear-gradient(90deg, #f5f5f5 50%, #1c1c1e 50%); }
.theme-preview.light { background: #f5f5f5; border: 1px solid #ddd; }
.theme-preview.dark { background: #1c1c1e; }

.theme-card span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.theme-card.active span { color: var(--accent); }

.color-swatches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2.5px solid transparent;
}

.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text-main); }

.user-info-mini {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.user-info-mini img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info-mini .txt { flex: 1; }
.user-info-mini h4 { font-size: 14px; font-weight: 600; }
.user-info-mini p { font-size: 12px; color: var(--text-muted); }

.logout-link-btn {
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #ff375f;
}

.modal-footer-refined {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--border-color);
}

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

.text-btn {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-cancel {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.15s;
}

.btn-save {
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.15s;
}

.btn-save:hover { opacity: 0.85; }
.btn-cancel:hover { background: var(--bg-card); }

/* =========================================================
   HOME PAGE — CONTENT GRID
   ========================================================= */
.home-content-grid {
    position: absolute;
    top: 88px;
    bottom: 98px;
    left: 56px;
    right: 56px;
    display: flex;
    align-items: center;
    gap: 36px;
    z-index: 5;
}

.home-left-panel {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-greeting-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 7px;
    margin-top: 2px;
}

.home-display-name {
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.home-weather-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.home-weather-icon { font-size: 18px; line-height: 1; }
.home-weather-temp { font-weight: 700; color: var(--text-main); font-size: 15px; }
.home-weather-sep { width: 1px; height: 14px; background: var(--border-color); flex-shrink: 0; }
.home-weather-loc { font-size: 13px; }

.home-mini-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.home-mini-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.home-mini-stat svg { opacity: 0.45; flex-shrink: 0; }
.home-mini-sep { opacity: 0.35; font-size: 14px; }

/* Right panel */
.home-info-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
    max-width: 380px;
}

/* Glass card base */
.home-meeting-card,
.home-upcoming-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
    padding: 20px;
}

[data-theme="dark"] .home-meeting-card,
[data-theme="dark"] .home-upcoming-card {
    background: rgba(28,28,30,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.home-card-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Available state */
.home-avail-state {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: #34c759;
    margin-bottom: 6px;
}

.home-avail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34c759;
    flex-shrink: 0;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(52,199,89,0.25); }
    50%       { box-shadow: 0 0 0 7px rgba(52,199,89,0.08); }
}

.home-avail-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Slot buttons */
.home-slot-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.home-slot-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s;
    font-family: var(--font);
}

.home-slot-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.home-slot-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.home-slot-btn-primary:hover { opacity: 0.85; color: white; }
.home-slot-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.home-booking-trigger-wrap {
    display: flex;
    justify-content: flex-start;
    margin-top: 4px;
}

/* Duration selection in modal */
.duration-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.duration-option {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--text-muted);
}

.duration-option:hover {
    border-color: var(--accent);
    background: var(--bg-card);
}

.duration-option.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

/* Meeting in progress */
.home-meeting-active { display: flex; flex-direction: column; gap: 6px; }

.home-meeting-active-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #ff9f0a;
    margin-bottom: 4px;
}

.home-meeting-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff9f0a;
    flex-shrink: 0;
    animation: pulse-orange 1.5s infinite;
}

@keyframes pulse-orange {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.home-meeting-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.home-meeting-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.home-meeting-time-bar {
    height: 3px;
    background: var(--bg-secondary);
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

.home-meeting-time-bar-fill {
    height: 100%;
    background: #ff9f0a;
    border-radius: 3px;
    transition: width 1s linear;
}

/* Upcoming card */
.home-upcoming-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.home-upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.home-upcoming-list::-webkit-scrollbar { width: 3px; }
.home-upcoming-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.home-upcoming-empty {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
    font-style: italic;
}

.home-upcoming-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.home-upcoming-item:hover { background: var(--bg-page); }

.home-upcoming-time-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    min-width: 50px;
}

.home-upcoming-time {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.home-upcoming-duration {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

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

.home-upcoming-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-upcoming-organizer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================================================
   RESPONSIVE (tablet / iPad landscape)
   ========================================================= */
@media (max-width: 900px) {
    .iot-zones-container {
        grid-template-columns: 1fr;
    }

    .home-time { font-size: 80px; letter-spacing: -3px; }
    .home-nav { bottom: 28px; left: 20px; }
    .home-stats-strip { bottom: 90px; }
}

@media (max-width: 768px) {
    .login-split-card { flex-direction: column; height: auto; min-height: 80vh; }
    .login-visual-side { flex: none; padding: 40px; min-height: 240px; }
    .login-form-side { padding: 40px; }
    .visual-copy h2 { font-size: 36px; }

    .home-time { font-size: 60px; letter-spacing: -2px; }
}