/* ============================================================
   Fastboot Studio — modern minimalist design system
   Dark-first, full light theme included
   ============================================================ */

:root {
    color-scheme: dark;

    /* Surfaces */
    --bg-0: #0a0d13;
    --bg-1: #0e1219;
    --bg-2: #141a26;
    --bg-3: #1b2231;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(79, 140, 255, 0.12);

    /* Borders */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);

    /* Accents */
    --accent: #4f8cff;
    --accent-2: #8b5cf6;
    --accent-soft: rgba(79, 140, 255, 0.16);
    --accent-glow: rgba(79, 140, 255, 0.35);

    /* Semantic */
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.14);

    /* Text */
    --text-1: #e9edf5;
    --text-2: #9aa4ba;
    --text-3: #5b667d;

    /* Typography */
    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

    /* Geometry */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: 0.18s ease;

    /* Layout */
    --topbar-h: 60px;
    --footer-h: 34px;
    --pane-left-w: 300px;
    --pane-right-w: 352px;
    --gap: 14px;
}

/* Light theme */
[data-theme="light"] {
    color-scheme: light;

    --bg-0: #f2f4f8;
    --bg-1: #ffffff;
    --bg-2: #f7f8fb;
    --bg-3: #eceff5;
    --bg-hover: rgba(15, 23, 42, 0.05);
    --bg-active: rgba(79, 140, 255, 0.14);

    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.18);

    --accent: #2f6fe4;
    --accent-2: #7c4dff;
    --accent-soft: rgba(47, 111, 228, 0.12);
    --accent-glow: rgba(47, 111, 228, 0.3);

    --success: #0f9d6a;
    --warning: #b7791f;
    --danger: #dc2626;
    --info: #2563eb;

    --text-1: #171e2e;
    --text-2: #48536b;
    --text-3: #8a93a8;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.1);
    --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.16);
}

/* ============================================================
   Base
   ============================================================ */

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

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-1);
    background: var(--bg-0);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

::selection {
    background: var(--accent-soft);
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-3);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ============================================================
   App shell
   ============================================================ */

.app {
    display: grid;
    grid-template-rows: var(--topbar-h) 1fr var(--footer-h);
    height: 100vh;
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 18px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-mark svg {
    width: 18px;
    height: 18px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand-badge {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.topbar-center {
    flex: 1;
    min-width: 0;
    max-width: 640px;
    margin: 0 auto;
    position: relative;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 6px 6px 13px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
    width: 15px;
    height: 15px;
    color: var(--text-3);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    font-size: 13.5px;
}

.search-input::placeholder {
    color: var(--text-3);
}

.search-btn {
    flex-shrink: 0;
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 550;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    padding: 11px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-title {
    font-size: 13.5px;
    font-weight: 600;
}

.search-result-desc {
    font-size: 12px;
    color: var(--text-3);
    margin-top: 2px;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Status pill */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-2);
    transition: var(--transition);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
    transition: var(--transition);
}

.status-indicator.connected {
    color: var(--success);
    border-color: rgba(52, 211, 153, 0.35);
    background: var(--success-soft);
}

.status-indicator.connected .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.error {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.35);
    background: var(--danger-soft);
}

.status-indicator.error .status-dot {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.status-indicator.connecting {
    color: var(--warning);
}

.status-indicator.connecting .status-dot {
    background: var(--warning);
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.8); }
}

/* Language select */
.control-group {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.control-group:focus-within {
    border-color: var(--accent);
}

.control-icon {
    width: 14px;
    height: 14px;
    color: var(--text-3);
}

.lang-select {
    background: transparent;
    border: none;
    outline: none;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-2);
    cursor: pointer;
    padding-right: 2px;
}

.lang-select option {
    background: var(--bg-1);
    color: var(--text-1);
}

/* Theme toggle */
.icon-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    font-size: 15px;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-3);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

/* ============================================================
   Workspace
   ============================================================ */

.workspace {
    display: grid;
    grid-template-columns: var(--pane-left-w) 1fr var(--pane-right-w);
    gap: var(--gap);
    padding: var(--gap);
    min-height: 0;
    overflow: hidden;
}

.pane {
    min-height: 0;
    overflow-y: auto;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    scrollbar-gutter: stable;
}

.pane-left {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.pane-right {
    overflow-y: auto;
    padding: 0;
    position: relative;
}

.pane-center {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: var(--bg-0);
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    transition: border-color var(--transition);
}

.card.active {
    border-color: var(--accent-soft);
}

.panel-title {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 11px 18px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 13.5px;
    font-weight: 650;
    box-shadow: 0 4px 18px var(--accent-glow);
    transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary .btn-icon {
    width: 16px;
    height: 16px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 12.5px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn-secondary .btn-icon {
    width: 14px;
    height: 14px;
}

.btn-small {
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-small:hover {
    background: var(--bg-3);
    color: var(--text-1);
}

.btn-command {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 6px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 11.5px;
    font-weight: 550;
    color: var(--text-2);
    transition: var(--transition);
}

.btn-command:hover:not(:disabled) {
    background: var(--bg-3);
    border-color: var(--border-strong);
    color: var(--text-1);
    transform: translateY(-1px);
}

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

.btn-command .btn-icon {
    font-size: 16px;
    line-height: 1;
}

.btn-command.btn-danger:hover:not(:disabled) {
    background: var(--danger-soft);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--danger);
}

.btn-command.btn-warning:hover:not(:disabled) {
    background: var(--warning-soft);
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--warning);
}

.command-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* ============================================================
   Info grids
   ============================================================ */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.info-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
}

.info-value {
    font-size: 13px;
    font-weight: 550;
    color: var(--text-1);
    word-break: break-all;
}

/* Connect card */
.connect-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-color: var(--accent-soft);
}

.connect-hint {
    font-size: 11.5px;
    color: var(--text-3);
    text-align: center;
    line-height: 1.45;
}

/* ============================================================
   Stats
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

/* ============================================================
   Config
   ============================================================ */

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.config-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

.config-input,
.flash-input,
.flash-select {
    padding: 7px 10px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-1);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    transition: var(--transition);
}

.config-input:focus,
.flash-input:focus,
.flash-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.config-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ============================================================
   Progress
   ============================================================ */

.progress-card {
    margin-top: auto;
}

.progress-bar {
    height: 8px;
    background: var(--bg-3);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 0.25s var(--ease);
}

.progress-text {
    font-size: 11.5px;
    font-weight: 600;
    text-align: center;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Terminal (center pane)
   ============================================================ */

.terminal-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--bg-0);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
}

.terminal-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.terminal-tab {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-3);
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--border);
}

.terminal-tab.active {
    color: var(--accent);
    border-color: var(--accent-soft);
    background: var(--accent-soft);
}

.terminal-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-2);
    scroll-behavior: smooth;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 44px 44px;
    background-position: center top;
}

.terminal-line {
    padding: 1px 0;
    word-break: break-word;
    white-space: pre-wrap;
}

.terminal-line.success { color: var(--success); }
.terminal-line.error { color: var(--danger); }
.terminal-line.warning { color: var(--warning); }
.terminal-line.info { color: var(--info); }

/* Command bar */
.command-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
}

.command-prompt {
    width: 16px;
    height: 16px;
    color: var(--accent);
    flex-shrink: 0;
}

.command-input {
    flex: 1;
    min-width: 0;
    padding: 9px 13px;
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-1);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: var(--transition);
}

.command-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.command-input::placeholder {
    color: var(--text-3);
    font-family: var(--font-ui);
}

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

/* ============================================================
   Right pane
   ============================================================ */

.pane-right {
    display: flex;
    flex-direction: column;
}

.sidebar-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-3);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    color: var(--text-1);
    border-color: var(--border-strong);
}

.toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s var(--ease);
}

.pane-right.collapsed {
    display: none;
}

.sidebar-scroll {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

/* Command panels */
.commands-panel,
.flash-panel,
.partitions-panel,
.presets-panel {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
}

.commands-panel .panel-title,
.flash-panel .panel-title,
.partitions-panel .panel-title,
.presets-panel .panel-title {
    margin-bottom: 12px;
}

/* ============================================================
   Flash panel
   ============================================================ */

.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    background: var(--bg-1);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-2);
    transition: var(--transition);
}

.file-label:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.file-icon {
    font-size: 15px;
}

.file-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flash-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0;
}

.flash-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flash-option-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
}

.flash-input:disabled,
.flash-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.flash-actions {
    display: flex;
    gap: 8px;
}

.flash-actions .btn-secondary {
    flex: 1;
}

.flash-info {
    margin-top: 12px;
    padding: 4px 12px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.flash-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.flash-info-item:last-child {
    border-bottom: none;
}

.flash-info-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
}

.flash-info-value {
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Partitions
   ============================================================ */

.partitions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.partition-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 11px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: var(--transition);
}

.partition-item:hover {
    border-color: var(--border-strong);
}

.partition-name {
    font-weight: 600;
    font-family: var(--font-mono);
}

.partition-size {
    color: var(--text-3);
    font-size: 11px;
}

.partition-actions {
    display: flex;
    gap: 5px;
}

.partition-action-btn {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 10.5px;
    font-weight: 600;
    transition: var(--transition);
}

.partition-action-btn:hover {
    background: var(--danger-soft);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--danger);
}

/* ============================================================
   Presets
   ============================================================ */

.presets-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.preset-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 11px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.preset-item:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.preset-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-1);
}

.preset-desc {
    font-size: 10px;
    color: var(--text-3);
    line-height: 1.35;
}

/* ============================================================
   Sidebar info lists
   ============================================================ */

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-section .panel-title {
    margin-top: 16px;
}

.sidebar-section .panel-title:first-child {
    margin-top: 0;
}

.variables-list,
.properties-list,
.capabilities-list,
.recent-commands-list,
.saved-devices-list,
.history-list,
.system-logs-list,
.errors-list,
.partitions-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 170px;
    overflow-y: auto;
}

.variable-item,
.property-item,
.capability-item,
.recent-command-item,
.saved-device-item,
.history-item,
.system-log-item,
.error-item,
.partition-sidebar-item {
    padding: 7px 10px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    transition: var(--transition);
}

.var-name,
.prop-name,
.cap-name,
.recent-command-text,
.saved-device-name,
.history-text,
.system-log-text,
.error-text,
.partition-sidebar-name {
    color: var(--text-2);
    word-break: break-all;
}

.var-value,
.prop-value {
    display: block;
    margin-top: 2px;
    color: var(--text-1);
    font-weight: 550;
    word-break: break-all;
    font-family: var(--font-mono);
    font-size: 11px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.history-text {
    font-family: var(--font-mono);
    font-size: 11px;
}

.history-time {
    color: var(--text-3);
    font-size: 9.5px;
}

.history-status {
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.history-status.success { background: var(--success-soft); color: var(--success); }
.history-status.error { background: var(--danger-soft); color: var(--danger); }
.history-status.warning { background: var(--warning-soft); color: var(--warning); }

.error-item {
    background: var(--danger-soft);
    border-color: rgba(248, 113, 113, 0.3);
}

.error-text {
    color: var(--danger);
}

.system-log-item.success {
    background: var(--success-soft);
    border-color: rgba(52, 211, 153, 0.3);
}

.system-log-item.error {
    background: var(--danger-soft);
    border-color: rgba(248, 113, 113, 0.3);
}

.system-log-item.warning {
    background: var(--warning-soft);
    border-color: rgba(251, 191, 36, 0.3);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-3);
}

.footer-badge {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-weight: 650;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.72);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--bg-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 860px;
    width: min(92vw, 860px);
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.25s var(--ease);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 15px;
    font-weight: 650;
}

.modal-close {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ============================================================
   Markdown content
   ============================================================ */

.markdown-content {
    color: var(--text-2);
    line-height: 1.7;
    font-size: 13.5px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    color: var(--text-1);
    margin: 20px 0 10px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.markdown-content h1 { font-size: 21px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.markdown-content h2 { font-size: 17px; }
.markdown-content h3 { font-size: 15px; }

.markdown-content p { margin-bottom: 10px; }
.markdown-content ul, .markdown-content ol { margin-bottom: 10px; padding-left: 20px; }
.markdown-content li { margin-bottom: 4px; }

.markdown-content code {
    background: var(--bg-3);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
}

.markdown-content pre {
    background: var(--bg-0);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.markdown-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-1);
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--text-3);
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}

.markdown-content th,
.markdown-content td {
    padding: 8px 10px;
    text-align: left;
    border: 1px solid var(--border);
    font-size: 12.5px;
}

.markdown-content th {
    background: var(--bg-2);
    color: var(--text-1);
}

.markdown-content a {
    color: var(--accent);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content .bash { color: var(--success); }
.markdown-content .comment { color: var(--text-3); font-style: italic; }
.markdown-content .command { color: var(--accent); font-weight: 650; }
.markdown-content .option { color: var(--info); }
.markdown-content .variable { color: var(--accent-2); }
.markdown-content .file { color: var(--success); }

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-3);
}

.loading::after {
    content: "";
    width: 18px;
    height: 18px;
    margin-left: 10px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--danger);
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.browser-info,
.security-info {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 6px 0;
    font-size: 12px;
}

.browser-info p,
.security-info p {
    color: var(--text-1);
    font-weight: 600;
    margin-bottom: 6px;
}

.browser-info ul,
.security-info ul {
    list-style: none;
    padding: 0;
}

.browser-info li,
.security-info li {
    color: var(--text-3);
    padding: 2px 0 2px 14px;
    position: relative;
}

.browser-info li::before,
.security-info li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1180px) {
    .workspace {
        grid-template-columns: 272px 1fr;
    }
    .pane-right {
        position: fixed;
        right: 14px;
        top: calc(var(--topbar-h) + 14px);
        bottom: calc(var(--footer-h) + 14px);
        width: 340px;
        box-shadow: var(--shadow-lg);
        z-index: 50;
        transform: translateX(0);
        transition: transform 0.3s var(--ease);
    }
    .pane-right.collapsed {
        display: block;
        transform: translateX(calc(100% + 14px));
        pointer-events: none;
    }
}

@media (max-width: 860px) {
    :root {
        --pane-left-w: 100%;
    }
    body {
        overflow: auto;
    }
    .app {
        height: auto;
        min-height: 100vh;
        grid-template-rows: auto auto auto;
    }
    .workspace {
        display: flex;
        flex-direction: column;
        overflow: visible;
        height: auto;
    }
    .pane {
        overflow: visible;
        max-height: none;
    }
    .pane-center {
        height: 62vh;
        min-height: 420px;
    }
    .topbar {
        flex-wrap: wrap;
        padding: 10px 14px;
        gap: 10px;
    }
    .topbar-center {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }
    .command-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    .info-grid,
    .stats-grid,
    .config-grid,
    .presets-list,
    .flash-options {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 13px;
    }
    .status-indicator {
        padding: 6px 10px;
        font-size: 11px;
    }
    .info-grid,
    .stats-grid,
    .config-grid,
    .presets-list {
        grid-template-columns: 1fr;
    }
    .terminal-content {
        font-size: 11.5px;
    }
}
