:root {
    --background: #f3f5f8;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #dfe5ee;
    --text: #172033;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #14804a;
    --danger: #c2410c;
    --warning: #b7791f;
    --shadow: 0 20px 45px rgba(15, 23, 42, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--background);
}

button,
input,
select {
    font: inherit;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(100%, 440px);
}

.login-card {
    width: 100%;
    padding: 40px;
    border: 1px solid rgba(223, 229, 238, 0.8);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.brand-mark {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.brand-mark img {
    width: 132px;
    max-height: 70px;
    object-fit: contain;
}

.login-heading {
    margin-bottom: 28px;
    text-align: center;
}

.login-heading h1 {
    margin: 0 0 8px;
    font-size: 1.85rem;
    line-height: 1.2;
}

.login-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.94rem;
}

.flash-error {
    border: 1px solid #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.flash-success {
    border: 1px solid #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form label {
    color: #334155;
    font-size: 0.92rem;
    font-weight: 650;
}

.login-form input {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text);
    background: #ffffff;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.78;
    transform: none;
}

.button-full {
    width: 100%;
    margin-top: 8px;
}

.button-primary {
    background: var(--primary);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    color: #334155;
    border: 1px solid var(--border);
    background: #ffffff;
}

.button-success {
    background: var(--success);
}

.button-danger {
    background: var(--danger);
}

.button-warning {
    background: var(--warning);
}

.dashboard-page {
    min-height: 100vh;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
}

.topbar-inner,
.dashboard-shell {
    width: min(1320px, calc(100% - 48px));
    margin: 0 auto;
}

.topbar-inner {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-brand img {
    width: 180px;
    max-height: 68px;
    object-fit: contain;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-name {
    max-width: 180px;
    overflow: hidden;
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-icon {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    color: #ff1717;
    background: transparent;
    cursor: pointer;
}

.logout-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logout-icon:hover {
    color: #d90000;
}

.dashboard-shell {
    padding: 52px 0 76px;
}

/* ── Home view ── */
.home-header {
    margin-bottom: 44px;
}

.home-header h1 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.1;
}

.home-sub {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

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

.nav-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
    min-height: 116px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.nav-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    border-color: #c7d2fe;
}

.nav-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.nav-card-icon svg {
    width: 24px;
    height: 24px;
}

.nc-green  { background: #dcfce7; color: #16a34a; }
.nc-blue   { background: #dbeafe; color: #2563eb; }
.nc-purple { background: #ede9fe; color: #7c3aed; }
.nc-orange { background: #ffedd5; color: #ea580c; }
.nc-rose   { background: #ffe4e6; color: #e11d48; }
.nc-teal   { background: #ccfbf1; color: #0d9488; }
.nc-indigo { background: #e0e7ff; color: #4338ca; }
.nc-amber  { background: #fef3c7; color: #b45309; }

.nav-card-body {
    flex: 1;
}

.nav-card-body h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.nav-card-body p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.55;
}

.nav-card-arrow {
    flex-shrink: 0;
    font-size: 1.4rem;
    color: #94a3b8;
    margin-top: 2px;
    transition: transform 140ms ease, color 140ms ease;
}

.nav-card:hover .nav-card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}

/* ── Section view ── */
.section-view {
    width: 100%;
}

.section-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 650;
    background: var(--surface);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

.back-btn:hover {
    background: #f1f5f9;
    border-color: #b0bdd0;
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.section-path {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.action-card {
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 26px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.action-card h2 {
    margin: 0 0 10px;
    font-size: 1.18rem;
}

.action-card p {
    max-width: 46ch;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

.dashboard-card {
    width: 100%;
    min-height: 330px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.card-heading h2 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1.25;
}

.card-heading p {
    max-width: 720px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.6;
}

.control-row {
    display: grid;
    gap: 10px;
    width: min(100%, 520px);
}

.field-label {
    color: #334155;
    font-size: 0.98rem;
    font-weight: 750;
}

.dashboard-select {
    width: 100%;
    min-height: 54px;
    padding: 13px 42px 13px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: var(--text);
    background-color: #ffffff;
    outline: none;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.dashboard-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 2px;
    width: 100%;
}

.action-list[hidden],
.toast[hidden],
.modal-backdrop[hidden],
.davinci-clock[hidden] {
    display: none;
}

.dashboard-card .button {
    min-width: 180px;
    min-height: 50px;
    padding: 13px 22px;
}

.toast {
    position: fixed;
    top: 96px;
    right: 24px;
    z-index: 30;
    width: min(420px, calc(100% - 48px));
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 650;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
}

.toast-success {
    border: 1px solid #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.toast-error {
    border: 1px solid #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.spinner {
    width: 16px;
    height: 16px;
    display: none;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: spin 700ms linear infinite;
}

.is-loading .spinner {
    display: inline-block;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
}

.modal-dialog {
    width: min(100%, 440px);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.modal-dialog h2 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    line-height: 1.2;
}

.modal-dialog p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .button {
    min-width: 96px;
}

/* ── Logs viewer ── */
.logs-viewer {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    height: 520px;
    width: 100%;
}

.logs-sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: #f8fafc;
    overflow: hidden;
}

.logs-divider {
    width: 5px;
    flex-shrink: 0;
    background: var(--border);
    cursor: col-resize;
    transition: background 120ms ease;
}

.logs-divider:hover,
.logs-divider.dragging {
    background: var(--primary);
}

.logs-sidebar-header {
    padding: 11px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logs-file-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.logs-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logs-select-row .dashboard-select {
    flex: 1;
}

.logs-refresh-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 18px;
    height: 54px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
    white-space: nowrap;
}

.logs-refresh-btn:hover { background: #f1f5f9; border-color: #b0bdd0; }

.logs-refresh-btn svg { width: 15px; height: 15px; }

.logs-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background 100ms ease;
}

.logs-file-item:hover  { background: #eef2f7; }
.logs-file-item.active { background: #eff6ff; }

.logs-file-icon { flex-shrink: 0; font-size: 13px; }

.logs-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.logs-file-name {
    font-size: 0.86rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logs-file-item.active .logs-file-name { color: var(--primary); font-weight: 600; }

.logs-file-date {
    font-size: 0.72rem;
    color: var(--muted);
}

.logs-file-size {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.logs-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.logs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    flex-shrink: 0;
}

.logs-panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logs-lines-select {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    outline: none;
}

.logs-lines-select:focus {
    border-color: var(--accent);
}

/* ── Thunar-style browser ── */
.ed-browser {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100vh - 340px);
    min-height: 300px;
}

.ed-breadcrumb {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 40px;
    gap: 8px;
}

.ed-bc-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.ed-bc-search {
    flex-shrink: 0;
    width: 260px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #101828;
    background: #fff;
    outline: none;
}

.ed-bc-search:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 2px rgba(8,145,178,0.15);
}

.ed-bc-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #0891b2;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
}

.ed-bc-btn:hover {
    background: #e0f2fe;
    text-decoration: underline;
}

.ed-bc-sep {
    color: #94a3b8;
    font-size: 0.9rem;
    padding: 0 2px;
    user-select: none;
}

.ed-bc-current {
    color: #101828;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 6px;
}

/* ── Thunar list wrapper ── */
.ed-list-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
}

.ed-list-header {
    display: grid;
    grid-template-columns: 1fr 90px 140px 160px;
    padding: 7px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ed-list-header span { white-space: nowrap; overflow: hidden; }

.ed-grid-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.ed-grid {
    display: flex;
    flex-direction: column;
}

.ed-row {
    display: grid;
    grid-template-columns: 1fr 90px 140px 160px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    transition: background 0.1s;
    border-left: none;
    border-right: none;
    border-top: none;
}

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

.ed-row-folder {
    cursor: pointer;
}

.ed-row-folder:hover { background: #eff6ff; }

.ed-row-file { cursor: default; }
.ed-row-file:hover { background: #f8fafc; }

.ed-col-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #101828;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ed-row-icon { font-size: 1rem; flex-shrink: 0; }

.ed-col-size,
.ed-col-type,
.ed-col-date {
    font-size: 0.78rem;
    color: #667085;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ed-row-viewable {
    cursor: zoom-in;
}

.ed-row-viewable:hover {
    background: #f0fdf4;
}

.ed-row-viewable .ed-col-name::after {
    content: "  👁 double-click to preview";
    font-size: 0.7rem;
    color: #94a3b8;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.ed-row-viewable:hover .ed-col-name::after {
    opacity: 1;
}

.ed-status-bar {
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #94a3b8;
    flex-shrink: 0;
}

/* ── Inline file viewer ── */
.ed-inline-viewer[hidden] { display: none; }

.ed-inline-viewer {
    margin-top: 4px;
    border: 1px solid #334155;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 480px;
}

.ed-inline-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.ed-viewer-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ed-viewer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}

.ed-viewer-close:hover { background: #334155; color: #f1f5f9; }

.ed-inline-viewer-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    background: #0f172a;
    min-height: 0;
}

.ed-viewer-pre {
    flex: 1;
    margin: 0;
    padding: 16px 20px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #e2e8f0;
    background: #0f172a;
    white-space: pre-wrap;
    word-break: break-all;
    min-width: 100%;
}

.ed-viewer-img {
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    padding: 16px;
}

.ed-viewer-video {
    max-width: 100%;
    max-height: 400px;
    display: block;
    margin: auto;
    padding: 12px;
    background: #000;
}

.logs-pre {
    flex: 1;
    margin: 0;
    padding: 14px 16px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
    color: #1e293b;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.logs-placeholder {
    padding: 18px 16px;
    font-size: 0.88rem;
    color: var(--muted);
    text-align: center;
}

.logs-error {
    padding: 18px 16px;
    font-size: 0.88rem;
    color: #dc2626;
    text-align: center;
}

.logs-error.vpn-msg {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    margin: 12px;
    padding: 16px;
    font-size: 0.9rem;
}

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

@media (max-width: 720px) {
    .login-card {
        padding: 30px 22px;
        border-radius: 14px;
    }

    .topbar-inner,
    .dashboard-shell {
        width: min(100% - 28px, 1320px);
    }

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

    .user-name {
        max-width: 120px;
    }

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

    .dashboard-card {
        min-height: 280px;
        padding: 24px;
    }

    .action-list,
    .modal-actions {
        flex-direction: column;
    }

    .dashboard-card .button,
    .modal-actions .button {
        width: 100%;
    }
}

.dashboard-card .dashboard-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #101828;
    background: #f8fafc;
    resize: none;
    box-sizing: border-box;
    overflow: auto;
    white-space: pre;
    cursor: default;
}

.install-viewer-wrap {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 340px);
    min-height: 300px;
}

.install-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    padding: 6px 16px;
    height: 32px;
    min-height: unset;
}

.install-dl-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.dashboard-card .dashboard-textarea:focus {
    outline: none;
    border-color: #d0d5dd;
    box-shadow: none;
}

.rdp-download-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    width: 100%;
}

.rdp-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}

.rdp-dl-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}


.sub-tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 4px;
}

.sub-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sub-tab:hover {
    background: #f1f5f9;
    border-color: #b0bdd0;
    color: var(--text);
}

.sub-tab.active {
    background: #dbeafe;
    border-color: var(--primary);
    color: var(--primary);
}

.sub-panels-wrap {
    width: 100%;
}

.inner-sub-tab-row {
    margin-top: 16px;
}

.inner-sub-tab-row .sub-tab.active {
    background: #f0fdf4;
    border-color: #16a34a;
    color: #16a34a;
}

.davinci-clock {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 54px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
    white-space: nowrap;
}

.clock-tz {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.clock-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.clock-offset {
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--muted);
    opacity: 0.75;
}

.clock-time {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    color: var(--text);
}

.clock-sep {
    font-size: 1rem;
    color: var(--border);
}

.sub-section-label {
    margin: 0 0 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.sub-section-divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 8px 0 4px;
}

.logs-header-row {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.logs-header-row .control-row {
    flex-shrink: 0;
}

.logs-clock-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logs-clock-spacer {
    visibility: hidden;
    user-select: none;
}

.db-controls-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.db-controls-row .dashboard-select {
    flex: 1;
}

.db-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.db-results-wrap[hidden] { display: none; }

.db-limit-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.db-limit-bar[hidden] { display: none; }

/* ── Database file list ───────────────────────────────── */
.db-file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.db-file-list[hidden] { display: none; }

.db-file-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.db-file-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: #b45309;
}

.db-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.db-file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.db-file-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

.db-dl-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 130px;
}

.db-dl-btn svg {
    width: 15px;
    height: 15px;
}

/* ── Setup Docs ───────────────────────────────────────── */
.docs-slot-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.docs-slot {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.docs-slot-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.docs-select {
    flex: 1;
    width: auto;
    min-width: 0;
    max-width: none;
}

.docs-slot-row .button {
    min-width: 130px;
    white-space: nowrap;
    flex-shrink: 0;
}

.docs-preview {
    display: block;
    width: 100%;
    aspect-ratio: 210 / 297;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.docs-preview[hidden] { display: none; }

/* ── Codeshare ────────────────────────────────────────── */
.cs-start-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.cs-start-row .button {
    height: 44px;
    min-height: unset;
    padding: 0 22px;
    align-self: stretch;
}

.cs-or {
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    align-items: center;
}

.cs-join-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.cs-join-input {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    letter-spacing: 0.08em;
    width: 150px;
    outline: none;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s;
}

.cs-join-input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px #cffafe;
}

.cs-session-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
}

.cs-session-bar[hidden] { display: none; }

.cs-session-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.cs-session-id {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #0891b2;
    background: #cffafe;
    padding: 2px 10px;
    border-radius: 5px;
}

.cs-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.cs-icon-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.cs-icon-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.cs-sync-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
    transition: background 0.3s;
}

.cs-sync-dot.synced   { background: #16a34a; }
.cs-sync-dot.syncing  { background: #f59e0b; }
.cs-sync-dot.error    { background: #ef4444; }

.cs-sync-status {
    font-size: 0.78rem;
    color: var(--muted);
    margin-right: auto;
}

.cs-leave-btn {
    margin-left: auto;
}

.cs-editor-wrap {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 290px);
    min-height: 300px;
}

.cs-editor-wrap[hidden] { display: none; }

.cs-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
}


.cs-copy-code-btn {
    border-color: #475569;
    background: #334155;
    color: #e2e8f0;
}

.cs-copy-code-btn:hover {
    background: #475569;
    border-color: #64748b;
}

.cs-editor-body {
    display: flex;
    align-items: stretch;
    background: #0f172a;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cs-line-numbers {
    padding: 18px 10px 18px 14px;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.65;
    color: #475569;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    min-width: 46px;
    text-align: right;
    user-select: none;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}

.cs-line-numbers::-webkit-scrollbar { display: none; }

.cs-line-numbers div {
    line-height: 1.65;
}

.cs-editor {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 18px 20px;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.65;
    background: #0f172a;
    color: #e2e8f0;
    border: none;
    outline: none;
    resize: none;
    box-sizing: border-box;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto;
}

.cs-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    padding: 5px 14px;
    background: #1e293b;
    border-top: 1px solid #334155;
    font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
    font-size: 0.75rem;
    color: #64748b;
}

.cs-resize-handle {
    height: 10px;
    background: #0f172a;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cs-resize-handle::after {
    content: '';
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: #334155;
}



/* ═══════════════════════════════════════════════════════════════════
   NoGrunt Database Studio — MySQL Workbench Light Theme
   ═══════════════════════════════════════════════════════════════════ */
.mw-shell {
    display:flex; flex-direction:column;
    height:calc(100vh - 140px); min-height:600px;
    background:#f0eeec; color:#333;
    font-family:Arial,"Helvetica Neue",sans-serif; font-size:12px;
    border-radius:4px; overflow:hidden; border:1px solid #a0a0a0;
    position:relative; box-shadow:0 2px 8px rgba(0,0,0,.18);
}

/* ── Titlebar ──────────────────────────────────────── */
.mw-titlebar {
    display:flex; align-items:center;
    background:linear-gradient(to bottom,#fafafa,#e8e6e4);
    border-bottom:1px solid #c0bebb; height:44px; padding:0 10px;
    flex-shrink:0; gap:0;
}
.mw-titlebar-left { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.mw-title-icon { width:18px; height:18px; color:#e07830; }
.mw-title-brand { font-size:0.82rem; font-weight:700; color:#222; white-space:nowrap; }
.mw-menubar { display:flex; align-items:center; margin-left:14px; }
.mw-menu-item {
    padding:4px 10px; font-size:0.78rem; color:#333; cursor:pointer;
    border-radius:3px; white-space:nowrap; line-height:36px;
}
.mw-menu-item:hover { background:#d8d6d4; }
.mw-titlebar-right { display:flex; align-items:center; gap:8px; margin-left:auto; }
.mw-conn-pill {
    display:flex; align-items:center; gap:5px; padding:3px 10px;
    border-radius:12px; background:#fff; border:1px solid #c8c6c4;
    font-size:0.72rem; color:#555; white-space:nowrap;
}
.mw-conn-dot { width:8px; height:8px; border-radius:50%; background:#ccc; flex-shrink:0; }
.mw-conn-dot.mw-conn-ok  { background:#4caf50; box-shadow:0 0 4px #4caf5070; }
.mw-conn-dot.mw-conn-err { background:#f44336; }
.mw-conn-dot.mw-conn-connecting { background:#ff9800; animation:mw-pulse .8s ease-in-out infinite; }
@keyframes mw-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
.mw-select {
    background:#fff; color:#333; border:1px solid #c8c6c4; border-radius:3px;
    padding:3px 6px; font-size:0.78rem; outline:none; cursor:pointer;
}
.mw-select:hover { border-color:#888; }

/* ── SQL Toolbar ───────────────────────────────────── */
.mw-sqltoolbar {
    display:flex; align-items:center; gap:2px; flex-wrap:wrap;
    background:linear-gradient(to bottom,#f5f3f1,#e8e6e4);
    border-bottom:1px solid #c0bebb; padding:3px 8px;
    flex-shrink:0; min-height:34px;
}
.mw-tb-btn {
    background:none; border:1px solid transparent; color:#444; cursor:pointer;
    padding:3px 6px; border-radius:3px; display:flex; align-items:center;
    gap:4px; height:24px; font-size:0.75rem;
    transition:background .1s, border-color .1s;
}
.mw-tb-btn:hover { background:#dbd9d7; border-color:#b8b6b4; }
.mw-tb-run-btn { color:#1a80c2; }
.mw-tb-run-btn:hover { background:#d4e8f5; border-color:#1a80c2; }
.mw-tb-sep { width:1px; background:#c8c6c4; height:18px; margin:0 4px; flex-shrink:0; }
.mw-tb-label { font-size:0.71rem; color:#666; white-space:nowrap; }
.mw-limit-select {
    background:#fff; border:1px solid #c8c6c4; border-radius:3px;
    padding:2px 5px; font-size:0.72rem; color:#333; outline:none;
}
.mw-tb-search {
    background:#fff; border:1px solid #c8c6c4; border-radius:3px;
    padding:2px 8px; font-size:0.72rem; color:#333; outline:none; width:140px;
}
.mw-tb-search:focus { border-color:#1a80c2; }
.mw-sql-hint { font-size:0.72rem; color:#888; padding-left:6px; }
.mw-query-hist-wrap { position:relative; }
.mw-hist-dropdown {
    position:absolute; right:0; top:100%; z-index:20;
    background:#fff; border:1px solid #c8c6c4; border-radius:4px;
    min-width:280px; max-height:200px; overflow-y:auto;
    box-shadow:0 4px 14px rgba(0,0,0,.18);
}
.mw-hist-item {
    display:block; width:100%; text-align:left; background:none; border:none;
    padding:6px 10px; font-size:0.74rem; color:#444; cursor:pointer;
    font-family:"Courier New",Consolas,monospace;
    border-bottom:1px solid #f0f0f0;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.mw-hist-item:hover { background:#e8f0fb; color:#1a80c2; }
.mw-hist-empty { padding:8px 10px; font-size:0.74rem; color:#aaa; }

/* ── Body layout ────────────────────────────────────── */
.mw-body { display:flex; flex:1; overflow:hidden; }

/* ── Navigator ──────────────────────────────────────── */
.mw-nav {
    width:230px; min-width:150px; max-width:400px;
    background:#f0f0f0; border-right:1px solid #c8c6c4;
    display:flex; flex-direction:column; flex-shrink:0;
}
.mw-nav-hdr {
    padding:4px 10px; font-size:0.7rem; font-weight:700;
    text-transform:uppercase; letter-spacing:.04em;
    color:#555; background:#dbd9d7; border-bottom:1px solid #c8c6c4;
    flex-shrink:0;
}
.mw-nav-schemas-hdr {
    display:flex; align-items:center; gap:5px;
    padding:5px 8px; font-size:0.7rem; font-weight:700;
    color:#333; cursor:pointer; background:#e8e6e4;
    border-bottom:1px solid #d0d0d0;
}
.mw-nav-arrow { font-size:0.65rem; color:#666; flex-shrink:0; }
.mw-nav-section-label { text-transform:uppercase; letter-spacing:.07em; flex:1; }
.mw-nav-count {
    font-size:0.65rem; color:#888; background:#ccc;
    padding:0 4px; border-radius:8px;
}
.mw-nav-filter {
    display:flex; align-items:center; gap:5px; padding:4px 7px;
    background:#fff; border-bottom:1px solid #d8d8d8; flex-shrink:0;
}
.mw-nav-filter-input {
    flex:1; background:none; border:none; outline:none;
    font-size:0.75rem; color:#333; font-style:italic;
}
.mw-nav-filter-input::placeholder { color:#bbb; }
.mw-tree { flex:1; overflow-y:auto; background:#fff; }
.mw-tree-placeholder { padding:10px 12px; font-size:0.75rem; color:#aaa; line-height:1.5; }
.mw-tree-list { list-style:none; margin:0; padding:0; }
.mw-tree-item {
    display:flex; align-items:center; gap:5px; padding:3px 8px;
    cursor:pointer; font-size:0.77rem; color:#333; user-select:none;
}
.mw-tree-item:hover { background:#e8f0fb; }
.mw-tree-item.active { background:#cce4f5; color:#0c5880; font-weight:600; }
.mw-nav-btm-tabs {
    display:flex; border-top:1px solid #c8c6c4; flex-shrink:0; background:#e0deda;
}
.mw-nav-btm-tab {
    flex:1; padding:5px 4px; font-size:0.72rem; color:#555;
    background:none; border:none; border-right:1px solid #c8c6c4; cursor:pointer;
}
.mw-nav-btm-tab:last-child { border-right:none; }
.mw-nav-btm-tab:hover { background:#d0cecc; }
.mw-nav-btm-active { background:#fff; color:#1a80c2; font-weight:600; }
.mw-nav-info { flex-shrink:0; border-top:1px solid #c8c6c4; }
.mw-nav-info-hdr {
    display:flex; align-items:center; gap:4px; padding:4px 8px;
    font-size:0.7rem; font-weight:700; color:#555;
    background:#e8e6e4; cursor:pointer;
}
.mw-nav-arrow-sm { font-size:0.6rem; color:#888; }
.mw-nav-info-body { padding:6px 12px; font-size:0.72rem; color:#999; }

/* ── Resize ─────────────────────────────────────────── */
.mw-resize-col { width:4px; cursor:col-resize; background:#c8c6c4; flex-shrink:0; }
.mw-resize-col:hover, .mw-resize-col:active { background:#1a80c2; }

/* ── Main area ──────────────────────────────────────── */
.mw-main { flex:1; display:flex; flex-direction:column; overflow:hidden; }

/* ── Query tabs ────────────────────────────────────── */
.mw-qtabs-bar {
    display:flex; align-items:flex-end; padding:0 6px;
    background:#dbd9d7; border-bottom:1px solid #c0bebb;
    flex-shrink:0; min-height:28px;
}
.mw-qtab {
    display:flex; align-items:center; gap:5px; padding:4px 14px;
    font-size:0.78rem; background:#dbd9d7; color:#777;
    border:1px solid transparent; border-bottom:none;
    border-radius:4px 4px 0 0; cursor:pointer; margin-right:2px;
    margin-bottom:-1px; position:relative;
}
.mw-qtab-active {
    background:#fff; color:#333; font-weight:600;
    border-color:#c0bebb; border-bottom-color:#fff; z-index:1;
}

/* ── Panel container ────────────────────────────────── */
.mw-panel-container { flex:1; display:flex; flex-direction:column; overflow:hidden; background:#fff; }

/* ── No-table state ─────────────────────────────────── */
.mw-no-table {
    flex:1; display:flex; flex-direction:column;
    align-items:center; justify-content:center; gap:10px; background:#fff; color:#ccc;
}
.mw-no-table p { margin:0; font-size:0.85rem; color:#aaa; }

/* ── DB Dashboard ───────────────────────────────────── */
.mw-db-dashboard { flex:1; overflow-y:auto; padding:20px 24px; background:#fff; }
.mw-section-title { margin:0 0 14px; font-size:0.95rem; font-weight:700; color:#333; }
.mw-sub-title { margin:18px 0 8px; font-size:0.71rem; font-weight:700; color:#999; text-transform:uppercase; letter-spacing:.06em; }
.mw-stat-cards { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.mw-stat-card { background:#f8f8f8; border:1px solid #e0e0e0; border-radius:5px; padding:12px 18px; min-width:110px; }
.mw-stat-val { font-size:1.4rem; font-weight:700; color:#1a80c2; }
.mw-stat-lbl { font-size:0.7rem; color:#999; margin-top:2px; }

/* ── Workspace ──────────────────────────────────────── */
.mw-workspace { flex:1; display:flex; flex-direction:column; overflow:hidden; }

/* Panel tabs (Browse/Structure/SQL…) */
.mw-tab-bar {
    display:flex; align-items:center; background:#eae8e6;
    border-bottom:1px solid #c8c6c4; padding:0 6px; flex-shrink:0; overflow-x:auto;
}
.mw-tab {
    background:none; border:none; color:#666; cursor:pointer; padding:6px 14px;
    font-size:0.78rem; border-bottom:2px solid transparent; white-space:nowrap;
    transition:color .12s;
}
.mw-tab:hover { color:#1a80c2; }
.mw-tab.active { color:#1a80c2; border-bottom-color:#1a80c2; font-weight:600; }

/* ── Panel ──────────────────────────────────────────── */
.mw-panel { flex:1; display:flex; flex-direction:column; overflow:hidden; background:#fff; }
.mw-panel-padded { padding:16px 20px; overflow-y:auto; }
.mw-panel-sql { gap:0; }

/* ── Result Grid bar ─────────────────────────────────── */
.mw-rg-bar {
    display:flex; align-items:center; flex-wrap:wrap; gap:0;
    background:#eae8e6; border-bottom:1px solid #c8c6c4;
    padding:3px 8px; flex-shrink:0; min-height:28px;
}
.mw-rg-lbl { font-size:0.74rem; font-weight:700; color:#333; padding:0 5px; white-space:nowrap; }
.mw-rg-sep { width:1px; background:#c0bebb; height:14px; margin:0 6px; flex-shrink:0; }
.mw-rg-text { font-size:0.71rem; color:#555; white-space:nowrap; padding:0 3px; }
.mw-rg-filter-input {
    width:120px; background:#fff; border:1px solid #c8c6c4;
    border-radius:2px; padding:1px 5px; font-size:0.71rem; outline:none;
}
.mw-rg-filter-input:focus { border-color:#1a80c2; }
.mw-rg-select {
    background:#fff; border:1px solid #c8c6c4; border-radius:2px;
    padding:1px 3px; font-size:0.71rem; outline:none;
}
.mw-rg-icon-btn {
    background:none; border:1px solid transparent; padding:2px 6px; border-radius:2px;
    cursor:pointer; color:#444; display:flex; align-items:center; gap:3px;
    font-size:0.72rem;
}
.mw-rg-icon-btn:hover { background:#dbd9d7; border-color:#b8b6b4; }
.mw-rg-pagination { display:flex; align-items:center; gap:4px; margin-left:auto; }
.mw-rg-nav-btn {
    background:linear-gradient(#f8f6f4,#e8e6e4); border:1px solid #c8c6c4;
    padding:1px 8px; border-radius:2px; cursor:pointer; font-size:0.8rem; color:#555;
}
.mw-rg-nav-btn:hover { background:#dbd9d7; }
.mw-rg-nav-btn:disabled { opacity:.4; cursor:not-allowed; }
.mw-rg-page-info { font-size:0.71rem; color:#777; padding:0 5px; white-space:nowrap; }
.mw-rg-bar-results { border-top:1px solid #c8c6c4; }

/* ── Grid ───────────────────────────────────────────── */
.mw-grid-wrap { flex:1; overflow:auto; }
.mw-table-scroll { overflow:auto; height:100%; }
.mw-data-table { width:100%; border-collapse:collapse; font-size:0.78rem; }
.mw-data-table thead { position:sticky; top:0; z-index:2; }
.mw-data-table th {
    padding:4px 8px; text-align:left; font-weight:700; color:#444;
    background:#eae8e6; border-right:1px solid #d8d6d4;
    border-bottom:2px solid #c0bebb; white-space:nowrap;
    cursor:pointer; user-select:none;
}
.mw-data-table th:hover { background:#dbd9d7; }
.mw-data-table td {
    padding:2px 8px; border-right:1px solid #eeeceb;
    border-bottom:1px solid #f0eeec; color:#333;
    max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.mw-data-table tbody tr:nth-child(even) td { background:#f9f8f7; }
.mw-data-table tbody tr:hover td { background:#e8f0fb; }
.mw-data-cell.mw-null { color:#ccc; font-style:italic; }
.mw-sort-icon { color:#ccc; font-size:0.6rem; }
.mw-act-cell { padding:2px 4px; white-space:nowrap; }
.mw-row-btn {
    background:none; border:none; cursor:pointer; font-size:0.78rem;
    padding:1px 4px; border-radius:2px; color:#999;
}
.mw-row-btn:hover { background:#e0e0e0; color:#333; }
.mw-row-del:hover { color:#e53935; }
.mw-inline-input {
    background:#fff; border:1px solid #1a80c2; color:#333;
    border-radius:2px; padding:0 3px; font-size:0.78rem; width:100%; outline:none;
}
.mw-grid-placeholder { padding:14px 12px; color:#bbb; font-size:0.8rem; }
.mw-err { color:#e53935; }
.mw-status-bar {
    padding:3px 10px; font-size:0.7rem; color:#999;
    border-top:1px solid #e0e0e0; background:#f5f3f1; flex-shrink:0;
}

/* ── SQL Editor ─────────────────────────────────────── */
.mw-sql-editor-wrap {
    display:flex; height:200px; min-height:80px;
    border-bottom:1px solid #d8d8d8; flex-shrink:0; overflow:hidden;
}
.mw-line-numbers {
    background:#f5f3f1; border-right:1px solid #d8d8d8;
    padding:8px 10px; font-family:"Courier New",Consolas,monospace;
    font-size:0.78rem; line-height:1.6; color:#bbb;
    text-align:right; user-select:none; overflow:hidden; min-width:36px; flex-shrink:0;
}
.mw-line-numbers div { height:1.6em; }
.mw-sql-editor {
    flex:1; background:#fff; color:#333; border:none; outline:none; resize:none;
    font-family:"Courier New",Consolas,"Lucida Console",monospace;
    font-size:0.8rem; line-height:1.6; padding:8px 10px;
    tab-size:4; white-space:pre; overflow-wrap:normal; overflow:auto;
}
.mw-sql-resize { height:5px; background:#e8e6e4; cursor:ns-resize; border-bottom:1px solid #c8c6c4; flex-shrink:0; }
.mw-sql-resize:hover { background:#1a80c2; }
.mw-sql-results { flex:1; overflow:auto; background:#fff; }
.mw-sql-row-count { padding:4px 10px; font-size:0.7rem; color:#888; border-bottom:1px solid #eee; background:#fafafa; }
.mw-sql-ok { padding:12px 14px; color:#388e3c; font-size:0.82rem; }

/* ── Output panel ───────────────────────────────────── */
.mw-output-resize {
    height:4px; cursor:ns-resize; background:#c8c6c4; flex-shrink:0;
    transition:background .1s;
}
.mw-output-resize:hover { background:#1a80c2; }
.mw-output-panel {
    height:130px; min-height:50px; display:flex; flex-direction:column;
    background:#f8f7f6; border-top:1px solid #c8c6c4; flex-shrink:0; overflow:hidden;
}
.mw-output-hdr {
    display:flex; align-items:center; gap:6px; padding:3px 10px;
    background:#eae8e6; border-bottom:1px solid #c8c6c4; flex-shrink:0;
}
.mw-output-title { font-size:0.72rem; font-weight:700; color:#444; }
.mw-output-hdr-sep { width:1px; height:13px; background:#c8c6c4; }
.mw-output-mode {
    background:#fff; border:1px solid #c8c6c4; border-radius:2px;
    padding:1px 4px; font-size:0.7rem; outline:none;
}
.mw-output-scroll { flex:1; overflow:auto; }
.mw-output-tbl { width:100%; border-collapse:collapse; font-size:0.72rem; }
.mw-output-tbl th {
    padding:2px 8px; background:#eae8e6; font-weight:600; color:#555;
    border-right:1px solid #d8d8d8; border-bottom:1px solid #c8c6c4;
    text-align:left; white-space:nowrap; position:sticky; top:0;
}
.mw-output-tbl td { padding:2px 8px; border-right:1px solid #eee; border-bottom:1px solid #f5f5f5; color:#444; vertical-align:top; }
.mw-output-tbl tr:hover td { background:#e8f0fb; }
.mw-output-ok td:first-child { color:#4caf50; font-size:0.85rem; }
.mw-output-err td { color:#e53935; }

/* ── Buttons ────────────────────────────────────────── */
.mw-btn {
    display:inline-flex; align-items:center; gap:4px; padding:4px 12px;
    border-radius:3px; border:1px solid #c8c6c4; cursor:pointer;
    font-size:0.78rem;
    background:linear-gradient(to bottom,#f8f6f4,#e8e6e4); color:#333;
    transition:background .1s;
}
.mw-btn:disabled { opacity:.45; cursor:not-allowed; }
.mw-btn:hover:not(:disabled) { background:#dbd9d7; }
.mw-btn-primary { background:linear-gradient(to bottom,#3a9fd8,#1a80c2); color:#fff; border-color:#1560a0; }
.mw-btn-primary:hover:not(:disabled) { background:linear-gradient(to bottom,#2990c8,#1470b2); }
.mw-btn-success { background:linear-gradient(to bottom,#5cb85c,#4aaa4a); color:#fff; border-color:#3d8b3d; }
.mw-btn-success:hover:not(:disabled) { background:#4aaa4a; }
.mw-btn-danger { background:linear-gradient(to bottom,#e57373,#e53935); color:#fff; border-color:#c62828; }
.mw-btn-danger:hover:not(:disabled) { background:#e53935; }
.mw-btn-ghost { background:linear-gradient(to bottom,#f8f6f4,#e8e6e4); color:#555; border-color:#c8c6c4; }

/* ── Form inputs ────────────────────────────────────── */
.mw-input {
    background:#fff; border:1px solid #c8c6c4; color:#333;
    border-radius:3px; padding:4px 8px; font-size:0.78rem; outline:none; width:100%;
}
.mw-input:focus { border-color:#1a80c2; }
.mw-label { font-size:0.72rem; color:#555; }

/* ── Badges ─────────────────────────────────────────── */
.mw-badge { display:inline-block; padding:1px 5px; border-radius:2px; font-size:0.65rem; font-weight:700; }
.mw-badge-key { background:#fff3cd; color:#856404; border:1px solid #ffc107; }
.mw-badge-yes { background:#d4edda; color:#155724; }
.mw-badge-no  { background:#f8f9fa; color:#999; }

/* ── Export ─────────────────────────────────────────── */
.mw-export-grid { display:flex; gap:12px; flex-wrap:wrap; }
.mw-export-card {
    display:flex; flex-direction:column; align-items:center; gap:8px;
    background:#f8f8f8; border:1px solid #e0e0e0; border-radius:5px;
    padding:18px 24px; cursor:pointer; color:#555;
    font-size:0.8rem; transition:border-color .12s, background .12s;
}
.mw-export-card svg { width:28px; height:28px; opacity:.5; }
.mw-export-card:hover { border-color:#1a80c2; background:#e8f0fb; color:#1a80c2; }

/* ── Import ─────────────────────────────────────────── */
.mw-import-zone {
    border:2px dashed #c8c6c4; border-radius:5px; padding:24px 16px;
    display:flex; flex-direction:column; align-items:center; gap:8px;
    color:#bbb; cursor:pointer; margin-bottom:12px;
}
.mw-import-zone:hover { border-color:#1a80c2; }
.mw-import-zone p { margin:0; font-size:0.8rem; color:#aaa; }
.mw-import-filename { font-size:0.75rem; color:#1a80c2; }
.mw-import-status { font-size:0.78rem; color:#888; margin-top:8px; }

/* ── Modals ─────────────────────────────────────────── */
.mw-modal-backdrop {
    position:absolute; inset:0; background:rgba(0,0,0,.5);
    display:flex; align-items:center; justify-content:center; z-index:50;
}
.mw-modal-backdrop[hidden] { display:none; }
.mw-modal {
    background:#fff; border:1px solid #c8c6c4; border-radius:5px;
    padding:20px; min-width:300px; max-width:92%;
    box-shadow:0 10px 30px rgba(0,0,0,.3);
}
.mw-modal h3 { margin:0 0 6px; color:#333; font-size:0.95rem; }
.mw-modal p  { margin:0 0 16px; color:#666; font-size:0.82rem; }
.mw-modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.mw-modal-header h3 { margin:0; }
.mw-modal-wide { min-width:460px; max-width:580px; }
.mw-modal-actions { display:flex; gap:8px; }
.mw-row-form { display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; max-height:360px; overflow-y:auto; margin-bottom:14px; }
.mw-form-field { display:flex; flex-direction:column; gap:3px; }
.mw-icon-btn {
    background:none; border:none; color:#888; cursor:pointer;
    padding:4px; border-radius:3px;
}
.mw-icon-btn:hover { background:#e0e0e0; color:#333; }

/* ── Toast ──────────────────────────────────────────── */
.mw-toast {
    position:absolute; bottom:14px; right:14px; z-index:60;
    padding:8px 14px; border-radius:4px; font-size:0.78rem;
    box-shadow:0 2px 8px rgba(0,0,0,.2); pointer-events:none;
}
.mw-toast[hidden] { display:none; }
.mw-toast-success { background:#d4edda; color:#155724; border:1px solid #c3e6cb; }
.mw-toast-error   { background:#f8d7da; color:#721c24; border:1px solid #f5c6cb; }

/* ── Link button ────────────────────────────────────── */
.mw-link { background:none; border:none; color:#1a80c2; cursor:pointer; font-size:inherit; padding:0; text-decoration:underline; }
.mw-link:hover { color:#1560a0; }
