/* Local vendor fonts - works offline */
@import url('../vendor/google-fonts.css');
@import url('../vendor/bootstrap-icons.css');

/*
 * OOZNEST MACHINE CONTROL THEME v9.0
 * This file is now the SOLE authority for all component styling.
 * @layer components removed from index.html — Tailwind CDN provides utilities only.
 * No !important wars. Clean cascade.
 *
 * Card design: oz-showcase-sidebar from OOZNEST-CSS/ooznest-ui.css
 *   - Full colored background per section
 *   - Single large corner (96px) alternating per card
 *   - CSS callout pointer arrows (right + bottom)
 */

/* ================================================================
   BRAND TOKENS — 1:1 with OOZNEST-CSS/ooznest-ui.css
   ================================================================ */
:root {
    /* Primary orange */
    --oz-primary: #FF6600;
    --oz-primary-light: #FF8533;
    --oz-primary-dark: #D55700;

    /* Teal */
    --oz-teal-brand: #004C5B;
    --oz-teal-mid: #449D9F;
    --oz-teal-light: #B0CACF;
    --oz-teal-xlight: #EBEFEF;

    /* Neutrals */
    --oz-black: #0D1F22;
    --oz-grey-dark: #2F373C;
    --oz-grey-mid: #909090;
    --oz-grey-light: #EBEFEF;
    --oz-white: #FFFFFF;
    --oz-bg-panel: #F7F9F9;

    /* Gradients */
    --oz-grad-teal: radial-gradient(78.83% 124.97% at 96% 82.92%, #004C5B 0%, #449D9F 100%);
    --oz-grad-orange: radial-gradient(78.83% 124.97% at 96% 82.92%, #FFB482 0%, #FF6600 100%);

    /* Shadows */
    --oz-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --oz-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --oz-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Radius — from ooznest-ui.css but scaled down for the app */
    --oz-r-xl: 30px;
    --oz-r-md: 16px;
    --oz-r-sm: 10px;
    --oz-r-xs: 6px;

    /* Status */
    --oz-success: #027A48;
    --oz-error: #B41B13;
    --oz-warning: #FFB300;

    /* Axis colours */
    --axis-x: #e11d48;
    --axis-y: #16a34a;
    --axis-z: #2563eb;
    --axis-a: #ea580c;

    /* ── Tailwind token aliases so bg-primary etc still resolve ── */
    --color-primary: var(--oz-teal-mid);
    --color-primary-light: #6DBCBE;
    --color-primary-dark: var(--oz-teal-brand);
    --color-secondary: var(--oz-primary);
    --color-secondary-light: var(--oz-primary-light);
    --color-secondary-dark: var(--oz-primary-dark);
    --color-grey-dark: var(--oz-grey-dark);
    --color-grey: var(--oz-grey-mid);
    --color-grey-light: var(--oz-teal-xlight);
    --color-bg: var(--oz-bg-panel);
    --color-surface: var(--oz-white);
    --color-axis-x: var(--axis-x);
    --color-axis-y: var(--axis-y);
    --color-axis-z: var(--axis-z);
    --color-axis-a: var(--axis-a);
}

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

body {
    font-family: 'Roboto', 'Inter', sans-serif;
    color: var(--oz-grey-dark);
    background: #EBEFEF;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Nunito', 'Inter', sans-serif;
    font-weight: 700;
}

button,
.btn,
.tab-btn,
.dro-zero-btn,
.dro-sub-btn,
.jog-btn,
.jog-btn-extra,
.btn-secondary,
.btn-ovr,
.btn-primary,
.btn-danger,
.btn-ghost,
select {
    font-family: 'Nunito', 'Inter', sans-serif;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--oz-teal-light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--oz-teal-mid);
}

/* ================================================================
   APP SHELL
   ================================================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: #EBEFEF;
    color: var(--oz-grey-dark);
    font-family: 'Roboto', 'Inter', sans-serif;
    position: relative;
}

@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    backdrop-filter: blur(4px);
}

@media (max-width: 767px) {
    .sidebar-overlay {
        display: block;
    }
}

/* ================================================================
   ELECTRON TITLE BAR
   ================================================================ */
#electron-title-bar {
    background: var(--oz-teal-brand);
    border-bottom: 1px solid rgba(68, 157, 159, 0.3);
    z-index: 10000;
}

#electron-title-bar span {
    color: var(--oz-teal-mid);
    font-family: 'Roboto', sans-serif;
    letter-spacing: 2px;
    font-size: 9px;
}

/* ================================================================
   NAV / TAB BAR — White header like oz-header
   ================================================================ */
/* The very first div inside main is the nav bar */
.app-container>main>div:first-child,
.app-container>div:not(.machine-sidebar)>div:first-child {
    background: var(--oz-white);
    border-bottom: 2px solid var(--oz-teal-xlight);
    box-shadow: 0 2px 12px rgba(0, 76, 91, 0.07);
    display: flex;
    align-items: center;
    height: 52px;
    flex-shrink: 0;
    overflow: hidden;
}

#app-logo {
    filter: none;
    opacity: 1;
}

/* Hamburger button */
#sidebar-toggle {
    color: var(--oz-teal-brand);
    background: transparent;
    border: none;
    border-radius: var(--oz-r-xs);
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

#sidebar-toggle:hover {
    color: var(--oz-primary);
    background: var(--oz-teal-xlight);
}

/* Scroll arrows on tab bar */
#tabs-scroll-container {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: transparent;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
}

#tabs-scroll-container::-webkit-scrollbar {
    display: none;
}

/* ================================================================
   TABS
   ================================================================ */
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--oz-r-xs);
    border: 1.5px solid transparent;
    background: transparent;
    color: var(--oz-grey-mid);
    font-family: 'Nunito', 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.tab-btn:hover {
    color: var(--oz-teal-brand);
    background: var(--oz-teal-xlight);
    border-color: var(--oz-teal-xlight);
}

.tab-btn.active {
    background: var(--oz-primary);
    color: white;
    border-color: var(--oz-primary);
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.28);
}

.tab-badge {
    background: var(--oz-primary);
    color: white;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
}

/* ================================================================
   MACHINE SIDEBAR
   ================================================================ */
.machine-sidebar {
    width: 100%;
    flex-shrink: 0;
    background: var(--oz-grey-light);
    border-right: 1px solid var(--oz-teal-xlight);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed;
    inset-block: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 300ms ease-in-out;
    box-shadow: 6px 0 20px rgba(0, 0, 0, 0.22);
}

.machine-sidebar.open {
    transform: translateX(0);
}

@media (min-width: 768px) {
    .machine-sidebar {
        position: relative;
        transform: translateX(0);
        width: 320px;
    }
}

@media (min-width: 1024px) {
    .machine-sidebar {
        width: 370px;
    }
}

/* Mobile header strip */
@media (max-width: 767px) {
    .machine-sidebar>div.md\:hidden {
        background: var(--oz-teal-brand);
        color: white;
        padding: 10px 14px;
        font-weight: 700;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }
}

@media (min-width: 768px) {
    .machine-sidebar>div.md\:hidden {
        display: none !important;
    }
}

/* Machine controls scrollable area.
   flex: 0 1 auto = don't grow beyond content, but CAN shrink.
   min-height: 0 is required to allow a flex item to shrink below
   its content size — without it, the item won't scroll, it'll just overflow. */
#machine-controls {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 30px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--oz-teal-light) transparent;
}

/* ────────────────────────────────────────────────────────────────
   SIDEBAR CARD 1 — CONNECTION
   oz-showcase-sidebar--teal style
   Full #449D9F background, 96px top-left corner, right callout arrow
   ──────────────────────────────────────────────────────────────── */
#sidebar-connect {
    border-radius: 0;
    background: transparent;
    border: none;
    padding: 2px 0;
    box-shadow: none;
    position: relative;
    overflow: visible;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    #sidebar-connect {
        border-radius: var(--oz-r-xl) 0 0 0;
        background: var(--oz-teal-xlight);
        padding: 2px;
        gap: 6px;
        box-shadow: var(--oz-shadow-md);
    }
}

/* Right-pointing callout arrow */
#sidebar-connect::after {
    content: '';
    position: absolute;
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-left: 24px solid var(--oz-teal-xlight);
    z-index: 10;
    display: none;
}

@media (min-width: 768px) {
    #sidebar-connect::after {
        display: block;
    }
}

/* Connect button: white on teal, orange on hover (oz-btn--white) */
#btn-connect {
    flex: 1;
    height: 36px;
    background: var(--oz-primary);
    color: white;
    border: none;
    border-radius: var(--oz-r-xs);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

#btn-connect:hover {
    background: var(--oz-primary-light);
    transform: translateY(-1px);
}

/* Reset button: transparent on teal -> Updated to Solid White for Contrast */
#btn-reset {
    flex: 1;
    height: 36px;
    background: white;
    color: var(--oz-teal-brand);
    border: 1px solid var(--oz-teal-xlight);
    border-radius: var(--oz-r-xs);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#btn-reset:hover {
    background: var(--oz-teal-xlight);
    transform: translateY(-1px);
}

#btn-reset:disabled {
    opacity: 0.5;
    pointer-events: none;
    box-shadow: none;
}

/* ────────────────────────────────────────────────────────────────
   SIDEBAR CARD 2 — DRO PANEL
   Orange card, 96px top-left, right callout arrow
   ──────────────────────────────────────────────────────────────── */
.dro-panel {
    background: var(--oz-teal-mid);
    border-radius: var(--oz-r-xl) 0 0 0;
    border: none;
    box-shadow: var(--oz-shadow-md);
    padding: 8px;
    position: relative;
    overflow: visible;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .dro-panel {
        padding: 10px;
    }
}

/* Right-pointing callout arrow */
.dro-panel::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 22px;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 22px solid var(--oz-teal-mid);
    z-index: 10;
    display: none;
}

@media (min-width: 768px) {
    .dro-panel::after {
        display: block;
    }
}

/* Units & WCS row (Inside Orange) */
.dro-panel .cursor-pointer,
.dro-panel select.text-xs {
    background: white !important;
    border: none !important;
    border-radius: 4px;
    color: var(--oz-teal-brand) !important;
    font-weight: 800;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dro-panel .text-grey,
.dro-panel .text-xs {
    color: white !important;
    opacity: 1;
}

.dro-panel option {
    background: white;
    color: var(--oz-teal-brand);
}

/* Axis card row */
.dro-card {
    display: flex;
    align-items: stretch;
    background: transparent !important;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25) !important;
    margin-bottom: 4px;
    height: 28px;
}

@media (min-width: 768px) {
    .dro-card {
        height: 28px;
        margin-bottom: 6px;
    }
}

.dro-card.border-l-axis-x {
    border-left: none;
}

.dro-card.border-l-axis-y {
    border-left: none;
}

.dro-card.border-l-axis-z {
    border-left: none;
}

.dro-card.border-l-axis-a {
    border-left: none;
}

/* Axis letter box */
.dro-label-box {
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 4px;
    gap: 2px;
    background: transparent !important;
    border-right: none !important;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 16px;
    color: white !important;
}

@media (min-width: 768px) {
    .dro-label-box {
        width: 44px;
        padding-left: 8px;
        gap: 4px;
        font-size: 18px;
    }
}

/* Number area */
.dro-readout {
    flex: 1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px;
    padding: 0 2px;
    background: transparent !important;
    overflow: hidden;
}

/* Work coordinate (large) */
.dro-val-lg {
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: white !important;
    line-height: 1;
    text-align: right;
    flex: 1;
    align-self: center;
}

@media (min-width: 768px) {
    .dro-val-lg {
        font-size: 21px;
    }
}

/* Machine coordinate (small) */
.dro-val-sm {
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.7) !important;
    line-height: 1;
    text-align: right;
    width: 60px;
    flex-shrink: 0;
    align-self: center;
}

@media (min-width: 768px) {
    .dro-val-sm {
        width: 64px;
    }
}

/* Zero button */
.dro-zero-btn {
    width: auto;
    padding: 0 5px;
    margin: 2px 0;
    border: none !important;
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--oz-r-xs);
    transition: all 0.15s;
}

.dro-zero-btn:hover {
    background: white !important;
    color: var(--oz-primary) !important;
}

/* Machine status pill */
.machine-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: var(--oz-teal-xlight);
    color: var(--oz-teal-brand);
    border: 1px solid var(--oz-teal-light);
    border-radius: 20px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Sub-controls: IDLE, HOME, SET ZERO, GO XY0 */
.dro-sub-btn {
    flex: 1;
    background: white !important;
    border: none !important;
    border-radius: 4px;
    color: var(--oz-primary) !important;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s;
    text-align: center;
    line-height: 1.2;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.dro-sub-btn:hover {
    background: #fff8f3 !important;
    transform: translateY(-1px);
}

.dro-sub-btn:active {
    transform: scale(0.96);
}

/* HOME button override → solid white on matching bg */
.dro-sub-btn.\!bg-primary,
.dro-panel .bg-primary {
    background: white !important;
    color: var(--oz-teal-brand) !important;
    border-color: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.dro-sub-btn.\!bg-primary:hover,
.dro-panel .bg-primary:hover {
    background: #FFF7F0 !important;
    transform: translateY(-1px);
}

/* ────────────────────────────────────────────────────────────────
   SIDEBAR CARD 3 — JOG PANEL
   Light teal card, 96px top-left, right callout arrow
   ──────────────────────────────────────────────────────────────── */
#jog-panel {
    background: var(--oz-primary-light);
    border-radius: 0;
    border: none;
    box-shadow: var(--oz-shadow-md);
    padding: 12px;
    position: relative;
    overflow: visible;
}

/* Right-pointing callout arrow */
#jog-panel::after {
    content: '';
    position: absolute;
    right: -22px;
    top: 22px;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 22px solid var(--oz-primary-light);
    z-index: 10;
    display: none;
}

@media (min-width: 768px) {
    #jog-panel::after {
        display: block;
    }
}

/* Jog wrapper & grid */
.jog-wrapper {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.jog-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.jog-extra-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* XY direction buttons */
.jog-btn {
    width: 48px;
    height: 48px;
    background: white;
    border: none;
    border-radius: 4px;
    color: var(--oz-grey-dark);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

/* Outer corner buttons — big organic radius on the outermost corner */
.jog-btn.rounded-tl-xl {
    border-radius: 20px 6px 6px 6px;
}

.jog-btn.rounded-tr-xl {
    border-radius: 6px 20px 6px 6px;
}

.jog-btn.rounded-bl-xl {
    border-radius: 6px 6px 6px 20px;
}

.jog-btn.rounded-br-xl {
    border-radius: 6px 6px 20px 6px;
}

/* Axis-coloured hover states (Full Color Backgrounds without borders) */
.jog-btn.\!text-axis-y {
    color: var(--axis-y);
}

.jog-btn.\!text-axis-x {
    color: var(--axis-x);
}

.jog-btn[data-jog="Y+"]:hover,
.jog-btn[data-jog="Y-"]:hover {
    background: var(--axis-y);
    color: white !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-1px);
}

.jog-btn[data-jog="Y+"]:hover>i,
.jog-btn[data-jog="Y-"]:hover>i {
    color: white !important;
}

.jog-btn[data-jog="X+"]:hover,
.jog-btn[data-jog="X-"]:hover {
    background: var(--axis-x);
    color: white !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.jog-btn[data-jog="X+"]:hover>i,
.jog-btn[data-jog="X-"]:hover>i {
    color: white !important;
}

.jog-btn[data-jog*="X"][data-jog*="Y"]:hover {
    background: var(--oz-teal-mid);
    color: white;
    box-shadow: 0 4px 12px rgba(68, 157, 159, 0.3);
    transform: translateY(-1px);
}

.jog-btn:active {
    transform: scale(0.91);
    box-shadow: none;
}

/* Center D-pad button */
.jog-pad>div {
    background: var(--oz-teal-xlight);
    border-radius: 50%;
    border: 2px solid var(--oz-teal-light);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jog-pad>div i {
    color: var(--oz-teal-mid);
    font-size: 18px;
}

/* Z / A extra buttons */
.jog-btn-extra {
    width: 48px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 4px;
    color: var(--oz-grey-dark);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    user-select: none;
}

.jog-btn-extra.\!text-axis-z {
    color: var(--axis-z);
}

.jog-btn-extra.\!text-axis-a {
    color: var(--axis-a);
}

.jog-btn-extra.\!text-axis-z:hover {
    background: var(--axis-z);
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.jog-btn-extra.\!text-axis-z:hover>i {
    color: white !important;
}

.jog-btn-extra.\!text-axis-a:hover {
    background: var(--axis-a);
    color: white !important;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    transform: translateY(-1px);
}

.jog-btn-extra.\!text-axis-a:hover>i {
    color: white !important;
}

.jog-btn-extra:active {
    transform: scale(0.91);
}

/* Unlock button */
.btn-secondary {
    background: var(--oz-teal-mid);
    color: white;
    border: 2px solid var(--oz-teal-mid);
    border-radius: var(--oz-r-xs);
    font-weight: 700;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(68, 157, 159, 0.25);
}

.btn-secondary:hover {
    background: var(--oz-primary);
    border-color: var(--oz-primary);
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.3);
}

/* Feed/Distance inputs */
.input-field,
#jog-panel input,
#jog-panel select {
    background: var(--oz-bg-panel);
    border: 1.5px solid var(--oz-teal-xlight);
    border-radius: var(--oz-r-xs);
    color: var(--oz-grey-dark);
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 8px;
    transition: border-color 0.15s;
    width: 100%;
}

.input-field:focus,
#jog-panel input:focus,
#jog-panel select:focus {
    border-color: var(--oz-teal-mid);
    box-shadow: 0 0 0 3px rgba(68, 157, 159, 0.12);
    background: white;
    outline: none;
}

/* ================================================================
   TOGGLES (Segmented Pills a.k.a Ooznest Style)
   ================================================================ */
.oz-segmented-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    user-select: none;
}

.oz-segmented-toggle input:focus+.oz-segmented-bg {
    box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.3);
}

.oz-segmented-bg {
    background: var(--oz-teal-xlight);
    border-radius: 20px;
    padding: 3px;
    display: flex;
    position: relative;
    width: 96px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.oz-segmented-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: white;
    border-radius: 16px;
    box-shadow: var(--oz-shadow-sm);
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.oz-segmented-toggle input:checked+.oz-segmented-bg .oz-segmented-slider {
    transform: translateX(100%);
}

.oz-segmented-option {
    flex: 1;
    text-align: center;
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 800;
    z-index: 1;
    padding: 3px 0;
    color: var(--oz-teal-brand);
    transition: color 0.2s;
}

.oz-segmented-toggle input:not(:checked)+.oz-segmented-bg .left-opt {
    color: var(--oz-primary);
}

.oz-segmented-toggle input:checked+.oz-segmented-bg .right-opt {
    color: var(--oz-primary);
}

/* ────────────────────────────────────────────────────────────────
   SIDEBAR SMALL CARDS — Overrides & Signals
   ──────────────────────────────────────────────────────────────── */


/* Override +/- buttons */
.btn-ovr {
    width: 100%;
    height: 28px;
    background: var(--oz-bg-panel);
    border: 1px solid var(--oz-teal-xlight);
    border-radius: 4px;
    color: var(--oz-grey-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    text-align: center;
    user-select: none;
}

.btn-ovr:hover {
    background: var(--oz-primary);
    color: white;
    border-color: var(--oz-primary);
}

/* Pin indicator badges */
[id^="pin-indicator-"] {
    border-radius: 4px;
    font-weight: 800;
    border: 1px solid var(--oz-teal-xlight);
    color: var(--oz-grey-mid);
    background: var(--oz-bg-panel);
    transition: all 0.15s;
    text-align: center;
}

/* ────────────────────────────────────────────────────────────────
   SIGNAL BADGES — Troubleshooting tab ON/OFF indicators
   ──────────────────────────────────────────────────────────────── */
.signal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.signal-off {
    background: var(--oz-teal-xlight);
    color: var(--oz-grey-mid);
    border: 1px solid var(--oz-teal-light);
}

.signal-on {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.25);
}

/* Override default pin-indicator styling when inside signal table */
table [id^="pin-indicator-"] {
    border: none;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    background: none;
    color: inherit;
    transition: all 0.2s;
}

/* ────────────────────────────────────────────────────────────────
   CONSOLE WRAPPER — Always dark, xterm5 critical
   ──────────────────────────────────────────────────────────────── */

.console-wrapper {
    background: var(--oz-teal-light) !important;
    border-radius: 0 0 0 var(--oz-r-xl);
    border: none;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05), var(--oz-shadow-md);
    padding: 12px;
    position: relative;
    /* Grow to fill console-outer instead of fixed height */
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Arrow is rendered via the parent div (.console-outer), not the console-wrapper itself,
   because console-wrapper needs overflow:hidden for xterm to size correctly.
   right: 8px aligns the arrow's left (visible) edge at the same x-position as DRO/Jog arrows:
   console-outer is full sidebar-width; sidebar - 30px padding = card right edge;
   arrow left edge = element_pos - 22px = (320-8) - 22 = 290px = card right edge. */
.console-outer {
    position: relative;
    overflow: visible;
    padding: 0 30px 8px 8px;
    /* flex: 1 1 0% — grow to fill remaining sidebar height, starts from 0 so
       machine-controls gets its natural size first, then we take the rest.
       min-height prevents it from being squeezed to nothing. */
    flex: 1 1 0%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.console-outer::after {
    content: '';
    position: absolute;
    right: 8px;
    bottom: 34px;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 22px solid var(--oz-teal-light);
    z-index: 10;
    display: none;
}

@media (min-width: 768px) {
    .console-outer::after {
        display: block;
    }
}

/* Remove ::after from console-wrapper itself (overflow:hidden would clip it) */
.console-wrapper::after {
    display: none;
}

#terminal-container {
    flex: 1;
    min-height: 0;
    border-radius: var(--oz-r-xs);
    overflow: hidden;
}

/* CRITICAL: All xterm ancestor elements must explicitly match the light theme bg
   otherwise xterm5 contrast engine shifts colors unexpectedly. */
#terminal-container,
#terminal-container .xterm,
#terminal-container .xterm-viewport,
#terminal-container .xterm-screen {
    background-color: var(--oz-teal-light) !important;
}

/* Console input row */
#console-input-area {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

#console-input-area input {
    flex: 1;
    background: white;
    border: 1.5px solid var(--oz-teal-light);
    border-radius: 4px;
    color: var(--oz-grey-dark);
    font-family: 'JetBrains Mono', 'Roboto Mono', monospace;
    font-size: 11px;
    padding: 6px 10px;
    height: 32px;
    transition: all 0.2s;
}

#console-input-area input::placeholder {
    color: var(--oz-grey-mid);
}

#console-input-area input:focus {
    border-color: var(--oz-teal-mid);
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(68, 157, 159, 0.15);
}

#btnSend {
    background: var(--oz-primary);
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(255, 102, 0, 0.2);
    padding: 0;
}

#btnSend:hover {
    background: var(--oz-primary-light);
    transform: translateY(-1px);
}

/* ================================================================
   BUTTONS — Global
   ================================================================ */
.btn {
    padding: 6px 12px;
    border-radius: var(--oz-r-xs);
    font-family: 'Nunito', 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 13px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    user-select: none;
}

@media (min-width: 768px) {
    .btn {
        padding: 8px 16px;
    }
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--oz-primary);
    color: white;
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.2);
}

.btn-primary:hover {
    background: var(--oz-primary-light);
    box-shadow: 0 5px 14px rgba(255, 102, 0, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--oz-grey-mid);
    border-radius: var(--oz-r-xs);
    padding: 4px;
}

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

.btn-icon {
    padding: 8px;
    border-radius: var(--oz-r-xs);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--oz-bg-panel);
}

/* ================================================================
   VIEWER OVERLAY
   ================================================================ */
.viewer-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.viewer-controls-left {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.overlay-btn {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: var(--oz-shadow-md);
    padding: 8px 14px;
    border-radius: var(--oz-r-sm);
    font-family: 'Nunito', 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--oz-grey-dark);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    user-select: none;
}

.overlay-btn:hover {
    color: var(--oz-primary);
    background: white;
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
.tab-pane {
    background: var(--oz-grey-light);
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#viewer-view {
    background: linear-gradient(150deg, #F7F9F9 0%, #E4EEEE 100%);
    position: relative;
    flex: 1;
    min-height: 0;
}

/* ================================================================
   FORMS (content pane)
   ================================================================ */
.tab-pane input[type="text"],
.tab-pane input[type="number"],
.tab-pane input[type="search"],
.tab-pane select,
.tab-pane textarea:not(.xterm-helper-textarea) {
    border-radius: var(--oz-r-xs);
    border: 1.5px solid var(--oz-teal-xlight);
    color: var(--oz-grey-dark);
    background: var(--oz-bg-panel);
    font-family: 'Nunito', 'Inter', sans-serif;
    padding: 6px 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tab-pane input:focus,
.tab-pane select:focus,
.tab-pane textarea:focus {
    border-color: var(--oz-teal-mid);
    box-shadow: 0 0 0 3px rgba(68, 157, 159, 0.12);
    background: white;
    outline: none;
}

/* Progress bar */
#job-progress-bar {
    background: var(--oz-primary);
}

/* xterm accessibility textarea — must stay hidden */
textarea.xterm-helper-textarea {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}