/* ═══════════════════════════════════════════════════════════════
   WorldServer 热重载管理后台 - Styles
   Dark theme with game admin panel aesthetics
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Color Palette */
    --bg-darkest: #0d1117;
    --bg-darker: #161b22;
    --bg-dark: #1c2128;
    --bg-medium: #21262d;
    --bg-light: #2d333b;
    --bg-lighter: #373e47;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-accent: #58a6ff;

    --accent-blue: #58a6ff;
    --accent-blue-bg: rgba(56, 139, 253, 0.15);
    --accent-green: #3fb950;
    --accent-green-bg: rgba(63, 185, 80, 0.15);
    --accent-orange: #d29922;
    --accent-orange-bg: rgba(210, 153, 34, 0.15);
    --accent-red: #f85149;
    --accent-red-bg: rgba(248, 81, 73, 0.15);
    --accent-purple: #bc8cff;
    --accent-purple-bg: rgba(188, 140, 255, 0.15);

    --border-default: #30363d;
    --border-muted: #21262d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(56, 139, 253, 0.15);
    --shadow-glow-green: 0 0 20px rgba(63, 185, 80, 0.15);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --transition: 0.2s ease;

    --sidebar-width: 280px;
    --header-height: 52px;
    --toolbar-height: 46px;
    --statusbar-height: 28px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', 'Monaco', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-darkest);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ─── Header ──────────────────────────────────────────────────── */
#header {
    height: var(--header-height);
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 22px;
    animation: flame 2s ease-in-out infinite;
}

@keyframes flame {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.1); filter: brightness(1.3); }
}

.logo h1 {
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

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

.file-path {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--bg-medium);
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Main Layout ─────────────────────────────────────────────── */
#main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-darker);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-default);
}

.sidebar-header h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.file-tree::-webkit-scrollbar {
    width: 6px;
}

.file-tree::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 3px;
}

.file-tree::-webkit-scrollbar-track {
    background: transparent;
}

.tree-category {
    margin-bottom: 4px;
}

.tree-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition);
    user-select: none;
}

.tree-category-header:hover {
    color: var(--text-primary);
}

.tree-category-header .arrow {
    transition: transform var(--transition);
    font-size: 10px;
}

.tree-category-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.tree-category-files {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tree-category-files.collapsed {
    max-height: 0 !important;
}

.tree-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px 7px 32px;
    cursor: pointer;
    transition: all var(--transition);
    border-left: 2px solid transparent;
    position: relative;
}

.tree-file:hover {
    background: var(--bg-medium);
}

.tree-file.active {
    background: var(--accent-blue-bg);
    border-left-color: var(--accent-blue);
}

.tree-file .file-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.tree-file .file-info {
    flex: 1;
    min-width: 0;
}

.tree-file .file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-file .file-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.tree-file .file-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tree-file .file-status.exists {
    background: var(--accent-green);
}

.tree-file .file-status.missing {
    background: var(--accent-red);
}

/* ─── Editor Area ─────────────────────────────────────────────── */
#editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Toolbar ─────────────────────────────────────────────────── */
#toolbar {
    height: var(--toolbar-height);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.separator {
    width: 1px;
    height: 24px;
    background: var(--border-default);
    margin: 0 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-medium);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--bg-lighter);
    border-color: var(--bg-lighter);
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

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

.btn-icon {
    font-size: 14px;
}

.btn-primary {
    background: rgba(56, 139, 253, 0.2);
    border-color: rgba(56, 139, 253, 0.3);
    color: var(--accent-blue);
}
.btn-primary:hover:not(:disabled) {
    background: rgba(56, 139, 253, 0.3);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow-blue);
}

.btn-warning {
    background: rgba(210, 153, 34, 0.2);
    border-color: rgba(210, 153, 34, 0.3);
    color: var(--accent-orange);
}
.btn-warning:hover:not(:disabled) {
    background: rgba(210, 153, 34, 0.3);
    border-color: var(--accent-orange);
}

.btn-danger {
    background: rgba(248, 81, 73, 0.15);
    border-color: rgba(248, 81, 73, 0.3);
    color: var(--accent-red);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(248, 81, 73, 0.25);
    border-color: var(--accent-red);
}

.btn-secondary {
    background: var(--bg-medium);
    border-color: var(--border-default);
    color: var(--text-secondary);
}

.btn-success {
    background: rgba(63, 185, 80, 0.2);
    border-color: rgba(63, 185, 80, 0.3);
    color: var(--accent-green);
}
.btn-success:hover:not(:disabled) {
    background: rgba(63, 185, 80, 0.3);
    border-color: var(--accent-green);
    box-shadow: var(--shadow-glow-green);
}

/* ─── Welcome Screen ──────────────────────────────────────────── */
#welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content > p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 36px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.feature-card {
    background: var(--bg-darker);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    transition: all 0.3s ease;
}

.feature-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-blue);
}

.feature-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 12px;
}

.feature-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-card p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ─── Editor Container ────────────────────────────────────────── */
#editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* CodeMirror overrides */
.CodeMirror {
    height: 100% !important;
    font-family: var(--font-mono) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background: var(--bg-darkest) !important;
}

.CodeMirror-gutters {
    background: var(--bg-darker) !important;
    border-right: 1px solid var(--border-default) !important;
}

.CodeMirror-linenumber {
    color: var(--text-muted) !important;
    padding: 0 8px 0 12px !important;
}

.CodeMirror-cursor {
    border-left-color: var(--accent-blue) !important;
    border-left-width: 2px !important;
}

.CodeMirror-activeline-background {
    background: rgba(56, 139, 253, 0.07) !important;
}

.CodeMirror-selected {
    background: rgba(56, 139, 253, 0.2) !important;
}

.CodeMirror-matchingbracket {
    color: var(--accent-green) !important;
    border-bottom: 1px solid var(--accent-green) !important;
    background: rgba(63, 185, 80, 0.1) !important;
}

/* ─── Status Bar ──────────────────────────────────────────────── */
#statusbar {
    height: var(--statusbar-height);
    background: var(--bg-darker);
    border-top: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.statusbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

#file-modified {
    color: var(--accent-orange);
    font-weight: 600;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hidden {
    display: none !important;
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-dark);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-lighter);
    color: var(--text-primary);
}

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

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Hotfix modal textarea */
.hotfix-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 12px;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
    line-height: 1.6;
}

.hotfix-textarea:focus {
    border-color: var(--accent-blue);
}

.hotfix-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}

/* Backup list */
.backup-list {
    list-style: none;
}

.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.backup-item:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-bg);
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

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

.backup-actions {
    display: flex;
    gap: 6px;
}

.backup-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
}

/* No backups message */
.no-backups {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-backups-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

/* ─── Toast ───────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-dark);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    min-width: 280px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.removing {
    opacity: 0;
    transform: translateX(100%);
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast.success {
    border-color: rgba(63, 185, 80, 0.4);
    background: linear-gradient(135deg, var(--bg-dark), rgba(63, 185, 80, 0.08));
}

.toast.error {
    border-color: rgba(248, 81, 73, 0.4);
    background: linear-gradient(135deg, var(--bg-dark), rgba(248, 81, 73, 0.08));
}

.toast.warning {
    border-color: rgba(210, 153, 34, 0.4);
    background: linear-gradient(135deg, var(--bg-dark), rgba(210, 153, 34, 0.08));
}

.toast.info {
    border-color: rgba(56, 139, 253, 0.4);
    background: linear-gradient(135deg, var(--bg-dark), rgba(56, 139, 253, 0.08));
}

/* ─── Loading ─────────────────────────────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 0.8s linear infinite;
}

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

/* ─── Confirm dialog styles ───────────────────────────────────── */
.confirm-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.confirm-detail {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-darkest);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

/* ─── Table Editor ────────────────────────────────────────────── */
#table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-darkest);
}

#table-container::-webkit-scrollbar {
    width: 8px;
}
#table-container::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 4px;
}
#table-container::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 10;
}
.table-toolbar-left, .table-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.table-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.table-badge-table {
    background: rgba(188, 140, 255, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(188, 140, 255, 0.3);
}
.table-file-path {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Section */
.table-section {
    margin: 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-darker);
    overflow: hidden;
}
.table-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-default);
}
.table-section-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.table-row-count {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-medium);
    border-radius: 10px;
}
.table-section-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.table-search {
    padding: 4px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-darkest);
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-sans);
    outline: none;
    width: 160px;
    transition: border-color var(--transition);
}
.table-search:focus {
    border-color: var(--accent-blue);
}
.table-search::placeholder {
    color: var(--text-muted);
}

/* Wrapper */
.table-wrapper {
    overflow-x: auto;
}
.table-wrapper::-webkit-scrollbar {
    height: 6px;
}
.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 3px;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-medium);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-default);
    white-space: nowrap;
    user-select: none;
}
.data-table tbody tr {
    border-bottom: 1px solid var(--border-muted);
    transition: background var(--transition);
}
.data-table tbody tr:hover {
    background: rgba(56, 139, 253, 0.04);
}
.data-table tbody td {
    padding: 4px 8px;
    vertical-align: middle;
}

/* Row number */
.row-num {
    width: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
}

/* Cell styles */
.cell-readonly {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
    padding-left: 12px !important;
}
.cell-editable {
    padding: 2px 4px !important;
}
.cell-input {
    width: 100%;
    min-width: 60px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition);
}
.cell-input:hover {
    background: var(--bg-medium);
    border-color: var(--border-default);
}
.cell-input:focus {
    background: var(--bg-darkest);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.15);
}
.cell-input-number {
    font-family: var(--font-mono);
    text-align: right;
    min-width: 80px;
}
.cell-input-number::-webkit-inner-spin-button {
    opacity: 0;
}
.cell-input-number:hover::-webkit-inner-spin-button,
.cell-input-number:focus::-webkit-inner-spin-button {
    opacity: 1;
}
.cell-input-array {
    font-family: var(--font-mono);
    min-width: 100px;
}

/* Modified cell */
.cell-modified {
    position: relative;
}
.cell-modified::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-orange);
}
.cell-modified .cell-input {
    border-color: rgba(210, 153, 34, 0.4);
    background: rgba(210, 153, 34, 0.06);
}

/* Row actions */
.row-actions {
    width: 48px;
    text-align: center;
}
.table-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: background var(--transition);
    opacity: 0.4;
}
.data-table tbody tr:hover .table-btn-icon {
    opacity: 1;
}
.table-btn-icon:hover {
    background: var(--accent-red-bg);
}

/* Table buttons */
.table-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-medium);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}
.table-btn:hover {
    background: var(--bg-lighter);
}
.table-btn-secondary {
    color: var(--text-secondary);
}
.table-btn-small {
    padding: 3px 10px;
    font-size: 11px;
}
.table-btn-add {
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.3);
    color: var(--accent-green);
}
.table-btn-add:hover {
    background: rgba(63, 185, 80, 0.2);
    border-color: var(--accent-green);
}

/* Badge in file tree */
.badge-table {
    display: inline-block;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    background: rgba(188, 140, 255, 0.2);
    color: var(--accent-purple);
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Key-Value Form */
.kv-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1px;
    background: var(--border-muted);
    padding: 0;
}
.kv-item {
    padding: 12px 16px;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.kv-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.kv-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-darkest);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color var(--transition);
}
.kv-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.15);
}
.kv-input-number {
    text-align: right;
}
.kv-readonly {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
    padding: 6px 10px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    font-style: italic;
}
.kv-comment {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}
.kv-item.cell-modified {
    border-left: 3px solid var(--accent-orange);
}
.kv-item.cell-modified .kv-input {
    border-color: rgba(210, 153, 34, 0.4);
    background: rgba(210, 153, 34, 0.06);
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 220px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .header-center {
        display: none;
    }
}

/* ─── AI Chat Panel ───────────────────────────────────────────── */
.ai-panel {
    position: fixed;
    bottom: 0;
    right: 24px;
    width: 380px;
    background: var(--bg-darker);
    border: 1px solid var(--border-default);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: height 0.3s ease;
    overflow: hidden;
}

.ai-panel.collapsed {
    height: 44px;
}

.ai-panel:not(.collapsed) {
    height: 480px;
}

.ai-panel-header {
    height: 44px;
    min-height: 44px;
    background: linear-gradient(135deg, #1a1b2e, #232540);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    padding: 0 16px;
    cursor: pointer;
    user-select: none;
}

.ai-icon {
    font-size: 16px;
    margin-right: 8px;
}

.ai-title {
    font-weight: 600;
    font-size: 13px;
    flex: 1;
    color: var(--text-bright);
}

.ai-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.ai-panel.collapsed .ai-toggle-btn {
    transform: rotate(180deg);
}

.ai-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-msg {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-msg.system {
    background: rgba(56, 139, 253, 0.08);
    color: var(--text-default);
    border-left: 3px solid var(--accent-blue);
    align-self: flex-start;
    font-size: 12px;
}

.ai-msg.user {
    background: rgba(56, 139, 253, 0.15);
    color: var(--text-bright);
    align-self: flex-end;
    border-radius: 6px 6px 2px 6px;
}

.ai-msg.assistant {
    background: var(--bg-dark);
    color: var(--text-default);
    border: 1px solid var(--border-default);
    align-self: flex-start;
    border-radius: 6px 6px 6px 2px;
}

.ai-msg.error {
    background: rgba(248, 81, 73, 0.1);
    color: var(--accent-red);
    border-left: 3px solid var(--accent-red);
    align-self: flex-start;
    font-size: 12px;
}

.ai-input-area {
    padding: 10px 12px;
    border-top: 1px solid var(--border-default);
    display: flex;
    gap: 8px;
    background: var(--bg-dark);
}

.ai-input-area textarea {
    flex: 1;
    background: var(--bg-darkest);
    border: 1px solid var(--border-default);
    color: var(--text-default);
    border-radius: 4px;
    padding: 8px 10px;
    resize: none;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.ai-input-area textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.15);
}

.ai-input-area .btn {
    align-self: flex-end;
    padding: 8px 12px;
}

.ai-actions {
    padding: 6px 12px 10px;
    background: var(--bg-dark);
    display: flex;
    gap: 8px;
}

.btn-sm {
    padding: 4px 10px !important;
    font-size: 11px !important;
    border-radius: 4px;
}

/* ─── AI Settings Modal Form ──────────────────────────────────── */
.modal-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-default);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-darkest);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    color: var(--text-default);
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.15);
}
