@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ═══ CUSTOM SCROLLBAR (glass, thin, dark) ═══ */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(52,211,153,0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(52,211,153,0.3);
}
::-webkit-scrollbar-corner {
    background: transparent;
}
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(52,211,153,0.15) transparent;
}

html, body {
    height: 100%;
    height: -webkit-fill-available;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #06120a;
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(52,211,153,0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(16,185,129,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(6,78,59,0.08) 0%, transparent 60%);
    color: #e2e8f0;
    overflow: hidden;
}

.app {
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
}

.header {
    flex-shrink: 0;
    padding: 10px 12px;
    background: rgba(6,30,18,0.65);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid rgba(52,211,153,0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.logo { 
    font-size: 1rem; font-weight: 800; letter-spacing: 2px;
    background: linear-gradient(135deg, #34d399, #6ee7b7, #a7f3d0);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(52,211,153,0.3));
}

.status-row { display: flex; gap: 8px; font-size: 0.6rem; }
.status-item { display: flex; align-items: center; gap: 3px; color: rgba(255,255,255,0.5); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #f85149; }
.status-dot.on { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,0.6); }

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-name {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}
.user-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(6,30,18,0.4);
    border: 1px solid rgba(52,211,153,0.12);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.75rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.user-btn:hover { border-color: #34d399; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: rgba(6,30,18,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: 10px;
    min-width: 120px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
    display: block;
    padding: 10px 14px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.8rem;
}
.dropdown-menu a:hover { background: rgba(52,211,153,0.08); color: #fff; }

.header-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 500;
}
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(52,211,153,0.12);
    background: rgba(6,30,18,0.4);
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { border-color: #34d399; color: #fff; }
.btn-icon.active { background: #059669; border-color: #34d399; color: #fff; }
.btn-icon.muted { background: #f85149; border-color: #f85149; color: #fff; }

.btn-camera {
    padding: 6px 10px;
    background: linear-gradient(135deg, #059669, #34d399);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
}

.tabs {
    flex-shrink: 0;
    display: flex;
    background: rgba(6,30,18,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(52,211,153,0.08);
    z-index: 5;
    padding: 6px 12px;
    gap: 4px;
}

.tab {
    flex: 1;
    padding: 9px 8px;
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}
.tab:active { background: rgba(52,211,153,0.06); }
.tab.active { 
    color: #fff; 
    background: rgba(52,211,153,0.12);
    border: 1px solid rgba(52,211,153,0.2);
    box-shadow: 0 0 16px rgba(52,211,153,0.08);
    text-shadow: 0 0 10px rgba(52,211,153,0.3);
}

.tab-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    position: relative;
}
.tab-content.active { display: flex; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Pull-to-refresh indicator */
.pull-refresh {
    text-align: center;
    padding: 0;
    height: 0;
    overflow: hidden;
    transition: height 0.2s, padding 0.2s;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.pull-refresh.pulling {
    height: 40px;
    padding: 8px 0;
}
.pull-refresh.refreshing {
    height: 40px;
    padding: 8px 0;
    color: #34d399;
}
.pull-refresh .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #34d399;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.pull-refresh.refreshing .spinner { display: inline-block; }
.pull-refresh .arrow { transition: transform 0.2s; }
.pull-refresh.ready .arrow { transform: rotate(180deg); }
.pull-refresh.refreshing .arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #fff;
    position: relative;
    animation: msgIn 0.25s ease-out;
}
@keyframes msgIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.message img {
    max-width: 100%;
    border-radius: 10px;
    margin-bottom: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.message.user { align-self: flex-end; background: linear-gradient(135deg, #059669, #0d9465); border-radius: 18px 18px 4px 18px; box-shadow: 0 2px 12px rgba(5,150,105,0.2); }
.message.juno_grow, .message.assistant { 
    align-self: flex-start; 
    background: rgba(6,30,18,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(52,211,153,0.08);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.15);
}
.message.juno_grow.speaking, .message.assistant.speaking { border-color: #34d399; box-shadow: 0 0 12px rgba(52,211,153,0.3); }

.message h3 {
    color: #34d399;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 12px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(52,211,153,0.15);
}
.message h3:first-child { margin-top: 0; }

.message strong, .message b { color: #34d399; font-weight: 600; }
.message .status-ok { color: #3fb950; }
.message .status-warn { color: #d29922; }
.message .status-bad { color: #f85149; }

.typing {
    align-self: flex-start;
    padding: 10px 18px;
    background: rgba(6,30,18,0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(52,211,153,0.08);
    border-radius: 18px 18px 18px 4px;
    color: rgba(52,211,153,0.7);
    font-size: 0.85rem;
    display: none;
    gap: 6px;
    align-items: center;
}
.typing.show { display: flex; }
.typing-dots { display: flex; gap: 4px; align-items: center; }
.typing-dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(52,211,153,0.6);
    animation: typeDot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typeDot { 0%,60%,100% { transform: translateY(0); opacity:0.4; } 30% { transform: translateY(-6px); opacity:1; } }

.input-area {
    flex-shrink: 0;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(6,30,18,0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(52,211,153,0.1);
}

.quick-btns {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    position: relative;
    flex-wrap: wrap;
}

.quick-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    background: rgba(6,30,18,0.4);
    border: 1px solid rgba(52,211,153,0.12);
    border-radius: 14px;
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-width: 0;
    padding: 12px 48px 12px 16px;
    background: rgba(6,18,10,0.6);
    border: 1px solid rgba(52,211,153,0.12);
    border-radius: 24px;
    color: #e2e8f0;
    font-size: 0.88rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 46px;
    line-height: 1.4;
    overflow-y: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-input:focus { outline: none; border-color: rgba(52,211,153,0.3); box-shadow: 0 0 16px rgba(52,211,153,0.08); }
.chat-input::placeholder { color: rgba(255,255,255,0.3); font-weight: 400; }
.chat-bar-wrap { position: relative; flex: 1; display: flex; align-items: flex-end; }
.chat-disclaim { text-align: center; font-size: 0.6rem; color: rgba(255,255,255,0.2); padding: 4px 0 2px; }
.chat-disclaim a { color: rgba(255,255,255,0.25); text-decoration: none; }
.btn-morph { position: absolute; right: 5px; bottom: 5px; width: 36px; height: 36px; border-radius: 50%; background: rgba(43,232,0,0.1); color: rgba(43,232,0,0.6); border: 1.5px solid rgba(43,232,0,0.2); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.25s ease; }
.btn-morph:hover { background: rgba(43,232,0,0.15); border-color: rgba(43,232,0,0.4); }
.btn-morph.send-mode { background: #2be800; color: #000; border-color: #2be800; box-shadow: 0 0 12px rgba(43,232,0,0.3); }
.btn-morph.send-mode:hover { box-shadow: 0 0 20px rgba(43,232,0,0.4); transform: scale(1.05); }
.btn-morph.voice-active { background: rgba(43,232,0,0.2); border-color: #2be800; color: #2be800; box-shadow: 0 0 16px rgba(43,232,0,0.3); animation: voicePulse 1.5s ease infinite; }
@keyframes voicePulse { 0%,100% { box-shadow: 0 0 16px rgba(43,232,0,0.3); } 50% { box-shadow: 0 0 28px rgba(43,232,0,0.5); } }

.btn-attach-new { width: 42px; height: 42px; border-radius: 50%; background: transparent; border: 1.5px solid rgba(255,255,255,0.1); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: rgba(255,255,255,0.4); transition: all 0.2s; flex-shrink: 0; }
.btn-attach-new:hover { border-color: rgba(255,255,255,0.25); color: rgba(255,255,255,0.7); }
.chat-drop-overlay { display:none; position:absolute; inset:0; background:rgba(52,211,153,0.12); border:2px dashed #34d399; border-radius:12px; z-index:50; align-items:center; justify-content:center; flex-direction:column; pointer-events:none; }
.chat-drop-overlay.active { display:flex; }
.chat-drop-overlay .drop-icon { font-size:2.5rem; margin-bottom:8px; }
.chat-drop-overlay .drop-text { color:#34d399; font-size:0.85rem; font-weight:600; }
.chat-drop-overlay .drop-sub { color:rgba(255,255,255,0.5); font-size:0.7rem; margin-top:4px; }
.chat-photo-strip .pdf-badge { background:#d29922; color:#000; font-size:0.6rem; font-weight:700; padding:1px 5px; border-radius:3px; position:absolute; top:4px; right:4px; }
.chat-photo-strip .pdf-name { color:rgba(255,255,255,0.75); font-size:0.7rem; max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.btn-circle {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
}
.btn-send { background: linear-gradient(135deg, #059669, #34d399); color: #fff; box-shadow: 0 2px 12px rgba(52,211,153,0.3); }
.btn-mic { background: rgba(6,30,18,0.4); color: rgba(255,255,255,0.5); }
.btn-mic.listening { background: #f85149; color: #fff; animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0.5); }
    50% { box-shadow: 0 0 0 10px rgba(248,81,73,0); }
}

/* ═══ ATTACH BUTTON + MENU ═══ */
.attach-wrap { position: relative; }
.btn-attach {
    background: rgba(6,30,18,0.4);
    color: rgba(255,255,255,0.5);
    font-size: 1.4rem;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-attach.open { background: rgba(52,211,153,0.15); color: #fff; }
.attach-menu {
    display: none;
    position: absolute;
    bottom: 52px;
    left: 0;
    background: rgba(6,30,18,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
    padding: 6px;
    gap: 4px;
    min-width: 170px;
}
.attach-menu.show { display: flex; flex-direction: column; }
.attach-menu button {
    padding: 14px 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
}
.attach-menu button:hover,
.attach-menu button:active { background: rgba(52,211,153,0.1); }
.attach-menu .attach-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.attach-icon.cam-icon { background: rgba(63,185,80,0.15); }
.attach-icon.upload-icon { background: rgba(88,166,255,0.15); }

/* Chat photo preview strip */
.chat-photo-strip {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 4px;
}
.chat-photo-strip.show { display: flex; }
.chat-photo-strip img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(52,211,153,0.1);
}
.chat-photo-clear {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(6,30,18,0.5);
    border: 1px solid rgba(52,211,153,0.12);
    color: rgba(255,255,255,0.5);
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-photo-clear:hover { background: #f85149; color: #fff; border-color: #f85149; }

/* ═══ DATA TAB ═══ */
#dataTab { 
    background: transparent;
    position: relative;
}
#dataTab::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 300px 300px at 20% 30%, rgba(52,211,153,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 250px 250px at 75% 60%, rgba(56,189,248,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 200px 200px at 50% 10%, rgba(248,113,113,0.05) 0%, transparent 70%),
        radial-gradient(ellipse 300px 300px at 30% 80%, rgba(129,140,248,0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}
#dataTab .data-scroll {
    position: relative;
    z-index: 1;
}
.data-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    min-height: 0;
}
/* Center cards on desktop, mobile-first max width */
.data-scroll > * {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.data-scroll > .crop-strip,
.data-scroll > .cmd-header,
.data-scroll > .cmd-badges {
    max-width: 100%;
}
.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 2px;
}
.data-header-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}
.data-header-sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
}

.data-card {
    background: rgba(10,35,22,0.55);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(52,211,153,0.18);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.03) inset,
        0 1px 0 rgba(255,255,255,0.06) inset;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}
.data-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
    pointer-events: none;
    border-radius: 20px 20px 0 0;
}
.data-card:active { 
    border-color: #34d399; 
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 30px rgba(52,211,153,0.15);
    transform: scale(0.995);
}

/* ── Data Sub-Tabs (Pepper / Tomato) ── */
.data-subtabs {
    display: flex;
    gap: 0;
    padding: 0 4px;
    margin-bottom: 12px;
    background: rgba(6,20,12,0.6);
    border-radius: 12px;
    border: 1px solid rgba(52,211,153,0.1);
    overflow: hidden;
}
.data-subtab {
    flex: 1;
    padding: 10px 0;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 10px;
    margin: 3px;
}
.data-subtab.active {
    background: rgba(52,211,153,0.15);
    color: #34d399;
    box-shadow: 0 0 12px rgba(52,211,153,0.1);
}
.data-subtab:not(.active):active {
    background: rgba(52,211,153,0.08);
}

/* ── Proactive Advisory Banner ── */
.advisory-banner {
    background: linear-gradient(135deg, rgba(6,30,18,0.7), rgba(10,40,25,0.6));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(52,211,153,0.2);
    border-radius: 14px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}
.advisory-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, #34d399, transparent);
}
.advisory-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.advisory-toggle-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 6px;
}
.advisory-toggle-arrow {
    font-size: 0.7rem;
    color: rgba(52,211,153,0.5);
    transition: transform 0.3s;
}
.advisory-banner.open .advisory-toggle-arrow {
    transform: rotate(180deg);
}
.advisory-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}
.advisory-banner.open .advisory-content {
    max-height: 600px;
    padding: 0 16px 14px;
}
.advisory-headline {
    font-size: 0.85rem;
    font-weight: 700;
    color: #34d399;
    margin-bottom: 8px;
    line-height: 1.3;
}
.advisory-body {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}
.advisory-body strong {
    color: #34d399;
    font-weight: 600;
}
.advisory-section {
    margin-bottom: 6px;
}
.advisory-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(52,211,153,0.6);
    margin-bottom: 2px;
}
.advisory-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.advisory-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
}
.advisory-action.high {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
}
.advisory-action.medium {
    background: rgba(245,158,11,0.12);
    border: 1px solid rgba(245,158,11,0.25);
    color: #fbbf24;
}
.advisory-action.low {
    background: rgba(52,211,153,0.1);
    border: 1px solid rgba(52,211,153,0.2);
    color: #34d399;
}
.advisory-alert {
    margin-top: 8px;
    padding: 6px 10px;
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    font-size: 0.7rem;
    color: #f87171;
    font-weight: 600;
}

/* ══════ YIELD FORECAST OVERLAY ══════ */
.yield-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: rgba(2, 8, 4, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: yieldFadeIn 0.3s ease;
}
.yield-overlay.open { display: block; }
@keyframes yieldFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.yield-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}
.yield-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.yield-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.yield-header-logo {
    font-size: 0.7rem;
    font-weight: 700;
    color: #34d399;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.yield-header-title {
    font-size: 1.1rem;
    font-weight: 300;
    color: rgba(255,255,255,0.7);
}
.yield-close {
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.yield-close:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Main yield card */
.yield-main-card {
    background: rgba(10, 30, 18, 0.6);
    border: 1px solid rgba(52,211,153,0.15);
    border-radius: 18px;
    padding: 24px 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.yield-main-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(52,211,153,0.3), transparent);
}
.yield-main-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}
.yield-kg {
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    line-height: 1;
}
.yield-kg small {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255,255,255,0.4);
}
.yield-kg-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
}
.yield-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}
.yield-change.up { background: rgba(52,211,153,0.15); color: #34d399; }
.yield-change.down { background: rgba(239,68,68,0.15); color: #f87171; }
.yield-confidence {
    text-align: right;
}
.yield-conf-label { font-size: 0.6rem; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 1px; }
.yield-conf-val { font-size: 1.6rem; font-weight: 800; color: #34d399; }

/* Chart area */
.yield-chart-wrap {
    background: rgba(5,15,8,0.5);
    border: 1px solid rgba(52,211,153,0.08);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 16px;
    position: relative;
}
.yield-chart-wrap canvas { width: 100% !important; }
.yield-period-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    background: rgba(10,20,14,0.8);
    border-radius: 10px;
    border: 1px solid rgba(52,211,153,0.08);
    overflow: hidden;
}
.yield-period-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    cursor: pointer;
    transition: all 0.2s;
}
.yield-period-tab.active {
    background: rgba(52,211,153,0.15);
    color: #34d399;
}

/* Influencing factors */
.yield-factors {
    background: rgba(10,25,16,0.5);
    border: 1px solid rgba(52,211,153,0.1);
    border-radius: 14px;
    padding: 16px;
}
.yield-factors-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}
.yield-factor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(52,211,153,0.04);
}
.yield-factor-row:last-child { border-bottom: none; }
.yield-factor-name { font-size: 0.75rem; color: rgba(255,255,255,0.7); }
.yield-factor-val { font-size: 0.8rem; font-weight: 700; color: #fff; }
.yield-factor-impact {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}
.yield-factor-impact.pos { background: rgba(52,211,153,0.12); color: #34d399; }
.yield-factor-impact.neg { background: rgba(239,68,68,0.12); color: #f87171; }
.yield-factor-impact.neutral { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.4); }

/* Bottom grid cards */
.yield-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}
@media (min-width: 700px) {
    .yield-grid { grid-template-columns: repeat(4, 1fr); }
}
.yield-grid-card {
    background: rgba(10,25,16,0.5);
    border: 1px solid rgba(52,211,153,0.1);
    border-radius: 12px;
    padding: 14px;
}
.yield-grid-title {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.yield-grid-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
}
.yield-grid-sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    margin-top: 2px;
}
.yield-grid-mini { height: 30px; margin-top: 6px; }
.yield-grid-mini canvas { width: 100% !important; height: 100% !important; }

/* Data sources table */
.yield-sources {
    background: rgba(10,25,16,0.4);
    border: 1px solid rgba(52,211,153,0.08);
    border-radius: 14px;
    padding: 16px;
    margin-top: 16px;
}
.yield-src-row {
    display: flex;
    gap: 16px;
    padding: 5px 0;
    font-size: 0.7rem;
    border-bottom: 1px solid rgba(52,211,153,0.04);
}
.yield-src-row:last-child { border-bottom: none; }
.yield-src-name { color: rgba(255,255,255,0.5); min-width: 70px; }
.yield-src-type { color: rgba(255,255,255,0.35); min-width: 70px; }
.yield-src-val { color: #34d399; font-weight: 600; }

/* ── Crop Grid Layout ── */
.crop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
@media (min-width: 600px) {
    .crop-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1100px) {
    .crop-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.crop-grid .data-card {
    margin-bottom: 0;
}
.data-card::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        #f87171, #fb923c, #fbbf24, #34d399, #38bdf8, #818cf8, #c084fc, #f87171);
    background-size: 200% 100%;
    opacity: 1;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 0 20px rgba(52,211,153,0.3), 0 0 8px rgba(248,113,113,0.2), 0 0 8px rgba(56,189,248,0.2);
    animation: borderShimmer 4s ease-in-out infinite, rainbowSlide 6s linear infinite;
}
@keyframes rainbowSlide {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}
.data-card:active { 
    border-color: #34d399; 
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 20px rgba(52,211,153,0.1);
}
.data-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.data-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.data-card-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.data-card-badge.ok { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.25); }
.data-card-badge.warn { background: rgba(210,153,34,0.15); color: #d29922; }
.data-card-badge.crit { background: rgba(248,81,73,0.15); color: #f85149; }
.data-card-badge.off { background: rgba(139,148,158,0.1); color: rgba(255,255,255,0.3); }

/* Sensor rows with bars */
.data-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.data-row:last-child { margin-bottom: 0; }
.data-row-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255,255,255,0.3);
    width: 50px;
    flex-shrink: 0;
}
.data-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.data-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.data-bar-fill.ok { background: #3fb950; }
.data-bar-fill.warn { background: #d29922; }
.data-bar-fill.crit { background: #f85149; }
.data-row-val {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    width: 55px;
    text-align: right;
    flex-shrink: 0;
}
.data-row-val.ok { color: #3fb950; }
.data-row-val.warn { color: #d29922; }
.data-row-val.crit { color: #f85149; }

/* Priva weekly section inside card */
.data-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(52,211,153,0.15), transparent);
    margin: 10px 0;
}
.data-section-tag {
    font-size: 0.55rem;
    font-weight: 600;
    color: rgba(52,211,153,0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.data-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}
.data-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}
.data-stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
}
.data-stat-val {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
}
.data-stat-val.ok { color: #3fb950; }
.data-stat-val.warn { color: #d29922; }
.data-stat-val.crit { color: #f85149; }

/* ═══ HIDDEN: replaced by donut gauges ═══ */
.data-row { display: none !important; }

/* ═══ CROP CHART (full-size per card) ═══ */
.crop-card-chart {
    width: 100%;
    height: 180px;
    margin: 10px 0 14px;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}
.crop-card-chart canvas {
    width: 100% !important;
    height: 100% !important;
}
.crop-card-chart .chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.15);
    font-size: 0.7rem;
    letter-spacing: 1px;
}

/* ═══ DONUT GAUGE LAYOUT (large, neon) ═══ */
.gauge-row {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 8px 0 12px;
    gap: 4px;
    overflow: hidden;
    flex-wrap: wrap;
}
.gauge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 30%;
    min-width: 0;
}
.gauge-ring {
    position: relative;
    width: min(82px, 22vw);
    height: min(82px, 22vw);
}
.gauge-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
    filter: drop-shadow(0 0 8px var(--gauge-glow, rgba(52,211,153,0.35)));
    transition: filter 0.3s;
}
.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(0.75rem, 2.8vw, 1.1rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 16px rgba(0,0,0,0.7);
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.gauge-value small {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.6;
}
.gauge-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
}

/* ═══ SUGGESTION / WARNING PILLS ═══ */
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 0 2px;
}
.pill {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}
.pill:active { transform: scale(0.96); }
.pill.ok {
    background: rgba(52,211,153,0.1);
    color: #34d399;
    border: 1px solid rgba(52,211,153,0.25);
    box-shadow: 0 0 12px rgba(52,211,153,0.08);
}
.pill.warn {
    background: rgba(251,191,36,0.1);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.25);
    box-shadow: 0 0 12px rgba(251,191,36,0.08);
}
.pill.crit {
    background: rgba(248,113,113,0.1);
    color: #f87171;
    border: 1px solid rgba(248,113,113,0.25);
    box-shadow: 0 0 12px rgba(248,113,113,0.08);
}
.pill.info {
    background: rgba(56,189,248,0.08);
    color: #38bdf8;
    border: 1px solid rgba(56,189,248,0.2);
    box-shadow: 0 0 12px rgba(56,189,248,0.06);
}
.pill-detail {
    font-size: 0.58rem;
    color: rgba(255,255,255,0.4);
    padding: 2px 0 0;
    line-height: 1.4;
}

/* ═══ CARD ENTRANCE ANIMATION ═══ */
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.data-card {
    animation: cardSlideIn 0.35s ease both;
}
.data-card:nth-child(2) { animation-delay: 0.05s; }
.data-card:nth-child(3) { animation-delay: 0.1s; }
.data-card:nth-child(4) { animation-delay: 0.15s; }
.data-card:nth-child(5) { animation-delay: 0.2s; }
.data-card:nth-child(6) { animation-delay: 0.25s; }
.data-card:nth-child(7) { animation-delay: 0.3s; }
.data-card:nth-child(8) { animation-delay: 0.35s; }

@keyframes borderShimmer {
    0% { opacity: 0.5; }
    50% { opacity: 0.85; }
    100% { opacity: 0.5; }
}
.data-card::before {
    animation: borderShimmer 3s ease-in-out infinite;
}

.data-empty {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    padding: 40px 20px;
}

.sensor-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(248,113,113,0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(248,113,113,0.15);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.sensor-banner.ok {
    background: rgba(63,185,80,0.08);
    border-color: rgba(63,185,80,0.2);
}
.sensor-banner-text {
    font-size: 0.8rem;
    color: #f87171;
    font-weight: 600;
}
.sensor-banner.ok .sensor-banner-text {
    color: #34d399;
}
.sensor-banner-sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}
.sensor-retry-btn {
    background: rgba(52,211,153,0.1);
    border: 1px solid rgba(52,211,153,0.2);
    border-radius: 8px;
    padding: 6px 14px;
    color: rgba(255,255,255,0.75);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.sensor-retry-btn:active { background: rgba(255,255,255,0.15); }

/* Command Center Styles */
.cmd-header { text-align:center; padding:12px 8px 8px; border-bottom:1px solid rgba(52,211,153,0.1); margin-bottom:10px; }
.cmd-title { font-size:0.85rem; font-weight:800; background:linear-gradient(90deg,#34d399,#38bdf8,#818cf8); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; letter-spacing:2px; text-transform:uppercase; }
.cmd-badges { display:flex; justify-content:center; gap:10px; margin-top:8px; flex-wrap:wrap; }
.cmd-badge { font-size:0.65rem; font-weight:700; padding:4px 12px; border:1px solid; border-radius:12px; letter-spacing:0.5px; backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }

.crop-strip { display:flex; gap:6px; margin-bottom:10px; overflow-x:auto; padding:0 2px; -ms-overflow-style:none; scrollbar-width:none; }
.crop-strip::-webkit-scrollbar { display:none; }
.crop-strip-item { flex:0 0 auto; background:rgba(6,30,18,0.4); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); border:1px solid rgba(52,211,153,0.1); border-radius:10px; padding:5px 10px; display:flex; align-items:center; gap:5px; min-width:0; cursor:pointer; transition:background 0.2s,border-color 0.2s; }
.crop-strip-item:active { background:rgba(52,211,153,0.1); border-color:#34d399; }
.crop-strip-name { font-size:0.7rem; color:rgba(255,255,255,0.75); white-space:nowrap; }
.crop-strip-status { font-size:0.6rem; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }
.crop-strip-status.stable { color:#238636; }
.crop-strip-status.watch { color:#38bdf8; }
.crop-strip-status.warning { color:#d29922; }
.crop-strip-status.critical { color:#f85149; }

.risk-radar { display:flex; flex-direction:column; gap:4px; padding:4px 0; }
.risk-item { display:flex; align-items:center; gap:6px; }
.risk-label { font-size:0.65rem; color:rgba(255,255,255,0.5); width:62px; text-align:right; flex-shrink:0; }
.risk-bar { flex:1; height:6px; background:rgba(255,255,255,0.06); border-radius:3px; overflow:hidden; }
.risk-bar-fill { height:100%; border-radius:3px; transition:width 0.5s ease; }
.risk-bar-fill.ok { background:#238636; }
.risk-bar-fill.watch { background:#38bdf8; }
.risk-bar-fill.warn { background:#d29922; }
.risk-bar-fill.crit { background:#f85149; }
.stale-banner {
    font-size: 0.7rem; color: #d29922; background: rgba(210,153,34,0.08);
    border: 1px solid rgba(210,153,34,0.2); border-radius: 6px;
    padding: 4px 8px; margin: 4px 0; text-align: center;
}
.view-dtl-btn {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; margin-top: 6px; cursor: pointer;
    border-top: 1px solid rgba(255,255,255,0.06);
    -webkit-tap-highlight-color: transparent;
}
.view-dtl-btn span:first-child {
    font-size: 0.75rem; font-weight: 600; color: rgba(52,211,153,0.7);
    text-transform: uppercase; letter-spacing: 0.5px;
    pointer-events: none;
}
.dtl-arrow {
    font-size: 0.6rem; color: rgba(52,211,153,0.5);
    transition: transform 0.3s;
    pointer-events: none;
}
.dtl-wrap {
    max-height: 0; overflow: hidden;
    transition: max-height 0.4s ease;
}
.pred-row.warn-row span:first-child { color: #d29922; }
.pred-row.ok-row span:first-child { color: #238636; }
.pred-row.warn-row span:last-child { color: rgba(255,255,255,0.7); font-size: 0.75rem; }
.pred-row.ok-row span:last-child { color: rgba(255,255,255,0.4); font-size: 0.75rem; }
.pred-action {
    font-size: 0.75rem; color: rgba(255,255,255,0.7);
    padding: 2px 0 8px 22px;
}
.pred-ok-line {
    font-size: 0.72rem; color: rgba(52,211,153,0.6);
    padding: 6px 0 2px 0; border-top: 1px solid rgba(255,255,255,0.04);
    margin-top: 4px;
}
.yield-insight {
    font-size: 0.72rem; padding: 6px 0 2px 0; margin-top: 4px;
}
.yield-insight.ok { color: rgba(52,211,153,0.7); }
.yield-insight.warn { color: #d29922; }
.yield-insight.crit { color: #f85149; }

.risk-val { font-size:0.65rem; font-weight:600; width:24px; text-align:right; }
.risk-val.ok { color:#238636; }
.risk-val.watch { color:#38bdf8; }
.risk-val.warn { color:#d29922; }
.risk-val.crit { color:#f85149; }

.pred-panel { display:flex; flex-direction:column; gap:3px; padding:4px 0; }
.pred-row { display:flex; justify-content:space-between; font-size:0.7rem; color:rgba(255,255,255,0.5); padding:2px 0; }
.pred-row span:last-child { font-weight:600; color:rgba(255,255,255,0.75); }
.pred-row span.warn { color:#d29922; }
.pred-row span.ok { color:#238636; }
.pred-row.suggest { background:rgba(56,139,253,0.06); border-radius:4px; padding:3px 6px; }
.pred-row.suggest span:last-child { color:#34d399; }

.cmd-alerts { margin-top:6px; }
.cmd-alert { font-size:0.65rem; color:#d29922; background:rgba(210,153,34,0.08); border:1px solid rgba(210,153,34,0.2); border-radius:6px; padding:5px 8px; margin-bottom:4px; line-height:1.3; }

.dur-badges { display:flex; gap:5px; flex-wrap:wrap; padding:4px 0; }
.dur-badge { font-size:0.6rem; font-weight:600; padding:2px 7px; border-radius:8px; letter-spacing:0.3px; }
.dur-badge.warn { background:rgba(210,153,34,0.12); color:#d29922; border:1px solid rgba(210,153,34,0.25); }
.dur-badge.crit { background:rgba(248,81,73,0.12); color:#f85149; border:1px solid rgba(248,81,73,0.25); }

.mod-strip { display:flex; flex-direction:column; gap:2px; padding:3px 0; }
.mod-tag { font-size:0.6rem; color:rgba(255,255,255,0.5); line-height:1.3; }

.mom-row { font-size:0.65rem; padding:3px 0; color:rgba(255,255,255,0.5); }
.mom-row.warn { color:#d29922; }
.mom-row.ok { color:rgba(255,255,255,0.5); }

/* ═══ BENCHMARK GRID ═══ */
.bench-grid { display:flex; flex-direction:column; gap:3px; }
.bench-row { display:flex; align-items:center; gap:6px; font-size:0.7rem; }
.bench-label { width:36px; color:rgba(255,255,255,0.5); flex-shrink:0; font-weight:500; }
.bench-val { width:42px; text-align:right; font-weight:600; color:rgba(255,255,255,0.75); }
.bench-val.bench-hit { color:#3fb950; }
.bench-val.bench-miss { color:#d29922; }
.bench-range { flex:1; color:rgba(255,255,255,0.3); font-size:0.6rem; text-align:right; }

/* ═══ YIELD PROJECTION ═══ */
.yield-panel { display:flex; flex-direction:column; gap:5px; transition:border-color 0.2s,background 0.2s; position:relative; }
.yield-panel::after { content:'→'; position:absolute; right:12px; top:50%; transform:translateY(-50%); font-size:18px; color:rgba(52,211,153,0.5); font-weight:700; }
.yield-panel:hover { border-color:rgba(52,211,153,0.4) !important; background:rgba(52,211,153,0.05); }
.yield-panel:active { background:rgba(52,211,153,0.1); }
.yield-score { display:flex; align-items:center; gap:6px; }
.yield-score-label { font-size:0.65rem; color:rgba(255,255,255,0.5); width:60px; flex-shrink:0; }
.yield-gauge { flex:1; height:6px; background:rgba(255,255,255,0.08); border-radius:3px; overflow:hidden; }
.yield-gauge-fill { height:100%; border-radius:3px; transition:width 0.4s ease; }
.yield-gauge-fill.ok { background:linear-gradient(90deg,#238636,#3fb950); }
.yield-gauge-fill.warn { background:linear-gradient(90deg,#9e6a03,#d29922); }
.yield-gauge-fill.crit { background:linear-gradient(90deg,#da3633,#f85149); }
.yield-score-val { width:28px; text-align:right; font-size:0.7rem; font-weight:700; }
.yield-score-val.ok { color:#3fb950; }
.yield-score-val.warn { color:#d29922; }
.yield-score-val.crit { color:#f85149; }

.yield-tiers { display:flex; gap:4px; justify-content:space-between; }
.yield-tier { flex:1; text-align:center; padding:4px 2px; border-radius:6px; background:rgba(52,211,153,0.04); border:1px solid transparent; }
.yield-tier.active { border-color:#34d399; background:rgba(52,211,153,0.1); }
.yield-tier-val { display:block; font-size:0.75rem; font-weight:700; color:rgba(255,255,255,0.75); }
.yield-tier-lbl { display:block; font-size:0.5rem; color:rgba(255,255,255,0.5); margin-top:1px; }
.yield-tier.active .yield-tier-val { color:#34d399; }

.yield-proj { display:flex; justify-content:space-between; font-size:0.7rem; color:rgba(255,255,255,0.5); }
.yield-proj.sub { font-size:0.6rem; }
.yield-proj-val { font-weight:700; color:rgba(255,255,255,0.75); }

.yield-missing { font-size:0.55rem; color:rgba(255,255,255,0.3); padding:3px 0; font-style:italic; }


/* ═══ FLOATING MUTE ═══ */
.float-mute {
    position: absolute;
    bottom: 80px;
    right: 12px;
    z-index: 25;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.float-mute.muted { background: rgba(248,81,73,0.3); border-color: rgba(248,81,73,0.4); }

input[type="file"] { display: none; }

/* LIVE TAB */
#liveTab {
    position: relative;
    background: #000;
}
#liveTab video {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#liveTab .cam-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 20;
}

.cam-response {
    padding: 10px;
    pointer-events: auto;
}

.cam-bubble {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 160px;
    overflow-y: auto;
    display: none;
    color: rgba(255,255,255,0.92);
}
.cam-bubble.show { display: block; }

/* Zoom inset for focus area */
.zoom-inset {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 150px;
    height: 150px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    display: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.zoom-inset.show { 
    display: block; 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1);
}
.zoom-inset canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Live mic button - centered hero circle */
.live-mic-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.live-mic-btn:hover { background: rgba(255,255,255,0.2); }
.live-mic-btn.listening {
    background: rgba(248,81,73,0.3);
    border-color: #f85149;
    animation: pulse-mic 1.5s ease infinite;
}
.live-mic-btn.analyzing {
    background: rgba(52,211,153,0.2);
    border-color: #34d399;
}
@keyframes pulse-mic {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0.4); }
    50% { box-shadow: 0 0 0 16px rgba(248,81,73,0); }
}

.live-mic-label {
    color: rgba(255,255,255,0.5);
    font-size: 0.65rem;
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

/* Audio waveform indicator */
.audio-indicator {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
}
.audio-indicator.playing { display: flex; }
.audio-indicator span {
    display: block;
    width: 2px;
    height: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 1px;
    animation: waveBar 0.8s ease-in-out infinite;
}
.audio-indicator span:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.audio-indicator span:nth-child(3) { animation-delay: 0.2s; height: 7px; }
.audio-indicator span:nth-child(4) { animation-delay: 0.3s; height: 13px; }
@keyframes waveBar {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

.cam-controls {
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.3), transparent);
    pointer-events: auto;
}

.cam-input-row { display: flex; gap: 6px; align-items: center; }

.cam-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
}
.cam-input::placeholder { color: rgba(255,255,255,0.4); }
.cam-input:focus { outline: none; border-color: rgba(255,255,255,0.35); }

/* PTZ D-pad controls */
.ptz-controls {
    position: absolute;
    bottom: 180px;
    right: 12px;
    z-index: 25;
    pointer-events: auto;
    display: none;
}
.ptz-controls.show { display: block; }

.ptz-dpad {
    display: grid;
    grid-template-columns: 40px 40px 40px;
    grid-template-rows: 40px 40px 40px;
    gap: 2px;
}
.ptz-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.ptz-btn:active { background: rgba(88,166,255,0.4); }
.ptz-btn.ptz-center { font-size: 0.7rem; }
.ptz-btn.ptz-empty { visibility: hidden; }

.ptz-zoom-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}
.ptz-zoom-btn {
    width: 52px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.ptz-zoom-btn:active { background: rgba(88,166,255,0.4); }

.ptz-action-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}
.ptz-action-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.65rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.3px;
}
.ptz-action-btn:active { background: rgba(88,166,255,0.4); }
.ptz-action-btn.patrol-active {
    background: rgba(35,134,54,0.4);
    border-color: #3fb950;
    animation: pulse-patrol 2s ease infinite;
}
@keyframes pulse-patrol {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(63,185,80,0); }
}

/* PTZ toggle button */
.ptz-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 25;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}
.ptz-toggle.show { display: flex; }
.ptz-toggle.active { background: rgba(52,211,153,0.2); border-color: #34d399; }

/* ═══ CAMERA TAB STYLES ═══ */
#camTab {
    display: none;
    flex-direction: column;
    background: #06120a;
    overflow: hidden;
}
#camTab.active { display: flex; }

.cam-tab-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.cam-feed-area {
    position: relative;
    flex: 0 0 auto;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cam-feed-container {
    position: relative;
    width: 100%;
    max-height: 45vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6,30,18,0.6);
}

.cam-feed-img {
    width: 100%;
    height: auto;
    max-height: 45vh;
    object-fit: contain;
    display: block;
}

.cam-feed-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    pointer-events: none;
}
.cam-feed-overlay.hidden { display: none; }

.cam-feed-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: #34d399;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

.cam-ptz-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: rgba(6,30,18,0.6);
    border-top: 1px solid rgba(52,211,153,0.1);
    width: 100%;
    justify-content: center;
}

.cam-ptz-dpad {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cptz-row {
    display: flex;
    gap: 2px;
    justify-content: center;
}
.cptz-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(52,211,153,0.12);
    background: rgba(6,30,18,0.4);
    color: rgba(255,255,255,0.75);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
}
.cptz-btn:active { background: #1f6feb; color: #fff; }
.cptz-home { font-size: 1.1rem; }
.cptz-spacer { width: 44px; height: 44px; }

.cam-ptz-extras {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cptz-zoom {
    width: 56px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(52,211,153,0.12);
    background: rgba(6,30,18,0.4);
    color: rgba(255,255,255,0.75);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cptz-zoom:active { background: #1f6feb; color: #fff; }
.cptz-action {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(52,211,153,0.12);
    background: rgba(6,30,18,0.4);
    color: rgba(255,255,255,0.75);
    font-size: 0.7rem;
    cursor: pointer;
    text-align: center;
}
.cptz-action:active { background: #1f6feb; color: #fff; }
.cptz-action.active { background: #238636; border-color: #3fb950; color: #fff; }

/* Patrol History Gallery */
.cam-history-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: 1px solid rgba(52,211,153,0.08);
}
.cam-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    background: rgba(6,30,18,0.5);
    border-bottom: 1px solid rgba(52,211,153,0.1);
}
.cam-history-refresh {
    background: rgba(6,30,18,0.4);
    border: 1px solid rgba(52,211,153,0.12);
    color: rgba(255,255,255,0.5);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.85rem;
    cursor: pointer;
}
.cam-history-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}
.cam-history-empty {
    text-align: center;
    color: rgba(255,255,255,0.3);
    padding: 20px;
    font-size: 0.8rem;
}

.patrol-date-group {
    margin-bottom: 12px;
}
.patrol-date-label {
    font-size: 0.7rem;
    color: #34d399;
    padding: 4px 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.patrol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
}
.patrol-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(52,211,153,0.1);
    cursor: pointer;
    aspect-ratio: 4/3;
}
.patrol-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.patrol-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 12px 4px 3px;
    font-size: 0.55rem;
    color: #fff;
    line-height: 1.3;
}
.patrol-thumb-health {
    position: absolute;
    top: 3px;
    right: 3px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
}
.health-good { background: rgba(35,134,54,0.8); color: #fff; }
.health-warn { background: rgba(210,153,34,0.8); color: #fff; }
.health-bad { background: rgba(248,81,73,0.8); color: #fff; }

/* ═══ PEST HEATMAP STYLES ═══ */
.heatmap-section {
    padding: 12px;
    margin-top: 4px;
}
.heatmap-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    padding: 8px 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.heatmap-subtitle {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    font-weight: 400;
}
.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
.floor-plan {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 14px;
    background: rgba(6,18,10,0.4);
    border: 1px solid rgba(52,211,153,0.1);
    border-radius: 12px;
    margin-bottom: 12px;
}
@media (max-width: 600px) {
    .floor-plan { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
    .floor-zone { padding: 10px 6px; min-height: 80px; }
    .floor-zone .fz-num { font-size: 0.9rem; }
    .floor-zone .fz-crop { font-size: 0.7rem; }
    .floor-zone .fz-status { font-size: 0.65rem; }
    .floor-zone .fz-issues { font-size: 0.6rem; white-space: normal; }
    .floor-zone .fz-count { font-size: 0.65rem; }
    .pest-info-dropdown { font-size: 12px !important; padding: 14px !important; line-height: 1.8 !important; }
}
.floor-zone {
    padding: 12px 8px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(52,211,153,0.08);
    position: relative;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
}
.floor-zone:hover { transform: scale(1.03); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.floor-zone .fz-num { font-weight: 700; font-size: 0.85rem; color: #fff; }
.floor-zone .fz-crop { color: rgba(255,255,255,0.5); font-size: 0.65rem; }
.floor-zone .fz-status { font-size: 0.6rem; font-weight: 600; margin-top: 2px; padding: 1px 6px; border-radius: 4px; }
.floor-zone.fz-clean .fz-status { color: #3fb950; }
.floor-zone.fz-low .fz-status { color: #34d399; }
.floor-zone.fz-medium .fz-status { color: #d29922; background: rgba(210,153,34,0.1); }
.floor-zone.fz-high .fz-status { color: #f85149; background: rgba(248,81,73,0.1); }
.floor-zone .fz-issues { font-size: 0.55rem; color: rgba(255,255,255,0.4); margin-top: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-zone .fz-count { position: absolute; top: 3px; right: 5px; font-size: 0.6rem; font-weight: 700; }
.floor-zone.fz-clean { background: rgba(63,185,80,0.1); border-color: rgba(63,185,80,0.2); }
.floor-zone.fz-clean .fz-count { color: #3fb950; }
.floor-zone.fz-low { background: rgba(52,211,153,0.1); border-color: rgba(52,211,153,0.3); }
.floor-zone.fz-low .fz-count { color: #34d399; }
.floor-zone.fz-medium { background: rgba(210,153,34,0.12); border-color: rgba(210,153,34,0.3); }
.floor-zone.fz-medium .fz-count { color: #d29922; }
.floor-zone.fz-high { background: rgba(248,81,73,0.12); border-color: rgba(248,81,73,0.3); animation: fz-pulse 2s infinite; }
.floor-zone.fz-high .fz-count { color: #f85149; }
@keyframes fz-pulse { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 12px rgba(248,81,73,0.3); } }
.heatmap-card {
    border-radius: 10px;
    padding: 10px 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(52,211,153,0.08);
}
.heatmap-card.sev-none { background: linear-gradient(135deg, rgba(6,18,10,0.6), rgba(6,30,18,0.4)); border-color: rgba(52,211,153,0.1); }
.heatmap-card.sev-low { background: linear-gradient(135deg, rgba(6,18,10,0.6), rgba(26,42,26,0.5)); border-color: rgba(52,211,153,0.3); }
.heatmap-card.sev-medium { background: linear-gradient(135deg, #1a1500, #2d2200); border-color: #d29922; }
.heatmap-card.sev-high { background: linear-gradient(135deg, #1a0a0a, #2d1515); border-color: #f85149; }

.heatmap-zone-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}
.heatmap-health-bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.06);
    margin: 6px 0;
    overflow: hidden;
}
.heatmap-health-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.heatmap-health-fill.green { background: #3fb950; }
.heatmap-health-fill.yellow { background: #d29922; }
.heatmap-health-fill.red { background: #f85149; }

.heatmap-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}
.heatmap-stat-val { color: #fff; font-weight: 600; }

.heatmap-issues {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.heatmap-issue-tag {
    font-size: 0.55rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}
.heatmap-issue-tag.high { background: rgba(248,81,73,0.15); color: #f85149; }
.heatmap-issue-tag.medium { background: rgba(210,153,34,0.15); color: #d29922; }

.heatmap-trend {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.7rem;
}
.heatmap-trend.increasing { color: #f85149; }
.heatmap-trend.decreasing { color: #3fb950; }
.heatmap-trend.stable { color: rgba(255,255,255,0.3); }

.heatmap-empty {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
    background: rgba(6,30,18,0.3);
    border-radius: 10px;
    border: 1px dashed rgba(52,211,153,0.15);
}

/* ═══ CROP GRAPH OVERLAY ═══ */
.data-card { cursor: pointer; transition: border-color 0.15s; }
.data-card:active { border-color: #34d399; }

.graph-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4,13,8,0.92);
    backdrop-filter: blur(40px) saturate(1.3);
    -webkit-backdrop-filter: blur(40px) saturate(1.3);
    z-index: 200;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}
.graph-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 400px 400px at 30% 20%, rgba(52,211,153,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 300px 300px at 70% 70%, rgba(56,189,248,0.04) 0%, transparent 70%);
    pointer-events: none;
}
.graph-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 10px;
    border-bottom: 1px solid rgba(52,211,153,0.1);
    position: relative;
    z-index: 1;
}
.graph-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}
.graph-close {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.2);
    color: rgba(248,113,113,0.8);
    border-radius: 10px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.graph-close:active { background: rgba(248,113,113,0.2); }
.graph-toggles {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.graph-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(10,35,22,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.7);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s, background 0.2s;
}
.graph-toggle:active { background: rgba(52,211,153,0.08); }
.graph-toggle.active { border-color: var(--toggle-color, #34d399); box-shadow: 0 0 12px rgba(52,211,153,0.08); }
.graph-toggle .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.graph-toggle.inactive { opacity: 0.35; }

.graph-canvas-wrap {
    flex: 1;
    padding: 8px 16px;
    min-height: 0;
    position: relative;
    z-index: 1;
}
.graph-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}
.graph-loading {
    text-align: center;
    padding: 40px;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
}
.graph-date-nav {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 20px 12px;
    position: relative;
    z-index: 1;
}
.graph-date-btn {
    background: rgba(10,35,22,0.5);
    border: 1px solid rgba(52,211,153,0.12);
    color: rgba(255,255,255,0.65);
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.15s;
}
.graph-date-btn:active { border-color: var(--emerald, #34d399); }
.graph-date-label {
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Pest Heatmap */
.pest-heatmap-area {
    padding: 8px;
}
.pest-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.pest-zone-card {
    background: rgba(6,30,18,0.4);
    border: 1px solid rgba(52,211,153,0.1);
    border-radius: 10px;
    padding: 10px;
    position: relative;
    overflow: hidden;
}
.pest-zone-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.pest-zone-card.sev-none::before { background: #238636; }
.pest-zone-card.sev-low::before { background: #d29922; }
.pest-zone-card.sev-medium::before { background: #db6d28; }
.pest-zone-card.sev-high::before { background: #f85149; }

.pest-zone-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    margin-bottom: 4px;
}
.pest-zone-count {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.pest-zone-count.sev-none { color: #3fb950; }
.pest-zone-count.sev-low { color: #d29922; }
.pest-zone-count.sev-medium { color: #db6d28; }
.pest-zone-count.sev-high { color: #f85149; }

.pest-zone-label {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    margin-top: 2px;
}
.pest-zone-issues {
    margin-top: 6px;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
}
.pest-zone-trend {
    font-size: 0.6rem;
    margin-top: 4px;
}
.trend-increasing { color: #f85149; }
.trend-stable { color: rgba(255,255,255,0.5); }
.trend-decreasing { color: #3fb950; }

.pest-empty {
    text-align: center;
    padding: 16px;
    color: #3fb950;
    font-size: 0.8rem;
}

.btn-mute {
    padding: 6px 10px;
    background: rgba(6,30,18,0.4);
    border: 1px solid rgba(52,211,153,0.12);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    cursor: pointer;
}
.btn-mute.muted { background: #f85149; color: #fff; border-color: #f85149; }

/* Voice Mode Overlay */
.voice-overlay { display:none; position:absolute; top:0; left:0; right:0; bottom:0; background:rgba(13,17,23,0.95);
    flex-direction:column; align-items:center; justify-content:center; z-index:50; gap:20px; }
.voice-overlay.active { display:flex; }
.voice-orb-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; }
.voice-orb { position:relative; width:120px; height:120px; display:flex; align-items:center; justify-content:center; }
.voice-orb-core { width:60px; height:60px; border-radius:50%; background:radial-gradient(circle, #34d399 0%, #059669 100%); }
.voice-orb-ring { position:absolute; top:0; left:0; width:100%; height:100%; border-radius:50%;
    border:2px solid rgba(88,166,255,0.3); animation:voicePulse 2s ease-in-out infinite; }
.voice-orb-ring.r2 { animation-delay:0.5s; border-color:rgba(52,211,153,0.15); }
.voice-overlay.speaking .voice-orb-core { background:radial-gradient(circle, #3fb950 0%, #238636 100%); }
.voice-overlay.speaking .voice-orb-ring { border-color:rgba(63,185,80,0.4); animation:voiceSpeak 0.6s ease-in-out infinite; }
.voice-overlay.speaking .voice-orb-ring.r2 { border-color:rgba(63,185,80,0.2); }
@keyframes voicePulse { 0%,100%{transform:scale(1);opacity:0.6} 50%{transform:scale(1.15);opacity:1} }
@keyframes voiceSpeak { 0%,100%{transform:scale(1);opacity:0.8} 50%{transform:scale(1.25);opacity:1} }
.voice-label { font-size:0.85rem; color:rgba(255,255,255,0.5); letter-spacing:0.5px; }
.voice-transcript { font-size:0.8rem; color:rgba(255,255,255,0.75); max-width:280px; text-align:center; min-height:20px; }
.voice-end-btn { background:rgba(248,81,73,0.15); color:#f85149; border:1px solid rgba(248,81,73,0.3);
    border-radius:24px; padding:10px 28px; font-size:0.85rem; cursor:pointer; }
.voice-end-btn:active { background:rgba(248,81,73,0.3); }

.msg-tts-btn { position:absolute; top:4px; right:4px; background:none; border:none; 
    font-size:0.7rem; cursor:pointer; opacity:0.3; padding:2px 4px; border-radius:4px; }
.msg-tts-btn:hover { opacity:0.8; background:rgba(88,166,255,0.1); }

/* Live tab speaking state */
.live-bottom-bar {
    display: flex; justify-content: center; align-items: center; gap: 16px;
    padding: 16px; position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7) 40%);
    z-index: 30;
}
.live-btn {
    width: 56px; height: 56px; border-radius: 50%;
    border: none; font-size: 1.4rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.live-btn-default { background: rgba(255,255,255,0.15); color: #fff; backdrop-filter: blur(8px); }
.live-btn-default:hover { background: rgba(255,255,255,0.25); }
.live-btn-default.off { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); }
.live-btn-mic { background: rgba(52,211,153,0.3); color: #34d399; border: 2px solid rgba(52,211,153,0.4); width: 68px; height: 68px; font-size: 1.6rem; }
.live-btn-mic.listening { background: rgba(52,211,153,0.5); animation: pulse-mic 1.5s infinite; }
.live-btn-end { background: rgba(248,81,73,0.4); color: #fff; }
.live-btn-end:hover { background: rgba(248,81,73,0.6); }
@keyframes pulse-mic { 0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.4); } 50% { box-shadow: 0 0 0 12px rgba(52,211,153,0); } }
.cc-overlay {
    display: none; position: absolute; bottom: 100px; left: 16px; right: 16px;
    max-height: 200px; overflow-y: auto; z-index: 35;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px; padding: 14px 18px;
    font-size: 0.9rem; line-height: 1.6;
    color: #fff;
}
.cc-overlay.show { display: block; }
#liveCCBtn.active { background: #2be800 !important; color: #000 !important; box-shadow: 0 0 12px rgba(43,232,0,0.4); }
#liveCCBtn.active { background: #2be800; color: #000; box-shadow: 0 0 12px rgba(43,232,0,0.4); }
.cc-line { margin-bottom: 4px; }
.cc-line .cc-role { font-weight: 700; color: #34d399; }
.cc-line .cc-role.user { color: #6ee7b7; }
.cc-line .cc-text { color: rgba(255,255,255,0.9); }
.live-voiceonly {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%; background: radial-gradient(ellipse at center, rgba(52,211,153,0.08) 0%, rgba(0,0,0,0.95) 70%);
}
.live-voiceonly .vo-orb {
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(52,211,153,0.2), rgba(52,211,153,0.05));
    border: 1px solid rgba(52,211,153,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
}
.live-voiceonly.speaking .vo-orb { animation: pulse-orb 1.5s ease-in-out infinite; border-color: rgba(52,211,153,0.5); box-shadow: 0 0 40px rgba(52,211,153,0.3); }
@keyframes pulse-orb { 0%,100% { transform: scale(1); box-shadow: 0 0 20px rgba(52,211,153,0.2); } 50% { transform: scale(1.08); box-shadow: 0 0 50px rgba(52,211,153,0.4); } }
#liveTab .live-speaking-overlay { display:none; position:absolute; top:0; left:0; right:0; bottom:0;
    background:rgba(0,0,0,0.4); z-index:5; pointer-events:none; transition:opacity 0.3s; }
#liveTab.ai-speaking .live-speaking-overlay { display:block; }
#liveTab .live-ai-label { display:none; position:absolute; bottom:80px; left:50%; transform:translateX(-50%);
    background:rgba(35,134,54,0.9); color:#fff; padding:6px 16px; border-radius:20px;
    font-size:0.75rem; z-index:6; letter-spacing:0.5px; }
#liveTab.ai-speaking .live-ai-label { display:block; }

/* ═══ STALENESS STATES (juno-fresh / juno-stale / juno-na) ═══ */
/* juno-fresh: no override — normal rendering */

/* ── STALE: yellow tint, full data shown ── */
.data-card.juno-stale {
  position: relative;
}
.data-card.juno-stale::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(210, 153, 34, 0.06), transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}
.card-stale-flag {
  display: inline-block;
  font-size: 0.6rem;
  background: rgba(210, 153, 34, 0.18);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.4);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 500;
}

/* ── N/A: surgical desaturation, vivid offline banner ── */
/* No filter on the card itself — apply per-child so banner stays vivid */
.data-card.juno-na .data-card-name,
.data-card.juno-na .gauge-row,
.data-card.juno-na .crop-card-chart,
.data-card.juno-na .data-card-badge {
  filter: grayscale(0.85);
  opacity: 0.55;
}

/* Replace gauge values with '--' for N/A cards */
.data-card.juno-na .gauge-value {
  font-size: 0 !important;          /* hide the numeric content */
  color: rgba(255, 255, 255, 0.45) !important;
}
.data-card.juno-na .gauge-value::before {
  content: "--";
  font-size: 1.6rem;                /* match original gauge value size */
  font-weight: 600;
}
.data-card.juno-na .gauge-value small {
  display: none;                    /* hide the unit suffix (%/°C) */
}

/* ── Loud N/A banner ── */
.card-offline-banner {
  background: linear-gradient(90deg, #f85149, #da3633);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 6px 10px;
  margin: -1px -1px 8px -1px;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 0 12px rgba(248, 81, 73, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  /* No filter applied — this stays vivid red */
}
