/* ==========================================================================
   DHMZ Očitavanje Traka v3.0 — Modern Redesign
   Dark theme with glass morphism, emerald/teal accents, Apple-style aesthetics
   All original IDs and classes preserved for JS compatibility.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Backgrounds — layered surfaces */
    --bg-base: #0a0d14;
    --bg-surface: #0f141d;
    --bg-elevated: #151b26;
    --bg-floating: #1a2230;
    --bg-glass: rgba(21, 27, 38, 0.72);
    --bg-panel: rgba(15, 20, 29, 0.85);

    /* Text */
    --text-primary: #e8edf5;
    --text-secondary: #9ba5b8;
    --text-muted: #5d6678;
    --text-faint: #3d4556;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* Accents — Emerald/Teal gradient theme */
    --accent: #10b981;
    --accent-hover: #14d397;
    --accent-active: #0ea371;
    --accent-soft: rgba(16, 185, 129, 0.12);
    --accent-softer: rgba(16, 185, 129, 0.06);
    --accent-glow: rgba(16, 185, 129, 0.30);
    --accent-grad: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
    --accent-grad-soft: linear-gradient(135deg, rgba(16,185,129,0.20) 0%, rgba(20,184,166,0.15) 100%);

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 24px var(--accent-glow);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Spacing scale (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Fonts */
    --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, Roboto, sans-serif;
    --font-mono: 'SF Mono', ui-monospace, 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 150ms;
    --dur-base: 220ms;
    --dur-slow: 320ms;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
.dhmz-app *,
.dhmz-app *::before,
.dhmz-app *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.dhmz-app h2, .dhmz-app h3, .dhmz-app h4,
.dhmz-app p, .dhmz-app label, .dhmz-app table,
.dhmz-app th, .dhmz-app td, .dhmz-app button,
.dhmz-app input, .dhmz-app select {
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.dhmz-app input, .dhmz-app select, .dhmz-app textarea {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-default);
    color: var(--text-primary) !important;
    color-scheme: dark;
    outline: none;
    font-family: var(--font-ui);
}

.dhmz-app input:focus, .dhmz-app select:focus {
    border-color: var(--accent);
}

.dhmz-app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse 1200px 600px at 10% -10%, rgba(16, 185, 129, 0.06), transparent 50%),
        radial-gradient(ellipse 1000px 500px at 90% 110%, rgba(20, 184, 166, 0.05), transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Hide WP admin bar & sidebar when our app is mounted */
html.dhmz-fullscreen, body.dhmz-fullscreen {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* --------------------------------------------------------------------------
   3. Scrollbars
   -------------------------------------------------------------------------- */
.dhmz-app ::-webkit-scrollbar { width: 10px; height: 10px; }
.dhmz-app ::-webkit-scrollbar-track { background: transparent; }
.dhmz-app ::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}
.dhmz-app ::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* --------------------------------------------------------------------------
   4. Topbar (Header)
   -------------------------------------------------------------------------- */
.dhmz-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 var(--space-5);
    height: 60px;
    flex-shrink: 0;
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 50;
    position: relative;
}

.dhmz-topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
    min-width: 180px;
}

.dhmz-topbar-brand .dhmz-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--accent-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.dhmz-topbar-brand .dhmz-logo-mark .dashicons {
    color: #fff;
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
}

.dhmz-logo {
    display: none; /* legacy — replaced by dhmz-logo-mark */
}

.dhmz-topbar-brand .dhmz-title-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.dhmz-topbar-brand .dhmz-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.dhmz-topbar-brand .dhmz-subtitle {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.dhmz-topbar.collapsed .dhmz-topbar-brand,
.dhmz-topbar.collapsed .dhmz-wizard {
    display: none;
}

.dhmz-topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.dhmz-separator {
    width: 1px;
    height: 24px;
    background: var(--border-subtle);
    margin: 0 var(--space-1);
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   5. Wizard (4-step progress)
   -------------------------------------------------------------------------- */
.dhmz-wizard {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
}

.dhmz-wizard-step {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 7px 14px 7px 10px;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--dur-base) var(--ease-out);
    white-space: nowrap;
    font-family: inherit;
}

.dhmz-wizard-step:not(:disabled):hover {
    color: var(--text-secondary);
    border-color: var(--border-default);
    background: rgba(255,255,255,0.02);
}

.dhmz-wizard-step .wizard-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: all var(--dur-base) var(--ease-out);
}

.dhmz-wizard-step .wizard-label {
    font-weight: 500;
}

.dhmz-wizard-step.active {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.dhmz-wizard-step.active .wizard-num {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.dhmz-wizard-step.completed {
    color: var(--text-primary);
    border-color: var(--accent-soft);
    background: var(--accent-softer);
}
.dhmz-wizard-step.completed .wizard-num {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.dhmz-wizard-step.completed .wizard-num::before {
    content: "✓";
    font-size: 11px;
    font-weight: 900;
}
.dhmz-wizard-step.completed .wizard-num > span {
    display: none;
}

.dhmz-wizard-step:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    color: var(--text-faint);
}

.dhmz-wizard-arrow {
    color: var(--text-faint);
    font-size: 10px;
    flex-shrink: 0;
    transition: color var(--dur-base);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */
.dhmz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease-out);
    white-space: nowrap;
}
.dhmz-btn:hover {
    background: var(--bg-floating);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.dhmz-btn:active {
    transform: scale(0.97);
}
.dhmz-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.dhmz-btn.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.dhmz-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.dhmz-btn-sm { padding: 6px 10px; font-size: 11px; border-radius: 8px; }
.dhmz-btn-xs { padding: 4px 8px; font-size: 10px; border-radius: 6px; }
.dhmz-btn-xxs { padding: 2px 6px; font-size: 10px; border-radius: 5px; min-width: 22px; }
.dhmz-btn-lg { padding: 12px 24px; font-size: 14px; border-radius: var(--radius-lg); font-weight: 600; }
.dhmz-btn-block { display: flex; width: 100%; }

.dhmz-btn-primary {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.dhmz-btn-primary:hover {
    background: var(--accent-grad);
    filter: brightness(1.08);
    color: #fff;
}
.dhmz-btn-primary:active { filter: brightness(0.95); }

.dhmz-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}
.dhmz-btn-danger:hover {
    color: #fff;
    filter: brightness(1.08);
}

.dhmz-btn-logout {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
    text-decoration: none;
    margin-left: var(--space-2);
}
.dhmz-btn-logout:hover {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #fecaca !important;
}

/* Icon-only buttons */
.dhmz-btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
}
.dhmz-btn-icon .dashicons { font-size: 16px; width: 16px; height: 16px; line-height: 16px; }

/* --------------------------------------------------------------------------
   7. Context Bar / Toolbar
   -------------------------------------------------------------------------- */
.dhmz-context-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 50px;
    flex-shrink: 0;
    z-index: 40;
    overflow-x: auto;
    overflow-y: hidden;
}
.dhmz-context-bar::-webkit-scrollbar { height: 4px; }

.dhmz-toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.dhmz-rotate-fine,
.dhmz-aux-rotate-fine {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}
.dhmz-rotate-fine input[type="range"],
.dhmz-aux-rotate-fine input[type="range"] {
    width: 90px;
    height: 16px;
    accent-color: var(--accent);
}
.dhmz-rotate-fine #rotate-value,
.dhmz-aux-rotate-fine #aux-rotate-value {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    min-width: 36px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.dhmz-contrast-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}
.dhmz-contrast-control span:first-child {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dhmz-contrast-control input[type="range"] {
    width: 70px;
    height: 14px;
    accent-color: var(--accent);
}
.dhmz-contrast-control span[id$="-value"] {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    min-width: 24px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Edit tools tilt-only mode (inherits from previous) */
.dhmz-edit-tools.tilt-only > * { display: none !important; }
.dhmz-edit-tools.tilt-only > .dhmz-rotate-fine { display: inline-flex !important; }
.dhmz-edit-tools.tilt-only > .dhmz-contrast-control { display: inline-flex !important; }

/* Floating Header Controls Popover (sticky header tilt + Y offset) */
.dhmz-header-popover {
    position: fixed;
    top: 110px;
    right: 24px;
    z-index: 99999;
    width: 280px;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    animation: dhmz-fade-up 0.18s var(--ease-out);
}
.dhmz-header-popover-arrow {
    position: absolute;
    top: -7px;
    right: 22px;
    width: 12px;
    height: 12px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-default);
    border-left: 1px solid var(--border-default);
    transform: rotate(45deg);
}
.dhmz-header-popover-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
#btn-header-popover-close {
    background: transparent !important;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
#btn-header-popover-close:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5;
}
#btn-header-controls.active {
    color: var(--accent);
    border-color: var(--accent);
}

.dhmz-hint {
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dhmz-zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}
.dhmz-zoom-display {
    font-family: var(--font-mono);
    font-size: 11px;
    min-width: 56px;
    text-align: center;
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    font-variant-numeric: tabular-nums;
}
.dhmz-zoom-display:focus {
    background: var(--bg-surface) !important;
}

/* --------------------------------------------------------------------------
   8. Main Layout
   -------------------------------------------------------------------------- */
.dhmz-main {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.dhmz-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.dhmz-canvas-wrap {
    flex: 1;
    position: relative;
    background: #050709;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.03), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.03), transparent 40%);
    overflow: hidden;
    min-height: 0;
}
.dhmz-canvas-wrap.mode-crop { cursor: crosshair; }
.dhmz-canvas-wrap.mode-read { cursor: none; }
.dhmz-canvas-wrap.mode-edit { cursor: grab; }
.dhmz-canvas-wrap.panning { cursor: grabbing; }

.dhmz-canvas-wrap canvas {
    display: block;
    position: absolute;
    inset: 0;
}

/* --------------------------------------------------------------------------
   9. Upload Overlay & Instrument Selection (Step 1)
   -------------------------------------------------------------------------- */
.dhmz-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse 800px 400px at 50% 0%, rgba(16, 185, 129, 0.08), transparent 60%),
        radial-gradient(ellipse 600px 300px at 50% 100%, rgba(20, 184, 166, 0.06), transparent 60%);
    z-index: 10;
    overflow: auto;
    padding: var(--space-8) var(--space-5);
}
.dhmz-upload-overlay.drag-over .dhmz-upload-box {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dhmz-upload-box {
    width: 100%;
    max-width: 560px;
    padding: var(--space-8);
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    text-align: center;
    transition: all var(--dur-base) var(--ease-out);
}
.dhmz-upload-box h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}
.dhmz-upload-box p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: var(--space-4);
}
.dhmz-upload-box .dhmz-upload-or {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: var(--space-3) 0;
}
.dhmz-upload-box .dhmz-upload-formats {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--space-4);
}

.dhmz-upload-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--space-5);
    border-radius: var(--radius-xl);
    background: var(--accent-grad-soft);
    border: 1px solid var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.dhmz-upload-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    line-height: 36px;
}

/* === Instrument Selection Cards (Step 1) === */
.dhmz-instrument-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: var(--bg-base);
    overflow: auto;
    padding: var(--space-8) var(--space-5);
    z-index: 11;
}

.dhmz-instrument-screen .instrument-hero {
    text-align: center;
    max-width: 640px;
    margin: var(--space-8) 0 var(--space-6);
    animation: dhmz-fade-up 0.6s var(--ease-out);
}
.dhmz-instrument-screen .instrument-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 500;
    margin-bottom: var(--space-5);
}
.dhmz-instrument-screen h2 {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}
.dhmz-instrument-screen h2 .accent {
    background: var(--accent-grad);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}
.dhmz-instrument-screen p.instrument-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.dhmz-instrument-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    width: 100%;
    max-width: 1180px;
    margin-bottom: var(--space-8);
}

.dhmz-instrument-card {
    position: relative;
    padding: var(--space-5);
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    cursor: pointer;
    text-align: left;
    transition: all var(--dur-base) var(--ease-out);
    overflow: hidden;
    font-family: inherit;
    color: var(--text-primary);
    animation: dhmz-fade-up 0.6s var(--ease-out) backwards;
}
.dhmz-instrument-card:nth-child(1) { animation-delay: 0ms; }
.dhmz-instrument-card:nth-child(2) { animation-delay: 80ms; }
.dhmz-instrument-card:nth-child(3) { animation-delay: 160ms; }
.dhmz-instrument-card:nth-child(4) { animation-delay: 240ms; }

.dhmz-instrument-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--card-grad, var(--accent-grad-soft));
    opacity: 0;
    transition: opacity var(--dur-slow) var(--ease-out);
    pointer-events: none;
}
.dhmz-instrument-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    background: var(--bg-elevated);
}
.dhmz-instrument-card:hover::before { opacity: 1; }
.dhmz-instrument-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dhmz-instrument-card > * { position: relative; z-index: 1; }

.dhmz-instrument-card .card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    transition: all var(--dur-base) var(--ease-out);
}
.dhmz-instrument-card:hover .card-icon {
    background: var(--accent-soft);
    color: var(--accent);
}
.dhmz-instrument-card .card-icon .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    line-height: 28px;
}
.dhmz-instrument-card .card-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 2;
    display: block;
}
.dhmz-instrument-card .card-arrow svg,
.dhmz-instrument-card svg.card-arrow {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    color: var(--text-faint);
    transition: all var(--dur-base) var(--ease-out);
}
.dhmz-instrument-card:hover svg.card-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

.dhmz-instrument-card .card-name {
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}
.dhmz-instrument-card .card-en {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-3);
}
.dhmz-instrument-card .card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}
.dhmz-instrument-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}
.dhmz-instrument-card .card-range {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.dhmz-instrument-card .card-arrow {
    color: var(--text-faint);
    transition: all var(--dur-base) var(--ease-out);
}
.dhmz-instrument-card:hover .card-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

/* Scanner quality toggle (below instrument grid) */
.dhmz-scanner-toggle {
    margin-top: var(--space-5);
    display: flex;
    justify-content: center;
}
.dhmz-scanner-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    cursor: pointer;
    transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
    max-width: 420px;
}
.dhmz-scanner-label:hover {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.06);
}
.dhmz-scanner-label input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.scanner-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.scanner-toggle-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.scanner-toggle-desc {
    font-size: 11px;
    color: var(--text-faint);
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   10. Sidebar & Panels
   -------------------------------------------------------------------------- */
.dhmz-sidebar {
    width: 340px;
    min-width: 340px;
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* When sidebar is in floating mode (step 4) */
.dhmz-sidebar.floating {
    position: fixed;
    top: 120px;
    right: 20px;
    width: 360px;
    max-height: calc(100vh - 160px);
    z-index: 60;
    background: var(--bg-elevated);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
}
.dhmz-sidebar.floating.dragging {
    border-color: var(--accent);
    transition: none;
}
.dhmz-sidebar.floating.minimized {
    max-height: 48px !important;
    overflow: hidden;
}
.dhmz-sidebar.floating.minimized .dhmz-panel {
    display: none;
}

.dhmz-sidebar-handle {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}
.dhmz-sidebar.floating .dhmz-sidebar-handle { display: flex; }
.dhmz-sidebar.floating.dragging .dhmz-sidebar-handle { cursor: grabbing; }

.dhmz-sidebar-handle-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.dhmz-sidebar-handle-title .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    color: var(--accent);
}
.dhmz-sidebar-handle-actions {
    display: flex;
    gap: 4px;
}
.dhmz-sidebar-handle-actions .dhmz-btn {
    padding: 3px 6px;
    font-size: 11px;
}

/* Panels */
.dhmz-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--dur-fast);
}
.dhmz-panel:hover {
    border-color: var(--border-default);
}

.dhmz-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 12px var(--space-4);
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    user-select: none;
    transition: background var(--dur-fast);
}
.dhmz-panel-header:hover {
    background: rgba(255, 255, 255, 0.02);
}
.dhmz-panel-header h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}
.dhmz-panel-header h3 .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    color: var(--accent);
}
.dhmz-collapse-arrow {
    font-size: 9px;
    color: var(--text-muted);
    transition: transform var(--dur-base) var(--ease-out);
    display: inline-block;
}
.dhmz-panel-header.collapsed .dhmz-collapse-arrow {
    transform: rotate(-90deg);
}

.dhmz-panel-body {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.dhmz-panel-body-scroll {
    max-height: 360px;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
}

.dhmz-panel-footer {
    display: flex;
    gap: 6px;
    padding: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.dhmz-panel-data {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

/* --------------------------------------------------------------------------
   11. Form Elements
   -------------------------------------------------------------------------- */
.dhmz-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dhmz-form-group label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.dhmz-form-row {
    display: flex;
    gap: var(--space-2);
}
.dhmz-form-row .dhmz-form-group { flex: 1; }

.dhmz-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary) !important;
    font-family: inherit;
    transition: all var(--dur-fast);
}
.dhmz-input:focus {
    border-color: var(--accent) !important;
}
.dhmz-input-lg {
    font-size: 14px;
    padding: 12px 14px;
}

.dhmz-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 11px;
    transition: all var(--dur-fast);
    user-select: none;
}
.dhmz-toggle:hover {
    border-color: var(--border-strong);
}
.dhmz-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    margin: 0;
    background: transparent !important;
    border: none !important;
}
.dhmz-toggle-sm {
    padding: 5px 8px;
    font-size: 10px;
}

.dhmz-help-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   12. Badges
   -------------------------------------------------------------------------- */
.dhmz-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.dhmz-badge-info { background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.3); color: #93c5fd; }
.dhmz-badge-warning { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: #fcd34d; }
.dhmz-badge-success { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   13. Calibration Info Box
   -------------------------------------------------------------------------- */
.dhmz-cal-info {
    padding: 10px 12px;
    background: var(--accent-softer);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-line;
}

.dhmz-cal-ref-point {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    font-size: 11px;
    transition: all var(--dur-fast);
}
.dhmz-cal-ref-point.placed {
    border-left: 3px solid var(--accent);
}
.cal-ref-label { color: var(--text-primary); font-size: 12px; }
.cal-ref-actions { display: flex; gap: 4px; }

.dhmz-cal-instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: var(--space-4) var(--space-6);
    background: rgba(245, 158, 11, 0.15);
    border: 2px solid var(--warning);
    border-radius: var(--radius-lg);
    color: #fcd34d;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(245, 158, 11, 0.3);
    z-index: 20;
    animation: pulse 2s infinite;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   14. Cal offset controls & Selected Info
   -------------------------------------------------------------------------- */
#cal-offset-controls,
#aux-cal-offset-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin: var(--space-2) 0;
}
#cal-offset-controls .dhmz-btn,
#aux-cal-offset-controls .dhmz-btn {
    min-width: 30px;
    padding: 4px 6px;
    font-size: 10px;
}
#cal-offset-value,
#aux-cal-offset-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 0 6px;
}

#cal-selected-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    margin-bottom: 6px;
    background: rgba(250, 204, 21, 0.1);
    border: 1px solid rgba(250, 204, 21, 0.3);
    border-radius: var(--radius-md);
    font-size: 11px;
    color: #fef08a;
}

/* --------------------------------------------------------------------------
   15. Day Tabs
   -------------------------------------------------------------------------- */
.dhmz-tabs-wrap {
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
}
.dhmz-tabs-arrow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22px;
    background: var(--bg-panel);
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.dhmz-tabs-arrow.visible { display: flex; }
.dhmz-tabs-arrow-left { left: 0; border-right: 1px solid var(--border-subtle); }
.dhmz-tabs-arrow-right { right: 0; border-left: 1px solid var(--border-subtle); }
.dhmz-tabs-arrow:hover { color: var(--accent); background: var(--bg-floating); }

.dhmz-tabs {
    display: flex;
    gap: 2px;
    overflow-x: hidden;
    scroll-behavior: smooth;
}
.dhmz-tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--dur-fast);
    font-family: inherit;
}
.dhmz-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}
.dhmz-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.dhmz-tab-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    font-size: 9px;
    font-weight: 700;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.dhmz-tab-badge.badge-low { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.dhmz-tab-badge.badge-half { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.dhmz-tab-badge.badge-complete { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------------------------
   16. Data Table (Slots)
   -------------------------------------------------------------------------- */
.dhmz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}
/* Slot table column widths — keep total ≤ sidebar width to prevent horizontal overflow */
.dhmz-slot-table { table-layout: fixed; }
.dhmz-slot-table col.col-termin { width: 64px; }
.dhmz-slot-table col.col-value  { width: auto; }
.dhmz-slot-table col.col-delta  { width: 48px; }
.dhmz-slot-table col.col-met    { width: 50px; }
.dhmz-slot-table col.col-status { width: 18px; }
.dhmz-slot-table col.col-del    { width: 26px; }
.dhmz-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    padding: 8px 10px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-default);
    z-index: 1;
}
.dhmz-table tbody tr.dhmz-slot-row {
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all var(--dur-fast);
}
.dhmz-slot-row:hover { background: rgba(255, 255, 255, 0.02); }
.dhmz-slot-row.slot-active {
    background: var(--accent-softer);
    border-left-color: var(--accent);
}
.dhmz-slot-row.slot-marked { background: rgba(16, 185, 129, 0.04); }
.dhmz-slot-row.slot-out-of-range { background: rgba(239, 68, 68, 0.08); }
.dhmz-slot-row.slot-aux-source { border-left-color: var(--warning); }
.dhmz-slot-row.slot-aux-source.slot-active { background: rgba(245, 158, 11, 0.12); }

.dhmz-slot-row td { padding: 6px 6px; overflow: hidden; text-overflow: ellipsis; }
.slot-time { font-weight: 600; color: var(--text-primary); white-space: nowrap; font-size: 11px; }
.slot-date-hint { color: var(--text-muted); font-size: 9px; margin-left: 3px; }
.slot-status { color: var(--text-muted); font-size: 10px; padding: 0 !important; }
.slot-met {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-size: 10px;
    text-align: right;
}
/* Direct selector — applies to ALL .dhmz-slot-input wherever it sits */
.dhmz-app .dhmz-slot-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    font-size: 11px;
    text-align: center;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary) !important;
    outline: none;
    transition: border-color var(--dur-fast);
    min-width: 0;
}
.dhmz-app .dhmz-slot-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.dhmz-slot-input.slot-val-invalid {
    border-color: var(--danger) !important;
    color: #fca5a5 !important;
}
/* Constrain reading data panel + table to never overflow sidebar */
#panel-data, #data-collapsible, #readings-container { min-width: 0; max-width: 100%; overflow: hidden; }
#readings-container { overflow-x: hidden; overflow-y: auto; }

/* Delete button per reading row */
.slot-delete-cell { width: 28px; text-align: center; }
.dhmz-slot-delete-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: all var(--dur-fast);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dhmz-slot-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Pluviograph delta column */
.slot-delta {
    font-family: var(--font-mono);
    color: #60a5fa;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.dhmz-strip-divider td {
    padding: 4px 0;
    background: var(--accent-softer);
}
.dhmz-strip-divider-line {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    padding: 4px 0;
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

.dhmz-data-empty {
    text-align: center;
    padding: var(--space-6);
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   17. Min/Max Table
   -------------------------------------------------------------------------- */
.dhmz-minmax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}
.dhmz-minmax-table th {
    padding: 6px 8px;
    background: var(--bg-elevated);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-default);
}
.dhmz-minmax-row { border-bottom: 1px solid var(--border-subtle); }
.dhmz-minmax-row:hover { background: rgba(255, 255, 255, 0.02); }
.dhmz-minmax-cell { padding: 6px 8px; text-align: center; cursor: pointer; }
.dhmz-minmax-cell.placing {
    background: var(--accent-soft);
    animation: dhmz-blink 1s ease-in-out infinite;
}
.dhmz-minmax-date { font-size: 10px; color: var(--text-secondary); padding: 6px 8px; }
.dhmz-minmax-datestr { font-weight: 600; font-size: 9px; color: var(--text-muted); }
.dhmz-minmax-val { font-family: var(--font-mono); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.dhmz-minmax-val.min-val { color: #60a5fa; }
.dhmz-minmax-val.max-val { color: #f59e0b; }
.dhmz-minmax-time { font-size: 9px; color: var(--text-muted); display: block; }
.dhmz-minmax-label {
    display: inline-block;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
}
.dhmz-minmax-label.min-label { background: rgba(96, 165, 250, 0.2); color: #93c5fd; }
.dhmz-minmax-label.max-label { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.dhmz-minmax-placing { animation: dhmz-blink 1.2s ease-in-out infinite; color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   18. Auxiliary Strip Panel
   -------------------------------------------------------------------------- */
.dhmz-aux-panel {
    height: 35vh;
    min-height: 80px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}
.dhmz-aux-header {
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.dhmz-aux-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    flex-wrap: wrap;
}
.dhmz-aux-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-right: var(--space-2);
}
.dhmz-aux-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}
.dhmz-aux-canvas-wrap {
    flex: 1;
    position: relative;
    background: #050709;
    overflow: hidden;
    min-height: 0;
}
.dhmz-aux-canvas-wrap canvas {
    position: absolute;
    inset: 0;
    display: block;
}
.dhmz-aux-upload-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 13px;
}
.dhmz-aux-upload-hint .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    line-height: 32px;
    color: var(--text-faint);
}
.dhmz-aux-resize-handle {
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    position: relative;
    flex-shrink: 0;
    border-top: 1px solid var(--border-subtle);
}
.dhmz-aux-resize-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 2px;
    background: var(--border-default);
    border-radius: var(--radius-full);
    transition: background var(--dur-fast);
}
.dhmz-aux-resize-handle:hover::after { background: var(--accent); }

/* --------------------------------------------------------------------------
   19. Crosshair
   -------------------------------------------------------------------------- */
.dhmz-crosshair {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
}
.dhmz-crosshair-v { width: 1px; top: 0; bottom: 0; background: rgba(239, 68, 68, 0.6); }
.dhmz-crosshair-h { height: 1px; left: 0; right: 0; background: rgba(239, 68, 68, 0.6); }
.dhmz-canvas-wrap.mode-read .dhmz-crosshair,
.dhmz-aux-canvas-wrap .dhmz-crosshair { opacity: 1; }

/* --------------------------------------------------------------------------
   20. Modals
   -------------------------------------------------------------------------- */
.dhmz-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}
.dhmz-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 9, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.dhmz-modal-dialog {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dhmz-modal-in 0.28s var(--ease-out);
}
.dhmz-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}
.dhmz-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.dhmz-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    line-height: 1;
    transition: all var(--dur-fast);
}
.dhmz-modal-close:hover {
    background: var(--bg-floating);
    color: var(--danger);
}
.dhmz-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}
.dhmz-modal-footer {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-subtle);
}

.dhmz-radio-card {
    display: flex;
    flex-direction: column;
    padding: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    margin-bottom: var(--space-2);
    transition: all var(--dur-fast);
}
.dhmz-radio-card:hover { border-color: var(--border-strong); }
.dhmz-radio-card.selected {
    border-color: var(--accent);
    background: var(--accent-softer);
    box-shadow: 0 0 0 3px var(--accent-softer);
}
.dhmz-radio-card strong { color: var(--text-primary); font-size: 13px; margin-left: var(--space-2); }
.dhmz-radio-desc { color: var(--text-muted); font-size: 11px; display: block; margin-top: 4px; margin-left: 24px; }
.dhmz-radio-card input[type="radio"] {
    background: transparent !important;
    border: 1px solid var(--border-strong);
    accent-color: var(--accent);
}

/* --------------------------------------------------------------------------
   21. Sessions List (in modal)
   -------------------------------------------------------------------------- */
.dhmz-sessions-list {
    display: flex;
    flex-direction: column;
}
.dhmz-session-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 14px var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background var(--dur-fast);
}
.dhmz-session-item:hover { background: var(--bg-floating); }
.dhmz-session-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--accent-softer);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dhmz-session-item-icon .dashicons { font-size: 20px; width: 20px; height: 20px; line-height: 20px; }
.dhmz-session-item-info { flex: 1; min-width: 0; }
.dhmz-session-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 3px;
}
.dhmz-session-item-meta {
    display: flex;
    gap: var(--space-3);
    font-size: 10px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.dhmz-session-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--dur-fast);
}
.dhmz-session-item:hover .dhmz-session-item-actions { opacity: 1; }
.dhmz-sessions-empty {
    padding: var(--space-8);
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   22. Status Bar
   -------------------------------------------------------------------------- */
.dhmz-statusbar {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: 6px var(--space-5);
    background: var(--bg-glass);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    font-size: 10px;
    color: var(--text-muted);
    flex-shrink: 0;
    min-height: 30px;
}
.dhmz-status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.dhmz-status-item strong {
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 9px;
}
.dhmz-status-hint {
    margin-left: auto;
    color: var(--text-muted);
    cursor: help;
}
.dhmz-status-hint strong { color: var(--accent); font-family: inherit; }

/* --------------------------------------------------------------------------
   23. Toast Notifications
   -------------------------------------------------------------------------- */
#dhmz-toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   24. Blink Labels (for required fields)
   -------------------------------------------------------------------------- */
.dhmz-blink-label {
    display: inline-block;
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: #fca5a5;
    font-size: 11px;
    font-weight: 600;
    animation: dhmz-blink 1s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   25. Animations
   -------------------------------------------------------------------------- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes dhmz-blink {
    0%, 100% { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
    50% { border-color: var(--border-subtle); box-shadow: 0 0 0 3px transparent; }
}
@keyframes dhmz-fade-up {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes dhmz-modal-in {
    0% { opacity: 0; transform: scale(0.96) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* --------------------------------------------------------------------------
   26. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .dhmz-sidebar { width: 300px; min-width: 300px; }
    .dhmz-wizard { max-width: 600px; }
    .dhmz-wizard-step .wizard-label { display: none; }
    .dhmz-wizard-step { padding: 7px 10px; }
}
@media (max-width: 820px) {
    .dhmz-topbar-brand .dhmz-title-group { display: none; }
    .dhmz-topbar { padding: 0 var(--space-3); }
}
