/*
   SmartAgri – style.css  v4.0
   Mobile-first · Asset-driven UI
*/

/* ══════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════ */
:root {
    --green-50:  #f0fdf4;
    --green-100: #dcfce7;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;

    --blue-50:   #eff6ff;
    --blue-100:  #dbeafe;
    --blue-500:  #3b82f6;

    --red-50:    #fff1f2;
    --red-100:   #ffe4e6;
    --red-500:   #ef4444;
    --red-600:   #dc2626;

    --amber-50:  #fffbeb;
    --amber-500: #f59e0b;

    --gray-50:   #f8fafc;
    --gray-100:  #f1f5f9;
    --gray-200:  #e2e8f0;
    --gray-300:  #cbd5e1;
    --gray-400:  #94a3b8;
    --gray-500:  #64748b;
    --gray-600:  #475569;
    --gray-700:  #334155;
    --gray-800:  #1e293b;
    --gray-900:  #0f172a;

    --bg:           #ffffff;
    --surface:      #f8fafc;
    --surface-card: #ffffff;
    --border:       var(--gray-200);
    --text:         var(--gray-900);
    --text-muted:   var(--gray-500);
    --primary:      var(--green-600);

    --shadow-sm:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg:   0 10px 24px rgba(0,0,0,0.10);
    --shadow-card: 0 8px 30px rgba(0,0,0,0.06);

    --radius-sm:   8px;
    --radius-md:   16px;
    --radius-lg:   20px;
    --radius-xl:   24px;
    --radius-full: 9999px;

    --nav-height:   65px;
    --header-height: 60px;
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --surface-card: #0f172a;
    --border:       #334155;
    --text:         #f8fafc;
    --text-muted:   #94a3b8;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:    0 10px 24px rgba(0,0,0,0.5);
    
    --gray-50:   #0f172a;
    --gray-100:  #1e293b;
    --gray-200:  #334155;
    --green-50:  rgba(22, 163, 74, 0.1);
    --green-100: rgba(22, 163, 74, 0.2);
    --blue-50:   rgba(59, 130, 246, 0.1);
    --red-50:    rgba(239, 68, 68, 0.1);
}

/* ══════════════════════════════════════════
   RESET
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--surface);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
}
button  { font-family: inherit; cursor: pointer; border: none; background: none; }
input   { font-family: inherit; outline: none; border: none; background: none; }
img     { display: block; max-width: 100%; }
.hidden { display: none !important; }
.mt-10  { margin-top: 10px; }
.mt-20  { margin-top: 20px; }
.full-width { width: 100%; }

/* Colour helpers */
.text-green { color: var(--green-600); }
.text-blue  { color: var(--blue-500);  }
.text-red   { color: var(--red-500);   }
.text-amber { color: var(--amber-500); }
.text-dark  { color: var(--gray-700);  }

/* Icon weight */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ══════════════════════════════════════════
   TOASTS
══════════════════════════════════════════ */
.toast-container {
    position: fixed; top: 16px; right: 16px; left: 16px;
    z-index: 9999; display: flex; flex-direction: column;
    gap: 8px; pointer-events: none; align-items: center;
}
.toast {
    background: var(--gray-900); color: white;
    padding: 12px 20px; border-radius: var(--radius-full);
    font-size: 0.85rem; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    max-width: 340px; text-align: center;
}
.toast.toast-success { background: var(--green-600); }
.toast.toast-error   { background: var(--red-500);   }
.toast.toast-info    { background: var(--blue-500);   }
.toast-fade-out { opacity: 0; transform: translateY(-12px); transition: opacity 0.3s, transform 0.3s; }
@keyframes toastIn {
    from { transform: translateY(-20px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1);        opacity: 1; }
}

/* ══════════════════════════════════════════
   LOADING SCREEN
══════════════════════════════════════════ */
.loading-screen {
    position: fixed; inset: 0; z-index: 10000;
    background: radial-gradient(circle at center, #15803d 0%, #0f172a 100%);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}
.loading-screen.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-bg-glow {
    position: absolute; width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.35) 0%, rgba(0,0,0,0) 70%);
    animation: pulseBg 3s ease-in-out infinite alternate;
}
@keyframes pulseBg {
    from { transform: scale(0.8); opacity: 0.5; }
    to { transform: scale(1.3); opacity: 0.9; }
}
.loading-content {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    align-items: center; gap: 12px; color: white; text-align: center;
}
.loading-logo-wrap.pulse-glow {
    width: 90px; height: 90px; border-radius: 26px;
    overflow: hidden; background: #ffffff;
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.4), 0 0 30px rgba(255, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center;
    animation: floatLogo 3s ease-in-out infinite;
}
@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.loading-logo-img { width: 100%; height: 100%; object-fit: cover; }
.loading-icon      { font-size: 48px; font-variation-settings: 'FILL' 1; color: var(--green-600); }
.loading-brand     { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
.loading-brand .brand-accent { color: #4ade80; }
.loading-tagline   { font-size: 0.85rem; opacity: 0.85; font-weight: 500; }

.splash-progress-track {
    width: 140px; height: 4px; background: rgba(255, 255, 255, 0.2);
    border-radius: 4px; overflow: hidden; margin-top: 4px;
}
.splash-progress-fill {
    width: 100%; height: 100%; background: #4ade80;
    border-radius: 4px; animation: splashLoad 1.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes splashLoad {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.loading-version { font-size: 0.72rem; opacity: 0.65; letter-spacing: 0.5px; }

.spinner {
    width: 26px; height: 26px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: white; border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn-primary {
    background: var(--green-600); color: white;
    border-radius: var(--radius-md); padding: 14px 20px;
    font-size: 0.95rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(22,163,74,0.30);
}
.btn-primary:active { transform: scale(0.97); background: var(--green-700); box-shadow: none; }
.btn-primary:disabled { opacity: 0.55; pointer-events: none; }

.btn-secondary {
    background: var(--surface-card); color: var(--text);
    border: 1.5px solid var(--border); border-radius: var(--radius-md);
    padding: 12px 16px; font-size: 0.9rem; font-weight: 600;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s;
}
.btn-secondary:active  { background: var(--gray-100); }
.btn-secondary.danger  { color: var(--red-500); border-color: var(--red-100); background: var(--red-50); }
.btn-secondary:disabled { opacity: 0.55; pointer-events: none; }

.text-btn  { color: var(--green-600); font-size: 0.85rem; font-weight: 600; padding: 4px 0; }
.icon-btn  {
    color: var(--gray-700); padding: 8px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; position: relative; transition: background 0.15s;
}
.icon-btn:active { background: var(--gray-100); }

/* ══════════════════════════════════════════
   TOGGLE SWITCH
══════════════════════════════════════════ */
.toggle-switch         { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.toggle-switch.large   { width: 52px; height: 30px; }
.toggle-switch input   { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--gray-300); transition: 0.3s; border-radius: 26px;
}
.toggle-slider::before {
    content: ""; position: absolute;
    height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: white; transition: 0.3s; border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch.large .toggle-slider::before { height: 24px; width: 24px; left: 3px; bottom: 3px; }
input:checked + .toggle-slider                    { background: var(--green-500); }
input:checked + .toggle-slider::before            { transform: translateX(18px); }
.toggle-switch.large input:checked + .toggle-slider::before { transform: translateX(22px); }
input:disabled + .toggle-slider                   { opacity: 0.5; cursor: not-allowed; }

/* ══════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════ */
.login-screen {
    position: fixed; inset: 0; z-index: 1000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-bg-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(160deg, var(--green-50) 0%, var(--bg) 60%);
    pointer-events: none;
}
.login-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; gap: 28px;
}
.login-header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.login-logo-wrap {
    width: 76px; height: 76px; border-radius: 22px;
    overflow: hidden; background: var(--green-50);
    border: 2px solid var(--green-100);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px; box-shadow: var(--shadow-md);
}
.login-logo-img  { width: 100%; height: 100%; object-fit: cover; }
.login-logo-icon { font-size: 40px; color: var(--green-600); font-variation-settings: 'FILL' 1; }
.login-title     { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
.login-subtitle  { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.input-group {
    display: flex; align-items: center;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); padding: 0 16px; height: 54px; gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group:focus-within {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
    background: white;
}
.input-icon  { color: var(--text-muted); font-size: 20px; }
.form-input  { flex: 1; height: 100%; font-size: 1rem; color: var(--text); }
.error-msg   {
    background: var(--red-50); color: var(--red-600);
    padding: 12px 14px; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 500; text-align: center;
    border: 1px solid var(--red-100);
    display: flex; align-items: center; gap: 8px;
}
.btn-spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ══════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════ */
.app-screen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    background: var(--surface);
}
.app-header {
    height: var(--header-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px; background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: relative; z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-logo-wrap {
    width: 36px; height: 36px; border-radius: 10px;
    overflow: hidden; background: var(--green-50);
    border: 1.5px solid var(--green-100);
    display: flex; align-items: center; justify-content: center;
}
.brand-logo-img { width: 100%; height: 100%; object-fit: cover; }
.brand-icon     { color: var(--green-600); font-variation-settings: 'FILL' 1; }
.brand-text     { display: flex; flex-direction: column; }
.brand-title    { font-weight: 700; font-size: 1rem; line-height: 1.2; letter-spacing: -0.3px; }
.brand-sub      { font-size: 0.62rem; color: var(--text-muted); font-weight: 500; }

.notif-btn { position: relative; }
.notif-badge {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--red-500); border-radius: 50%;
    border: 1.5px solid white;
}

.app-main {
    flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
    -webkit-overflow-scrolling: touch;
}
.screen {
    padding: 16px 16px 0;
    animation: fadeUp 0.28s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   BOTTOM NAV
══════════════════════════════════════════ */
.bottom-nav {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    background: var(--bg);
    display: flex; justify-content: space-around;
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
    z-index: 50;
}
.nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    color: var(--text-muted); transition: color 0.2s;
    position: relative;
}
.nav-icon  { font-size: 22px; transition: transform 0.2s; }
.nav-label { font-size: 0.62rem; font-weight: 600; }
.nav-item.active { color: var(--green-600); }
.nav-item.active::before {
    content: '';
    position: absolute; top: 0; left: 25%; right: 25%; height: 2.5px;
    background: var(--green-600); border-radius: 0 0 4px 4px;
}
.nav-item.active .nav-icon {
    font-variation-settings: 'FILL' 1;
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════
   HOME – HERO CARD
══════════════════════════════════════════ */
.hero-card {
    position: relative; min-height: 190px; border-radius: var(--radius-xl);
    overflow: hidden; color: white;
    display: flex; flex-direction: column;
    padding: 20px; box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}
.hero-bg-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover;
}
.hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(15,76,29,0.78) 0%, rgba(22,163,74,0.55) 100%);
}
.hero-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; height: 100%; justify-content: space-between;
}
.hero-top {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.82rem; font-weight: 600; opacity: 0.95;
}
.hero-location-wrap { display: flex; align-items: center; gap: 4px; }
.hero-location-icon { font-size: 16px; }

.live-pulse-badge {
    background: rgba(34, 197, 94, 0.25);
    border: 1px solid rgba(74, 222, 128, 0.5);
    color: #4ade80; font-size: 0.68rem; font-weight: 700;
    padding: 2px 8px; border-radius: 12px;
    display: flex; align-items: center; gap: 5px; letter-spacing: 0.5px;
}
.pulse-dot {
    width: 6px; height: 6px; background: #4ade80; border-radius: 50%;
    animation: blinkPulse 1.2s infinite;
}
@keyframes blinkPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.4); }
}

.hero-weather {
    display: flex; align-items: center; gap: 8px;
    margin-top: 10px;
}
.weather-icon  { font-size: 38px; font-variation-settings: 'FILL' 1; color: #fde68a; }
.weather-temp  { font-size: 2.3rem; font-weight: 800; letter-spacing: -1px; }
.unit-toggle-btn {
    background: rgba(255,255,255,0.2);
    color: white; border: 1px solid rgba(255,255,255,0.3);
    padding: 2px 8px; border-radius: 8px;
    font-size: 0.75rem; font-weight: 700;
    margin-left: 4px; transition: background 0.2s; cursor: pointer;
}
.unit-toggle-btn:hover, .unit-toggle-btn:active {
    background: rgba(255,255,255,0.35);
}

.hero-weather-details { display: flex; flex-direction: column; margin-top: 2px; }
.weather-desc  { font-size: 0.9rem; opacity: 0.95; font-weight: 600; }
.weather-sub   { font-size: 0.75rem; opacity: 0.82; font-weight: 400; margin-top: 2px; }

.refresh-weather-btn {
    position: absolute; bottom: 16px; right: 16px;
    color: rgba(255,255,255,0.85); background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s; cursor: pointer;
}
.refresh-weather-btn:active { transform: scale(0.9); background: rgba(0,0,0,0.4); }
.refresh-weather-btn.spinning .material-symbols-outlined {
    animation: spin 0.8s linear infinite;
}

/* ══════════════════════════════════════════
   HOME – METRICS GRID
══════════════════════════════════════════ */
.metrics-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin-bottom: 14px;
}
.metric-card {
    background: var(--surface-card); border-radius: var(--radius-md);
    padding: 14px 10px; display: flex; flex-direction: column;
    align-items: center; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    transition: transform 0.15s;
}
.metric-card:active { transform: scale(0.97); }
.metric-icon       { font-size: 22px; margin-bottom: 6px; font-variation-settings: 'FILL' 1; }
.metric-icon.blue  { color: var(--blue-500);  }
.metric-icon.green { color: var(--green-600); }
.metric-icon.amber { color: var(--amber-500); }
.metric-val        { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.metric-lbl        { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ══════════════════════════════════════════
   HOME – STATUS BAR
══════════════════════════════════════════ */
.status-bar {
    display: flex; align-items: center;
    background: var(--surface-card); border-radius: var(--radius-md);
    padding: 12px 20px; margin-bottom: 12px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    gap: 16px;
}
.status-divider { width: 1px; height: 28px; background: var(--border); }
.status-item    { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.status-label   {
    font-size: 0.62rem; text-transform: uppercase;
    font-weight: 700; color: var(--text-muted); letter-spacing: 0.6px;
}
.status-indicator  { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; }
.status-dot        { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); flex-shrink: 0; }
.status-indicator.connected .status-dot  { background: var(--green-500); box-shadow: 0 0 0 3px var(--green-100); animation: pulseGlow 2s infinite; }
.status-indicator.connected .status-text { color: var(--green-700); }
.status-indicator.offline  .status-dot  { background: var(--red-500); }
.status-indicator.offline  .status-text { color: var(--red-600); }
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 3px var(--green-100); }
    50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0.2); }
}

.alert-box {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius-md);
    font-size: 0.85rem; font-weight: 600; margin-bottom: 14px;
}
.alert-box.error { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-100); }
.alert-icon      { font-size: 20px; }

/* ══════════════════════════════════════════
   HOME – DEVICES MINI GRID
══════════════════════════════════════════ */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h2 { font-size: 1.05rem; font-weight: 700; }
.section-header h3 { font-size: 0.95rem; font-weight: 600; }

.devices-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 14px;
}
.device-card-mini {
    background: var(--surface-card); border-radius: var(--radius-lg);
    padding: 14px; display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm); border: 1.5px solid var(--border);
    transition: border-color 0.25s, box-shadow 0.25s;
    overflow: hidden;
}
.device-card-mini.active {
    border-color: var(--green-400, #4ade80);
    box-shadow: 0 4px 16px rgba(34,197,94,0.15);
}
.dmini-img-wrap {
    width: 100%; height: 64px; border-radius: var(--radius-sm);
    background: transparent;
    margin-bottom: 10px;
    display: flex; align-items: center; justify-content: center;
}
.dmini-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.3s; }
.device-card-mini:active .dmini-img { transform: scale(1.05); }

.dmini-info { display: flex; flex-direction: column; flex: 1; margin-bottom: 10px; }
.dmini-name { font-size: 0.88rem; font-weight: 700; line-height: 1.2; }
.dmini-gpio { font-size: 0.62rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.device-card-mini .toggle-switch { align-self: flex-start; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }

/* ══════════════════════════════════════════
   CONTROL SCREEN
══════════════════════════════════════════ */
.screen-header { margin-bottom: 16px; }
.screen-header h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; }

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

.device-card-large {
    background: var(--surface-card); border-radius: var(--radius-xl);
    overflow: hidden; box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--border);
    transition: border-color 0.25s, box-shadow 0.25s;
}
.device-card-large.active {
    border-color: var(--green-500);
    box-shadow: 0 4px 20px rgba(34,197,94,0.12);
}

/* Device image at top of each card */
.card-device-img-wrap {
    width: 100%; height: 150px; overflow: hidden;
    background: transparent;
    display: flex; align-items: center; justify-content: center;
}
.card-device-img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    transition: transform 0.4s ease;
}
.device-card-large:hover .card-device-img { transform: scale(1.03); }
.pump-img  { object-position: center; }
.valve-img { object-position: center; }

.card-large-top {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 16px 8px;
}
.dlarge-info { flex: 1; }
.dlarge-info h3    { font-size: 1.1rem; font-weight: 700; }
.card-desc-sub     { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; display: block; margin-top: 1px; }
.badge-gpio {
    display: inline-block; font-size: 0.62rem; font-weight: 600;
    color: var(--text-muted); background: var(--gray-100);
    padding: 2px 8px; border-radius: var(--radius-full); margin-top: 5px;
}

/* Card detail rows (valve details) */
.card-detail-row { display: flex; flex-direction: column; gap: 0; padding: 0 16px; }
.card-detail-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-top: 1px solid var(--gray-100);
}
.card-detail-icon { font-size: 18px; }
.card-detail-icon.green { color: var(--green-600); }
.card-detail-icon.blue  { color: var(--blue-500);  }
.card-detail-lbl  { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.card-detail-val  { display: block; font-size: 0.88rem; font-weight: 600; }
.device-card-large > .btn-primary { margin: 12px 16px 16px; width: calc(100% - 32px); border-radius: var(--radius-md); }

/* Pump Controls */
.pump-controls {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border); margin-top: 4px; padding-top: 14px;
}
.pump-mode-toggle {
    display: flex; background: var(--gray-100);
    border-radius: var(--radius-md); padding: 4px; margin-bottom: 14px;
}
.mode-btn {
    flex: 1; padding: 8px; font-size: 0.85rem; font-weight: 600;
    border-radius: var(--radius-sm); color: var(--text-muted);
    transition: all 0.2s;
}
.mode-btn.active { background: white; color: var(--green-600); box-shadow: var(--shadow-sm); }

/* Pump stats */
.pump-stats-row { display: flex; flex-direction: column; gap: 0; margin-bottom: 4px; }
.pump-stat {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.pump-stat:last-child { border-bottom: none; }
.pump-stat-icon { font-size: 20px; font-variation-settings: 'FILL' 1; }
.pump-stat-icon.amber { color: var(--amber-500); }
.pump-stat-icon.gray  { color: var(--gray-400);  }
.pump-stat-icon.blue  { color: var(--blue-500);  }
.pump-stat-lbl  { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.pump-stat-val  { display: block; font-size: 0.95rem; font-weight: 700; }

/* Timer */
.timer-view {
    background: var(--gray-50); border-radius: var(--radius-md);
    padding: 14px; border: 1px solid var(--border); margin-top: 10px;
}
.preset-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-bottom: 14px;
}
.btn-preset {
    background: white; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: 9px 0;
    font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
    transition: all 0.15s;
}
.btn-preset.active {
    background: var(--green-50); border-color: var(--green-500);
    color: var(--green-700); box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}
.custom-time {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 0.9rem; font-weight: 600; color: var(--text-muted);
}
.custom-time input {
    width: 48px; height: 42px;
    background: white; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); text-align: center;
    font-size: 1rem; font-weight: 700; color: var(--text);
    transition: border-color 0.2s;
}
.custom-time input:focus { border-color: var(--green-500); }

.timer-active-box { text-align: center; }
.timer-active-top {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 0.9rem; font-weight: 600; color: var(--green-600); margin-bottom: 12px;
}
.pulse-icon { animation: pulseOpacity 1.8s infinite; }
@keyframes pulseOpacity { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
.timer-countdown {
    font-size: 2.6rem; font-weight: 800; font-family: monospace;
    color: var(--text); line-height: 1; margin-bottom: 16px;
    letter-spacing: 2px;
}
.progress-bg  { height: 8px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 8px; }
.progress-fill{ height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-400)); width: 100%; transition: width 1s linear; border-radius: var(--radius-full); }

/* ══════════════════════════════════════════
   SCHEDULE SCREEN
══════════════════════════════════════════ */
.schedule-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 80px; }
.schedule-card {
    background: var(--surface-card); border-radius: var(--radius-lg);
    padding: 16px; box-shadow: var(--shadow-sm); border: 1.5px solid var(--border);
    transition: border-color 0.2s;
}
.sch-top   { display: flex; align-items: center; gap: 14px; }
.sch-icon  {
    width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: var(--blue-50); color: var(--blue-500);
}
.sch-info  { flex: 1; display: flex; flex-direction: column; }
.sch-info h3 { font-size: 1rem; font-weight: 700; }
.sch-time  { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-top: 2px; }
.sch-days  { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

/* Schedule card actions */
.sch-actions {
    display: flex; gap: 8px; margin-top: 12px;
    padding-top: 12px; border-top: 1px solid var(--gray-100);
}
.sch-btn {
    flex: 1; padding: 6px 0; font-size: 0.8rem; font-weight: 600;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center; gap: 4px;
    background: var(--surface); color: var(--text-muted);
    border: 1px solid var(--border); transition: all 0.2s;
}
.sch-btn:active { background: var(--gray-100); }
.sch-btn.edit:active { color: var(--blue-500); border-color: var(--blue-100); background: var(--blue-50); }
.sch-btn.delete:active { color: var(--red-500); border-color: var(--red-100); background: var(--red-50); }

/* Modal */
.modal {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 1; transition: opacity 0.3s;
}
.modal.hidden {
    opacity: 0; pointer-events: none;
}
.modal-bg-overlay {
    position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-card {
    position: relative; background: var(--bg);
    width: 100%; max-width: 400px;
    border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    transform: translateY(0) scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.modal.hidden .modal-card {
    transform: translateY(20px) scale(0.95);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.modal-body { padding: 20px; }

/* Forms in Modal */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.input-wrap {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); padding: 0 12px; height: 48px;
    transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: var(--green-500); background: white; }
.input-wrap .input-icon { color: var(--gray-400); font-size: 20px; }
.input-wrap .form-input {
    flex: 1; height: 100%; width: 100%;
    font-size: 0.95rem; color: var(--text); background: transparent;
}
select.form-input { appearance: none; cursor: pointer; }

/* Day Picker */
.day-picker { display: flex; justify-content: space-between; gap: 6px; }
.day-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface); border: 1.5px solid var(--border);
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.day-btn.active {
    background: var(--green-50); border-color: var(--green-500);
    color: var(--green-700);
}

/* Disabled schedule card */
.schedule-card.sch-disabled { opacity: 0.55; }

/* Empty state */
.sch-empty {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.sch-empty .material-symbols-outlined { font-size: 48px; opacity: 0.4; }
.sch-empty p { font-size: 0.9rem; line-height: 1.6; }

.floating-btn {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    left: 50%; transform: translateX(-50%);
    box-shadow: var(--shadow-lg); border-radius: var(--radius-full);
    padding: 14px 28px; z-index: 20; white-space: nowrap;
}

/* ══════════════════════════════════════════
   MONITOR SCREEN
══════════════════════════════════════════ */
.sensor-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 12px; margin-bottom: 4px;
}
.sensor-box {
    background: var(--surface-card); border-radius: var(--radius-lg);
    padding: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: transform 0.15s;
}
.sensor-box:active { transform: scale(0.97); }
.sensor-box.red-accent   { border-left-color: var(--red-500);   }
.sensor-box.blue-accent  { border-left-color: var(--blue-500);  }
.sensor-box.green-accent { border-left-color: var(--green-500); }
.sensor-box.amber-accent { border-left-color: var(--amber-500); }

.sensor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.s-name      { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.s-val       { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }

/* Sparkline decoration */
.s-sparkline {
    margin-top: 10px; height: 28px; border-radius: 4px; opacity: 0.5;
    background: repeating-linear-gradient(
        90deg,
        transparent 0, transparent 6px,
        currentColor 6px, currentColor 7px
    );
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 28'%3E%3Cpolyline points='0,20 10,14 20,18 30,8 40,16 50,10 60,14 70,6 80,12' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 28'%3E%3Cpolyline points='0,20 10,14 20,18 30,8 40,16 50,10 60,14 70,6 80,12' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
    -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.s-sparkline.red   { color: var(--red-500);   }
.s-sparkline.blue  { color: var(--blue-500);  }
.s-sparkline.green { color: var(--green-500); }
.s-sparkline.amber { color: var(--amber-500); }

.sys-overall {
    font-size: 0.78rem; font-weight: 700;
    color: var(--green-700); background: var(--green-50);
    padding: 4px 10px; border-radius: var(--radius-full);
}
.sys-overall.offline { color: var(--red-600); background: var(--red-50); }

.monitor-card { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.system-status-list { padding: 4px 16px; }
.sys-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid var(--gray-100);
}
.sys-item:last-child { border-bottom: none; }
.sys-icon   { color: var(--gray-400); font-size: 22px; }
.sys-icon.green { color: var(--green-600); }
.sys-info   { flex: 1; }
.sys-lbl    { font-size: 0.9rem; font-weight: 600; }
.sys-val.badge {
    padding: 4px 12px; border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 700;
}
.sys-val.badge.green { background: var(--green-50);   color: var(--green-700); }
.sys-val.badge.gray  { background: var(--gray-100);   color: var(--gray-600);  }
.sys-val.badge.red   { background: var(--red-50);     color: var(--red-600);   }
.sys-val.text { font-size: 0.85rem; font-weight: 600; font-family: monospace; color: var(--text-muted); }

/* ══════════════════════════════════════════
   SETTINGS SCREEN
══════════════════════════════════════════ */
.settings-list {
    background: var(--surface-card); border-radius: var(--radius-xl);
    padding: 4px 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.setting-item {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 0; border-bottom: 1px solid var(--gray-100);
    cursor: pointer; transition: background 0.15s;
    border-radius: var(--radius-sm);
}
.setting-item:last-child { border-bottom: none; }
.setting-item:active     { background: var(--gray-50); }
.set-icon-wrap {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.set-icon-wrap.green-bg { background: var(--green-50);  }
.set-icon-wrap.gray-bg  { background: var(--gray-100);  }
.set-icon-wrap.red-bg   { background: var(--red-50);    }
.set-icon-wrap.blue-bg  { background: var(--blue-50);   }
.set-icon    { font-size: 20px; }
.set-label   { flex: 1; font-size: 0.95rem; font-weight: 600; }
.set-chevron { color: var(--gray-300); }

.settings-footer { text-align: center; margin-top: 36px; color: var(--text-muted); }
.sf-logo-wrap {
    width: 64px; height: 64px; border-radius: 18px;
    overflow: hidden; background: var(--green-50);
    border: 2px solid var(--green-100);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
}
.sf-logo-img { width: 100%; height: 100%; object-fit: cover; }
.sf-icon     { font-size: 38px; font-variation-settings: 'FILL' 1; }
.settings-footer h3 { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.settings-footer p  { font-size: 0.82rem; margin-top: 4px; line-height: 1.6; }
.btn-logout {
    background: var(--red-50); color: var(--red-600);
    border: 1.5px solid var(--red-100); border-radius: var(--radius-md);
    padding: 12px 28px; font-size: 0.9rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s;
}
.btn-logout:active { background: var(--red-100); }

/* ══════════════════════════════════════════
   PULL-TO-REFRESH
══════════════════════════════════════════ */
.ptr-indicator {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 0; overflow: hidden;
    max-height: 0; opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}
.ptr-indicator.visible {
    max-height: 80px; opacity: 1; padding: 16px 0 8px;
}
.ptr-indicator.refreshing .ptr-icon {
    animation: spin 0.9s linear infinite;
}
.ptr-spinner {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface-card); border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}
.ptr-icon { font-size: 20px; color: var(--green-600); transition: transform 0.2s; }
.ptr-text { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

/* ══════════════════════════════════════════
   ACTIVITY LOG SCREEN
══════════════════════════════════════════ */
.activity-filter-bar {
    display: flex; gap: 8px; padding: 0 20px 12px;
    overflow-x: auto; scrollbar-width: none;
}
.activity-filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
    padding: 6px 14px; border-radius: var(--radius-full);
    background: var(--surface-card); border: 1.5px solid var(--border);
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    white-space: nowrap; transition: all 0.2s;
}
.filter-chip.active {
    background: var(--green-600); color: white; border-color: var(--green-600);
}
.filter-chip:active { transform: scale(0.95); }

.activity-timeline {
    padding: 0 20px 20px; display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto; max-height: calc(100vh - 280px);
}
.activity-entry {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px; border-radius: var(--radius-md);
    background: var(--surface-card); border: 1px solid var(--border);
    animation: fadeSlideIn 0.3s ease forwards;
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.activity-icon-wrap {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.activity-icon-wrap.device  { background: var(--blue-50);  color: var(--blue-500);  }
.activity-icon-wrap.sensor  { background: var(--green-50); color: var(--green-600); }
.activity-icon-wrap.schedule{ background: rgba(139,92,246,0.1); color: #8b5cf6; }
.activity-icon-wrap.alert   { background: var(--red-50);   color: var(--red-500);   }

.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.activity-desc  { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.activity-time  { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; opacity: 0.7; }

.activity-empty {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.activity-empty-icon { font-size: 56px; opacity: 0.25; margin-bottom: 12px; display: block; }
.activity-empty p    { font-size: 1rem; font-weight: 600; }
.activity-empty-sub  { font-size: 0.82rem; opacity: 0.65; margin-top: 4px; display: block; }

/* ══════════════════════════════════════════
   SENSOR ALERT THRESHOLDS
══════════════════════════════════════════ */
.alert-threshold-group {
    margin-bottom: 16px; padding: 14px;
    background: var(--surface); border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.alert-th-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.9rem; font-weight: 700; color: var(--text);
    margin-bottom: 12px;
}
.alert-th-header .material-symbols-outlined { font-size: 20px; }

/* Pulsing border for metric cards when an alert fires */
.metric-card.alert-active {
    border: 2px solid var(--red-500);
    animation: pulseAlert 1.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}
@keyframes pulseAlert {
    0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.25); }
    50%      { box-shadow: 0 0 20px rgba(239, 68, 68, 0.45); }
}

/* Sensor box alert state for monitor screen */
.sensor-box.alert-active {
    border: 2px solid var(--red-500) !important;
    animation: pulseAlert 1.5s ease-in-out infinite;
}

/* Amber bg helper */
.set-icon-wrap.amber-bg { background: rgba(245, 158, 11, 0.1); }

/* ══════════════════════════════════════════
   CUSTOM DEVICES & DEVICE MANAGEMENT
══════════════════════════════════════════ */
/* Icon Picker */
.icon-picker-grid {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 8px; margin-top: 8px; max-height: 140px; overflow-y: auto;
    padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
}
.icon-chip {
    display: flex; align-items: center; justify-content: center;
    width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm);
    background: var(--bg); border: 1px solid var(--border);
    cursor: pointer; transition: all 0.2s; color: var(--text-muted);
}
.icon-chip .material-symbols-outlined { font-size: 24px; }
.icon-chip:hover { background: var(--gray-50); }
.icon-chip.selected {
    background: var(--green-50); border-color: var(--green-500);
    color: var(--green-600); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

/* Image Upload Area */
.image-upload-area {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100px; border: 2px dashed var(--border);
    border-radius: var(--radius-md); background: var(--surface);
    cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
    margin-top: 8px; color: var(--text-muted);
}
.image-upload-area:hover { border-color: var(--green-400); background: var(--green-50); color: var(--green-600); }
.image-upload-area .material-symbols-outlined { font-size: 32px; margin-bottom: 4px; }
.image-upload-area span { font-size: 0.8rem; font-weight: 500; }
.image-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; display: none; }
.image-upload-area.has-image .image-preview { display: block; }
.image-upload-area.has-image .material-symbols-outlined,
.image-upload-area.has-image span { display: none; }
.image-upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; }

/* GPIO Pin Badge */
.gpio-pin-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gray-100); color: var(--text-muted);
    font-size: 0.75rem; font-weight: 700; padding: 2px 8px;
    border-radius: var(--radius-full); margin-left: auto;
}
.gpio-pin-badge.in-use { background: var(--red-50); color: var(--red-600); }
.gpio-pin-badge.available { background: var(--green-50); color: var(--green-700); }

/* Add Device FAB (Control Screen & Home Screen) */
.btn-add-device-card {
    background: transparent; border: 2px dashed var(--border);
    border-radius: var(--radius-lg); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px; padding: 20px;
    color: var(--text-muted); cursor: pointer; transition: all 0.2s;
    min-height: 120px;
}
.btn-add-device-card:hover { border-color: var(--green-400); background: var(--green-50); color: var(--green-600); }
.btn-add-device-card .material-symbols-outlined { font-size: 32px; }
.btn-add-device-card span { font-size: 0.9rem; font-weight: 600; }

.custom-device-icon {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: var(--green-600); background: var(--green-50); border-radius: var(--radius-sm);
}

/* Device Management List */
.device-mgmt-list { display: flex; flex-direction: column; gap: 10px; max-height: 400px; overflow-y: auto; margin-top: 10px; }
.device-mgmt-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.device-mgmt-info { flex: 1; display: flex; flex-direction: column; }
.device-mgmt-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.device-mgmt-type { font-size: 0.75rem; color: var(--text-muted); }
.device-mgmt-actions { display: flex; gap: 6px; }
.device-mgmt-actions .icon-btn { padding: 6px; }

/* ══════════════════════════════════════════
   DESKTOP FRAME
══════════════════════════════════════════ */
@media (min-width: 768px) {
    body {
        background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
        display: flex; justify-content: center; align-items: center;
        min-height: 100vh;
    }
    .app-screen, .login-screen {
        position: relative; width: 390px; height: 844px;
        max-height: 95vh; border-radius: 44px;
        box-shadow: 0 40px 80px rgba(0,0,0,0.25), 0 0 0 8px #1e293b, 0 0 0 10px #334155;
        overflow: hidden; inset: auto;
    }
    .bottom-nav { position: absolute; }
}

/* ══════════════════════════════════════════
   PHASE 4: DUAL-STATE UI
══════════════════════════════════════════ */
.pending-sync {
    opacity: 0.6;
    animation: pendingPulse 1.2s infinite alternate;
}
.pending-sync .dmini-name::after, .pending-sync .dlarge-info h3::after {
    content: " (Syncing...)";
    font-size: 0.7em;
    color: var(--blue-500);
}
@keyframes pendingPulse {
    0% { opacity: 0.8; }
    100% { opacity: 0.4; }
}
