/* Launis v3 Dashboard — Components */

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}
.btn-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-close:hover {
    background: var(--error-bg);
    color: var(--error);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    line-height: 1.5;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error   { background: var(--error-bg);   color: var(--error); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: var(--muted-bg);   color: var(--text-muted); }
.badge-accent  { background: var(--accent-subtle); color: var(--accent); }
.badge-system  { background: rgba(120, 120, 140, 0.15); color: #8b8fa3; }

.badge-sm {
    padding: 1px 5px;
    font-size: 10px;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 16px;
}

.card-body-dense {
    padding: 12px 16px;
}

/* Stat cards */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.15s;
}
.stat-card:hover {
    border-color: var(--border-light);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

.stat-change {
    font-size: 11px;
    margin-top: 6px;
}

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

thead th {
    padding: 8px 10px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tbody tr {
    transition: background 0.1s;
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Clickable rows */
tbody tr.clickable {
    cursor: pointer;
}

/* Flash animation for SSE updates */
@keyframes row-flash {
    0% { background: var(--accent-subtle); }
    100% { background: transparent; }
}
tbody tr.flash {
    animation: row-flash 1.5s ease;
}

/* Copyable cells */
td.copyable {
    cursor: pointer;
    position: relative;
}
td.copyable:hover {
    background: var(--bg-hover);
}
td.copyable.copied::after {
    content: 'Copied!';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    animation: copied-fade 1s ease forwards;
}
@keyframes copied-fade {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Cell helpers */
.cell-truncate {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-customer {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}
.cell-customer .name {
    font-weight: 500;
}
.cell-customer .number {
    font-size: 11px;
    color: var(--text-muted);
}

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

.cell-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.pagination-info {
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- Inputs ---- */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
select {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

select {
    cursor: pointer;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal[hidden] {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-height: 95vh;
    overflow: hidden;
}

.modal-fullscreen {
    width: 95vw;
    height: 95vh;
}

.modal-md {
    width: 560px;
    max-width: 95vw;
}

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

.modal-header h2 {
    font-size: 14px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    overflow: auto;
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    line-height: 1.5;
    animation: toast-in 0.3s ease;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.removing {
    opacity: 0;
    transform: translateX(20px);
}

.toast-info    { border-left: 3px solid var(--info); }
.toast-success { border-left: 3px solid var(--success); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-error   { border-left: 3px solid var(--error); }

.toast-message { flex: 1; }

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- Definition list ---- */
.dl-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    font-size: 12px;
}

.dl-grid dt {
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.dl-grid dd {
    word-break: break-word;
}

/* ---- Timeline ---- */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}

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

.timeline-time {
    flex-shrink: 0;
    width: 130px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.timeline-msg {
    flex: 1;
    word-break: break-word;
}

.timeline-context {
    margin-top: 4px;
}

.timeline-context summary {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.timeline-context pre {
    margin-top: 4px;
    font-size: 11px;
    padding: 8px;
    border-radius: 4px;
    background: var(--code-bg);
    overflow-x: auto;
    max-height: 200px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

/* ---- JSON tree ---- */
.json-tree {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: var(--code-bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.json-key { color: var(--accent); }
.json-string { color: var(--success); }
.json-number { color: var(--warning); }
.json-bool { color: #c084fc; }
.json-null { color: var(--text-muted); }

.json-toggle {
    cursor: pointer;
    user-select: none;
}
.json-toggle::before {
    content: '\25BC';
    display: inline-block;
    width: 12px;
    font-size: 10px;
    transition: transform 0.15s;
}
.json-toggle.collapsed::before {
    transform: rotate(-90deg);
}
.json-children.hidden {
    display: none;
}
.json-collapsed-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* ---- Comparison view ---- */
.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.comparison-col h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ---- Misc ---- */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-accent { color: var(--accent); }

.mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
}

.link {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
.link:hover {
    text-decoration: underline;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.pre-wrap {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 12px;
    background: var(--code-bg);
    padding: 12px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
}

/* Checkbox filter */
.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.check-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transition: all 0.15s;
}
.check-group label:hover {
    background: var(--bg-hover);
}
.check-group input[type="checkbox"] {
    width: 12px;
    height: 12px;
    margin: 0;
}

/* ---- Logs table ---- */
.table-logs tbody td {
    white-space: normal;
    max-width: none;
}

.table-logs .col-time {
    width: 90px;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.table-logs .col-level,
.table-logs .col-stage {
    width: 60px;
    white-space: nowrap;
}

.table-logs .col-order {
    width: 50px;
    white-space: nowrap;
}

.table-logs .col-message {
    word-break: break-word;
}

/* Log context — always visible, bold keys */
.log-context {
    margin-top: 6px;
    font-size: 11px;
    padding: 8px;
    border-radius: 4px;
    background: var(--code-bg);
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.log-context .json-key {
    font-weight: 700;
    color: var(--accent);
}

/* ---- Picking Instructions ---- */
.picking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.picking-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.picking-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.picking-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.picking-date-input {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
}

.picking-progress {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.picking-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.picking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.picking-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, opacity 0.2s;
}

.picking-card-done {
    opacity: 0.5;
    border-color: var(--success);
}

.picking-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.picking-card-bc {
    font-size: 18px;
    font-weight: 700;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.picking-card-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.picking-card-customer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.picking-card-name {
    font-weight: 600;
    font-size: 14px;
}

.picking-card-num,
.picking-card-po {
    font-size: 11px;
    color: var(--text-muted);
}

.picking-card-address {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.picking-card-lines table {
    width: 100%;
    font-size: 12px;
}

.picking-card-lines thead th {
    font-size: 10px;
    padding: 4px 8px;
}

.picking-card-lines tbody td {
    padding: 3px 8px;
    white-space: nowrap;
}

.picking-card-notes {
    background: var(--code-bg);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
}

.picking-card-notes-label {
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
}

.picking-card-notes-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-secondary);
}

.picking-card-toggle {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.picking-card-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.picking-card-toggle.picking-toggled {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

.picking-card-toggle:disabled {
    opacity: 0.5;
    cursor: wait;
}

.picking-card-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 768px) {
    .picking-grid {
        grid-template-columns: 1fr;
    }
    .picking-title {
        font-size: 20px;
    }
}

/* ---- Config ---- */
.config-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.config-row:last-child {
    border-bottom: none;
}

.config-label-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.config-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.config-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.config-description {
    font-size: 11px;
    margin-top: 8px;
}

.config-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.config-modified {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}

/* Info icon (i) */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.info-icon:hover {
    background: var(--accent);
    color: #fff;
}

/* Tooltip (positioned by JS) */
.config-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 380px;
    padding: 12px 14px;
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border, #333);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.config-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
}

.config-tooltip pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-secondary, #ccc);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Environment toggle */
.config-env-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.config-env-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.env-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.env-option {
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.env-option:first-child {
    border-right: 1px solid var(--border);
}

.env-option:hover {
    background: var(--bg-hover);
}

.env-option.env-active.env-sandbox {
    background: var(--info-bg);
    color: var(--info);
}

.env-option.env-active.env-production {
    background: var(--warning-bg);
    color: var(--warning);
}

.env-description {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* Toggle switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
    left: 19px;
    background: #fff;
}

.toggle-label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 22px;
}

/* ---- Terminal ---- */
.terminal-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.terminal-body {
    flex: 1;
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.terminal-output {
    flex: 1;
}

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

.terminal-cmd {
    color: #58a6ff;
    font-weight: 600;
}

.terminal-stdout {
    color: #c9d1d9;
}

.terminal-error {
    color: #f85149;
}

.terminal-exit-error {
    color: #d29922;
    font-size: 11px;
}

.terminal-info {
    color: #8b949e;
    font-style: italic;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.terminal-prompt {
    color: #7ee787;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #c9d1d9;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
    caret-color: #58a6ff;
}

.terminal-input:focus {
    border: none;
    box-shadow: none;
}

/* ---- Danger button ---- */
.btn-danger {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
}
.btn-danger:hover {
    opacity: 0.85;
}

/* ---- Cron ---- */
.actions-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.cron-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
}

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

.cron-schedule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cron-mode-toggle {
    display: flex;
    gap: 4px;
}

.cron-simple-grid {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.cron-simple-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.cron-simple-field label {
    font-size: 12px;
    color: var(--text-muted);
}

.cron-preview {
    margin-top: 6px;
    font-size: 12px;
    min-height: 18px;
}

/* ---- Config unsaved status ---- */
.config-status-unsaved {
    color: var(--warning);
    font-weight: 600;
    font-size: 12px;
}

/* ---- File Browser ---- */
.file-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.file-crumb {
    color: var(--accent);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
}
.file-crumb:hover {
    background: var(--accent-subtle);
    text-decoration: none;
}

.file-crumb-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

.file-crumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

.file-entry-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.file-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

/* File viewer */
.file-viewer {
    display: flex;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    max-height: calc(100vh - 160px);
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.file-viewer-lines {
    display: flex;
    flex-direction: column;
    padding: 12px 12px 12px 16px;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1.6;
    opacity: 0.5;
}

.file-viewer-code {
    flex: 1;
    margin: 0;
    padding: 12px 16px;
    overflow-x: auto;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre;
    background: transparent;
    tab-size: 4;
}

/* ---- Block Art ---- */
.blockart {
    font-family: monospace;
    line-height: 1;
    letter-spacing: 0;
    white-space: pre;
    color: #D42027;
    font-size: 8px;
    text-align: center;
    user-select: none;
    margin: 0;
    padding: 0;
    background: transparent;
}

.blockart-lg {
    font-size: 10px;
}

@media (max-width: 600px) {
    .blockart { font-size: 5px; }
    .blockart-lg { font-size: 6px; }
}

/* ---- Multi-order groups ---- */
tr.multi-parent {
    border-left: 3px solid var(--accent);
}
tr.multi-parent td:first-child {
    padding-left: 8px;
}

.expand-toggle {
    display: inline-block;
    width: 16px;
    font-size: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform 0.15s;
    user-select: none;
    vertical-align: middle;
}

tr.child-row {
    border-left: 3px solid var(--border);
    background: var(--bg-secondary);
}
tr.child-row td:first-child {
    padding-left: 28px;
}

.child-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
}
