* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #333;
}

/* ─── Popup / Modal ───────────────────────────────────────────────── */

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.popup-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.popup-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0a2540;
    margin-bottom: 0.75rem;
}

.popup-card p {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.popup-card .btn {
    margin-top: 0.5rem;
}

/* ─── Login Screen ───────────────────────────────────────────────── */

.login-screen {
    position: fixed;
    inset: 0;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.login-logo-img {
    width: 160px;
    height: auto;
}

.login-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0a2540;
    text-align: center;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
    margin-bottom: 1.5rem !important;
}

.login-card .login-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.2s;
    letter-spacing: normal;
    text-align: left;
}

.login-card .login-input:focus {
    outline: none;
    border-color: #2b62ec;
}

.login-error {
    font-size: 0.8rem;
    color: #ef4444;
    text-align: center;
    margin: 0.25rem 0 0;
    font-weight: 500;
}

.btn-full {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.75rem;
    font-size: 1rem;
}

/* ─── Two-column layout ─────────────────────────────────────────── */

.app-layout {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

/* ─── Left Sidebar ──────────────────────────────────────────────── */

.sidebar {
    width: 240px;
    min-width: 240px;
    flex-shrink: 0;
    background: #2b62ec;
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.2rem 1.2rem;
    gap: 0;
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    padding: 1.2rem 1.2rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin: -1.5rem -1.2rem 1.5rem -1.2rem;
}

.minimed-logo {
    width: 90%;
    max-width: 166px;
    height: auto;
    display: block;
}

.sidebar-username {
    text-align: center;
    padding: 0.5rem 0 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #a8c0ff;
}

/* Device panel — hidden until pump is connected */

.device-panel {
    flex: 1;
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.device-panel.active {
    display: flex;
}

.device-image-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
}

.device-img {
    max-width: 195px;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.device-name-row {
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: center;
}

.device-name-row span {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
    letter-spacing: 0.03em;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.detail-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.65);
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.detail-value.mono {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

/* Status indicators at bottom of sidebar */

.sidebar-status {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 1rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.8);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}

.dot.connected    { background: #4caf50; box-shadow: 0 0 5px rgba(76,175,80,0.8); }
.dot.disconnected { background: rgba(255,255,255,0.3); }

/* ─── Sidebar Action Buttons ─────────────────────────────────────── */

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 1rem;
}

.btn-sidebar {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    color: #1a1a2e;
}

.btn-sidebar:hover {
    opacity: 0.9;
}

.btn-logoff {
    background: #ef4444;
    color: #fff;
}

.btn-disconnect {
    background: #eab308;
    color: #1a1a2e;
}

.sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0.5rem 0;
}

/* ─── Right Main Pane ───────────────────────────────────────────── */

.main-pane {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── Right Activity Log Pane ───────────────────────────────────────── */

.right-pane {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
    background: #1a1a2e;
    color: #e8f0fe;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.1);
    transform: translateX(0);
    transition: transform 0.3s ease, width 0.3s ease, min-width 0.3s ease;
}

.right-pane.collapsed {
    width: 0;
    min-width: 0;
    transform: translateX(100%);
    overflow: hidden;
}

.right-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.right-pane-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255,255,255,0.2);
}

.btn-show-log {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: right 0.3s ease, background 0.2s;
}

.btn-show-log:hover {
    background: #2a2a4e;
}

.btn-show-log.hidden {
    right: -40px;
}

.main-header {
    margin-bottom: 1.75rem;
    position: relative;
}

.main-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0a2540;
}

.subtitle {
    color: #6b7280;
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

/* ─── Language Selector in Header ───────────────────────────────── */

.language-selector-header {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.lang-dropdown-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.lang-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.lang-dropdown-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.lang-dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.lang-dropdown-btn.open .lang-dropdown-arrow {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    min-width: 150px;
    z-index: 20;
}

.lang-dropdown-menu button {
    width: 100%;
    background: none;
    border: none;
    padding: 0.6rem 1rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1rem;
    color: #1a1a2e;
    transition: background 0.2s;
}

.lang-dropdown-menu button:hover {
    background: #f0f0f0;
}

.lang-dropdown-menu button.active {
    background: #e0e0e0;
    font-weight: 600;
}

/* ─── Login Screen Language Selector ───────────────────────────── */

.login-lang-selector {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.login-lang-selector .lang-dropdown-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #1a1a2e;
    font-size: 1rem;
    padding: 0.3rem 0.6rem;
}

.login-lang-selector .lang-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.login-lang-selector .lang-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
}

/* ─── Cards ─────────────────────────────────────────────────────── */

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #0a2540;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #0a2540;
}

.card p {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ─── Form ───────────────────────────────────────────────────────── */

.input-group {
    margin-bottom: 1rem;
}

.input-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-row .input-group {
    flex: 1;
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group input {
    width: 160px;
    padding: 0.65rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.2rem;
    font-family: 'Fira Code', 'Consolas', monospace;
    letter-spacing: 0.3em;
    text-align: center;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
}

.input-group input:invalid {
    border-color: #ef4444;
}

/* ─── Buttons ────────────────────────────────────────────────────── */

.btn {
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

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

.btn.primary {
    background: #005EB8;
    color: white;
}

.btn.primary:hover:not(:disabled) {
    background: #0047a0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,94,184,0.3);
}

.btn.success {
    background: #10b981;
    color: white;
}

.btn.success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

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

.btn.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220,38,38,0.4);
}

/* ─── Danger Card (Wipe Pump) ─────────────────────────────────────── */

.card-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fca5a5;
    box-shadow: 0 4px 16px rgba(220,38,38,0.15);
}

.card-danger h2 {
    color: #b91c1c;
}

.danger-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.danger-warning {
    color: #b91c1c;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.danger-recommendation {
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    background: rgba(220,38,38,0.1);
    border-left: 3px solid #dc2626;
    border-radius: 4px;
}

.danger-disclaimer {
    color: #991b1b;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 1.25rem;
    padding: 0.6rem 0.8rem;
    background: rgba(153,27,27,0.08);
    border-left: 3px solid #991b1b;
    border-radius: 4px;
}

.connect-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.connect-buttons .btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

.wipe-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.wipe-buttons .btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

/* ─── Warning Card (Chained FOTA) ─────────────────────────────────── */

.card-warning {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border: 2px solid #5eead4;
    box-shadow: 0 4px 16px rgba(20,184,166,0.15);
}

.card-warning h2 {
    color: #0f766e;
}

.warning-icon {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #0d9488;
}

.warning-text {
    color: #0f766e;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.warning-disclaimer {
    color: #115e59;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 1.25rem;
    padding: 0.6rem 0.8rem;
    background: rgba(13,148,136,0.08);
    border-left: 3px solid #0d9488;
    border-radius: 4px;
}

.btn.btn-warning {
    background: #0d9488;
    color: white;
}

.btn.btn-warning:hover:not(:disabled) {
    background: #0f766e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13,148,136,0.4);
}

.chained-fota-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.chained-fota-buttons .btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
}

input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #0d9488;
}

/* ─── Info box ───────────────────────────────────────────────────── */

.info-box {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1e40af;
}

/* ─── Progress ───────────────────────────────────────────────────── */

#upload-progress-container {
    margin-top: 1.25rem;
}

.upload-progress-track {
    position: relative;
    width: 100%;
    height: 32px;
    background: #9ca3af;
    border-radius: 16px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #005EB8, #0ea5e9, #005EB8);
    background-size: 200% 100%;
    border-radius: 16px;
    transition: width 0.5s ease, background 0.4s ease;
    animation: gradient-flow 2s linear infinite;
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.upload-progress-fill.success {
    background: linear-gradient(90deg, #059669, #10b981);
    animation: none;
}

.upload-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    pointer-events: none;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Pairing Progress Bar ───────────────────────────────────────── */

#pairing-progress-container {
    margin-top: 1.25rem;
}

.pairing-progress-track {
    position: relative;
    width: 100%;
    height: 32px;
    background: #9ca3af;
    border-radius: 16px;
    overflow: hidden;
}

.pairing-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #005EB8, #0ea5e9, #005EB8);
    background-size: 200% 100%;
    border-radius: 16px;
    transition: width 0.5s ease, background 0.4s ease;
    animation: gradient-flow 2s linear infinite;
}

.pairing-progress-fill.success {
    background: linear-gradient(90deg, #059669, #10b981);
    animation: none;
}

.pairing-progress-fill.error {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    animation: none;
}

.pairing-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    pointer-events: none;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pairing-steps-list {
    display: none;
}

.pairing-step-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #6b7280;
    transition: color 0.3s;
}

.pairing-step-item.done {
    color: #059669;
}

.pairing-step-item.active {
    color: #005EB8;
    font-weight: 600;
}

.pairing-step-item.error {
    color: #dc2626;
}

.pairing-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
    transition: background 0.3s;
}

.pairing-step-item.done .pairing-step-dot   { background: #10b981; }
.pairing-step-item.active .pairing-step-dot { background: #005EB8; }
.pairing-step-item.error .pairing-step-dot  { background: #ef4444; }

/* ─── Card subtitle ─────────────────────────────────────────────── */

.card-subtitle {
    color: #6b7280;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

/* ─── Operations Grid ────────────────────────────────────────────── */

.operations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.operation-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
    text-align: center;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.operation-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    filter: brightness(1.02);
}

.operation-tile:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Color variants */
.operation-tile.op-color-blue   { border-color: #93c5fd; background: #eff6ff; }
.operation-tile.op-color-purple { border-color: #c4b5fd; background: #f5f3ff; }
.operation-tile.op-color-teal   { border-color: #5eead4; background: #f0fdfa; }
.operation-tile.op-color-green  { border-color: #86efac; background: #f0fdf4; }
.operation-tile.op-color-amber  { border-color: #fcd34d; background: #fffbeb; }
.operation-tile.op-color-orange { border-color: #fdba74; background: #fff7ed; }
.operation-tile.op-color-red    { border-color: #fca5a5; background: #fef2f2; }

.op-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.op-color-blue   .op-icon { background: #dbeafe; color: #1d4ed8; }
.op-color-purple .op-icon { background: #ede9fe; color: #7c3aed; }
.op-color-teal   .op-icon { background: #ccfbf1; color: #0f766e; }
.op-color-green  .op-icon { background: #dcfce7; color: #15803d; }
.op-color-amber  .op-icon { background: #fef3c7; color: #b45309; }
.op-color-orange .op-icon { background: #ffedd5; color: #c2410c; }
.op-color-red    .op-icon { background: #fee2e2; color: #b91c1c; }

.op-icon svg {
    width: 100%;
    height: 100%;
}

.op-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0a2540;
    line-height: 1.2;
}

.op-description {
    font-size: 0.72rem;
    color: #6b7280;
    line-height: 1.3;
}

.op-remaining {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.operation-tile.op-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
    transform: none !important;
}

.operation-tile.op-disabled:hover,
.operation-tile.op-disabled:active {
    transform: none !important;
    box-shadow: none !important;
    filter: none !important;
}

.operation-tile.op-disabled .op-label,
.operation-tile.op-disabled .op-description,
.operation-tile.op-disabled .op-icon svg {
    color: #94a3b8 !important;
    background: transparent !important;
}

.operation-tile.op-disabled .op-disabled-message {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #374151;
    background: #fee2e2;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

/* ─── Operation Progress Card ────────────────────────────────────── */

.operation-progress-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.operation-progress-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: #dbeafe;
    color: #1d4ed8;
    flex-shrink: 0;
}

.operation-progress-icon svg {
    width: 100%;
    height: 100%;
}

#card-operation-progress h2 {
    margin-bottom: 0;
}

.operation-progress-track {
    position: relative;
    width: 100%;
    height: 32px;
    background: #9ca3af;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.operation-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #005EB8, #0ea5e9, #005EB8);
    background-size: 200% 100%;
    border-radius: 16px;
    transition: width 0.5s ease, background 0.4s ease;
    animation: gradient-flow 2s linear infinite;
}

.operation-progress-fill.success {
    background: linear-gradient(90deg, #059669, #10b981);
    animation: none;
}

.operation-progress-fill.failure {
    background: linear-gradient(90deg, #b91c1c, #ef4444);
    animation: none;
}

.operation-progress-fill.cancelled {
    background: linear-gradient(90deg, #4b5563, #6b7280);
    animation: none;
}

/* ─── Completed operations list (chat-style history) ─────────────── */

#completed-operations-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0;
}

#completed-operations-list:not(:empty) {
    margin-top: 0.6rem;
}

.completed-op-pin {
    opacity: 0.78;
    pointer-events: none;
    animation: op-pin-in 0.3s ease;
}

.completed-op-pin .operation-progress-header {
    margin-bottom: 0.75rem;
}

.completed-op-time {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    color: #9ca3af;
    white-space: nowrap;
    padding-left: 0.75rem;
}

@keyframes op-pin-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 0.78; transform: translateY(0); }
}

.operation-progress-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    pointer-events: none;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.operation-progress-status {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.4;
}

/* ─── Disconnect Modal ─────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-card {
    background: #ffffff;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    animation: modal-slide-up 0.3s ease;
}

@keyframes modal-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-header .btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-header .btn-icon:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 1rem 0;
    line-height: 1.5;
    color: #374151;
}

.modal-body strong {
    color: #1f2937;
}

.disconnect-instructions {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.disconnect-instructions ol {
    margin: 0;
    padding-left: 1.25rem;
}

.disconnect-instructions li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.disconnect-instructions li:last-child {
    margin-bottom: 0;
}

.modal-note {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
}

.modal-footer .btn {
    background: #005EB8;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-footer .btn:hover {
    background: #004a94;
}

/* ─── Log Console ────────────────────────────────────────────────── */

.log-console {
    flex: 1;
    background: #0d1b2a;
    padding: 0.85rem 1rem;
    overflow-y: auto;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
}

.log-entry {
    padding: 1px 0;
    line-height: 1.6;
}

.log-time {
    color: #4a6680;
    margin-right: 0.5rem;
}

.log-info  .log-msg { color: #93c5fd; }
.log-warn  .log-msg { color: #fbbf24; }
.log-error .log-msg { color: #f87171; }
.log-debug .log-msg { color: #4b5563; }

.completed-op-download-row {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
}

.completed-op-download-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #60a5fa;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
    padding: 0.25rem 0.6rem;
    border: 1px solid rgba(96, 165, 250, 0.35);
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}

.completed-op-download-link::before {
    content: "⬇";
    font-size: 0.75rem;
}

.completed-op-download-link:hover {
    background: rgba(96, 165, 250, 0.12);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.6);
}

/* ─── Version Tag ───────────────────────────────────────────────── */

.version-text {
    position: fixed;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: rgba(51, 51, 51, 0.25);
    pointer-events: none;
    z-index: 1000;
}

/* ─── Main Pane Footer ───────────────────────────────────────────────── */

.main-pane-footer {
    padding: 1rem 0;
    text-align: center;
    border-top: 1px solid #e5e7eb;
    margin-top: 2rem;
}

.dongle-help-link-discreet {
    font-size: 0.8rem;
    color: #9ca3af;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dongle-help-link-discreet:hover {
    color: #0a7ea4;
    text-decoration: underline;
}

/* ─── DFU Modal ───────────────────────────────────────────────── */

.dfu-modal-card {
    max-width: 600px;
}

.dfu-instructions {
    margin-bottom: 1.5rem;
}

.dfu-instructions h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #0a2540;
    margin-bottom: 0.5rem;
}

.dfu-instructions p {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.dfu-instructions ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.dfu-instructions li {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.dfu-image-container {
    margin: 1.5rem 0;
    text-align: center;
}

.dfu-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    max-height: 300px;
}

.dfu-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 8px;
}

.dfu-status p {
    font-size: 0.9rem;
    color: #0a2540;
    margin-bottom: 1rem;
    font-weight: 500;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #d1d5db;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0a7ea4, #0a2540);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-text {
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* ─── History Inspector Button (sidebar) ──────────────────────────── */

.btn-inspector {
    background: #7c3aed;
    color: #fff;
}

/* ─── Download RAW Files Button (sidebar) ────────────────────────── */

.btn-download-raw {
    background: #005EB8;
    color: #fff;
}

/* ─── Download RAW Files Modal ───────────────────────────────────── */

.raw-files-modal-card {
    max-width: 750px;
    width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.raw-files-modal-card .modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.raw-files-status {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.raw-files-error {
    color: #ef4444;
}

.raw-files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.raw-files-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.raw-files-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

.raw-files-table tbody tr:hover {
    background: #f9fafb;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-download-row {
    background: #005EB8;
    color: #fff;
    transition: background 0.15s;
}

.btn-download-row:hover {
    background: #004a94;
}

.btn-reprocess-row {
    background: #059669;
    color: #fff;
    transition: background 0.15s;
}

.btn-reprocess-row:hover {
    background: #047857;
}

.btn-delete-row {
    background: #ef4444;
    color: #fff;
    transition: background 0.15s;
}

.btn-delete-row:hover {
    background: #dc2626;
}

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

.raw-files-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
