@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --bg: #0A0E1A;
    --bg-elevated: #111827;
    --bg-hover: #1A2236;
    --border: #232B42;
    --border-light: #51608d;
    --text: #E5EAF5;
    --text-muted: #7E8AA3;
    --accent: #2E9EE0;
    --accent-hover: #4CB2EC;
    --accent-soft: rgba(46, 158, 224, 0.12);
    --success: #34D399;
    --success-soft: rgba(52, 211, 153, 0.12);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
}

/* Custom Styled Native Select Dropdowns */
select,
.column-def-main select,
.field-input select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 36px 8px 12px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    
    /* Custom SVG dropdown arrow matching var(--text-muted) */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237E8AA3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover & Focus states */
select:hover {
    border-color: var(--text-muted);
}

select:focus,
.column-def-main select:focus,
.field-input select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Dark Theme Options List (Dropdown menu itself) */
select option,
select optgroup {
    background-color: var(--bg-elevated);
    color: var(--text);
    padding: 8px;
}

/* Brand mark, shared by topbar + login */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.brand-mark span {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--bg);
    line-height: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-word {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
}
.brand-tagline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.62rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
}
.brand-tagline::before, .brand-tagline::after {
    content: '';
    width: 14px;
    height: 1px;
    background: var(--border-light);
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top, rgba(46,158,224,0.08), transparent 55%),
        var(--bg);
}
.login-card {
    background: var(--bg-elevated);
    padding: 44px 40px;
    border-radius: 14px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 380px;
}
.login-card .brand { justify-content: center; margin-bottom: 28px; }
.login-card .brand-text { align-items: flex-start; }
.login-card label {
    display: block;
    margin-bottom: 18px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}
.login-card input {
    width: 100%;
    padding: 11px 13px;
    margin-top: 7px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font-body);
}
.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.03em;
    font-size: 0.9rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease;
}
.login-card button:hover { background: var(--accent-hover); }

/* Layout */
.topbar {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}
.logout-link:hover { color: var(--danger); border-color: var(--danger); }

.container { max-width: 1040px; margin: 28px auto; padding: 0 20px; }

.breadcrumbs { margin-bottom: 18px; font-size: 0.9rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color 0.15s ease; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 8px; color: var(--border); }

.toolbar { margin-bottom: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar button, .btn-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-body);
    text-decoration: none;
    transition: all 0.15s ease;
}
.toolbar button:hover, .btn-link:hover { border-color: var(--accent); color: var(--accent); }
.toolbar svg, .btn-link svg { width: 15px; height: 15px; flex-shrink: 0; }

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.file-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255,255,255,0.02);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.file-table th:first-child {
    width: 20px;
}

.file-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: var(--bg-hover); }
.file-table a { color: var(--text); text-decoration: none; }
.file-table td > a { color: var(--text); font-weight: 500; }
.file-table td > a:hover { color: var(--accent); }
.row-actions { display: flex; gap: 4px; }
.row-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.15s ease;
}
.row-actions a:hover { background: var(--bg-hover); color: var(--accent); }
.row-actions svg { width: 15px; height: 15px; }
.empty { text-align: center; color: var(--text-muted); padding: 40px; font-size: 0.9rem; }

.file-icon { display: inline-flex; width: 18px; height: 18px; }
.file-icon.is-folder { color: var(--accent); }
.file-icon.is-file { color: var(--text-muted); }
.file-icon svg { width: 100%; height: 100%; display: block; }

/* App shell: sidebar + main content */
.app-shell { display: flex; align-items: flex-start; max-width: calc(100% - 4px); margin: 0 auto; padding: 28px 20px; gap: 28px; }
.sidebar {
    width: 20%;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    position: sticky;
    top: 28px;
}
.sidebar.is-wide { width: 270px; }
.sidebar-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px 4px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; margin-bottom: 22px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-nav.is-scrollable {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
    margin-right: -4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar-nav.is-scrollable::-webkit-scrollbar { width: 6px; }
.sidebar-nav.is-scrollable::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav.is-scrollable::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar-nav.is-scrollable::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.sidebar-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.sidebar-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.sidebar-stat strong { color: var(--text); font-weight: 600; }
.main-area { flex: 1; min-width: 0; }
.main-area .breadcrumbs, .main-area .toolbar { margin-left: 0; }

/* Dashboard */
.dashboard-wrap { max-width: 720px; margin: 0 auto; padding: 60px 20px; text-align: center; }
.dashboard-heading { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin-bottom: 36px; }
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 32px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.18s ease;
}
.dashboard-card:not(.is-disabled):hover { border-color: var(--accent); transform: translateY(-2px); }
.dashboard-card-icon {
    width: 44px;
    height: 44px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
.dashboard-card-icon svg { width: 100%; height: 100%; }
.dashboard-card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.dashboard-card-desc { font-size: 0.85rem; color: var(--text-muted); }
.dashboard-card.is-disabled { opacity: 0.5; cursor: not-allowed; }
.dashboard-card.is-disabled .dashboard-card-icon { color: var(--text-muted); background: rgba(255,255,255,0.04); }

/* Table + column creation UI */
.btn-new-table {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    margin-bottom: 16px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}
.btn-new-table:hover { background: var(--accent-hover); }
.btn-new-table svg { width: 15px; height: 15px; }

.table-name-input {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
}
.table-name-input:focus { outline: none; border-color: var(--accent); }

.column-def-row {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}
.column-def-main {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.column-def-main input[type=text], .column-def-main select {
    padding: 7px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.82rem;
}
.column-def-main input[name*="[name]"] { flex: 1.2; }
.column-def-main select { flex: 1; }
.column-def-extra { display: flex; align-items: center; gap: 6px; flex: 1.4; }
.column-def-extra input {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-size: 0.82rem;
}
.btn-remove-column {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
    flex-shrink: 0;
}
.btn-remove-column:hover { color: var(--danger); }
.column-def-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.column-def-options label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.column-def-options input[type=checkbox] { width: auto; }
.col-default input {
    width: 110px;
    padding: 5px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.78rem;
}
.btn-add-column {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    cursor: pointer;
    margin-bottom: 16px;
}
.btn-add-column:hover { border-color: var(--accent); color: var(--accent); }
.btn-add-column svg { width: 14px; height: 14px; }

/* Database browser */
.query-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
}
.query-box summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.query-box[open] summary { margin-bottom: 12px; color: var(--text); }
.query-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.85rem;
    resize: vertical;
}
.table-scroll { overflow-x: auto; margin-bottom: 14px; }

/* Editor page: full width + full height, no sidebar */
html, body.editor-body { height: 100%; }
body.editor-body {
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.editor-toolbar-right { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }
.path-box {
    flex: 1;
    max-width: 480px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.82rem;
}
.path-box:focus { outline: none; border-color: var(--accent); color: var(--text); }
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    background: var(--border);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    cursor: not-allowed;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-save.is-dirty { background: var(--accent); color: var(--bg); cursor: pointer; }
.btn-save.is-dirty:hover { background: var(--accent-hover); }
.btn-save.is-saving { cursor: wait; opacity: 0.85; }
.btn-save .spinner {
    width: 13px; height: 13px;
    border: 2px solid rgba(0,0,0,0.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: fm-spin 0.6s linear infinite;
    display: none;
}
.btn-save.is-saving .spinner { display: inline-block; }
@keyframes fm-spin { to { transform: rotate(360deg); } }

.editor-wrap { flex: 1; min-height: 0; display: flex; }
.editor-wrap .CodeMirror { flex: 1; height: 100% !important; font-size: 0.9rem; border-radius: 0; border: none; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(52,211,153,0.25); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(248,113,113,0.25); }

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3,6,14,0.7);
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal.open { display: flex; }
.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 26px;
    border-radius: 14px;
    width: auto;
    min-width: 380px;
}
.modal-box,
.modal-box-wide {
    max-height: 85vh; 
    overflow: auto; 
}

.modal-box-wide::-webkit-scrollbar {
    width: 6px;
}

.modal-box-wide::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.modal-box-wide::-webkit-scrollbar-thumb {
    background: #2E9EE0;
    border-radius: 4px;
}

.modal-box-wide::-webkit-scrollbar-thumb:hover {
    background: #267cad; 
}

.modal-box h3 { margin-top: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.modal-box-wide { max-width: 640px; }
.field-grid { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.field-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.field-row:last-child { border-bottom: none; }
.field-label { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.field-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.field-type { font-size: 0.72rem; color: var(--text-muted); font-family: 'SF Mono', Consolas, monospace; }
.field-input { display: flex; flex-direction: column; gap: 6px; }
.field-input input, .field-input select, .field-input textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
}
.field-input input:disabled { color: var(--text-muted); cursor: not-allowed; }
.field-input textarea { font-family: 'SF Mono', Consolas, monospace; resize: vertical; }
.field-input input:focus, .field-input select:focus, .field-input textarea:focus { outline: none; border-color: var(--accent); }
.field-null-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
}
.field-null-toggle input { width: auto; }
.modal-box input[type=text], .modal-box input[type=file] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    margin: 10px 0;
    font-family: var(--font-body);
}
.modal-box input[type=text]:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
.modal-actions button {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
}
.modal-actions button[type=submit] { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.modal-actions button[type=submit]:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger) !important; border-color: var(--danger) !important; color: var(--bg) !important; }
.hint { font-size: 0.78rem; color: var(--text-muted); }

/* Editor page */
.editor { width: 100%; min-height: 60vh; }

/* File Uploader */
/* Drag & Drop Area */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: var(--bg-surface);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-dropzone.is-dragover {
    border-color: #00BCD4;
    background: rgba(0, 188, 212, 0.05);
}

.dropzone-link {
    color: #00BCD4;
    cursor: pointer;
    text-decoration: underline;
}

/* File Queue Container */
.file-preview-queue {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 16px;
    padding-right: 4px;
}

/* Individual Upload Card */
.upload-file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s ease;
}

.upload-file-card.is-uploading { border-color: #00BCD4; }
.upload-file-card.is-complete { border-color: #10B981; }
.upload-file-card.has-error { border-color: #EF4444; }

/* File Thumb */
.file-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-ext-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

/* Details */
.file-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-status-text {
    font-size: 11px;
    color: #00BCD4;
    margin-top: 2px;
}

.upload-file-card.has-error .file-status-text { color: #EF4444; }
.upload-file-card.is-complete .file-status-text { color: #10B981; }

/* Circular Progress Bar */
.file-progress-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.circular-progress {
    position: relative;
    width: 36px;
    height: 36px;
}

.circle-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3.8;
}

.circle-fill {
    fill: none;
    stroke: #00BCD4;
    stroke-width: 3.8;
    stroke-linecap: round;
    transition: stroke-dasharray 0.2s ease;
}

.is-complete .circle-fill { stroke: #10B981; }
.has-error .circle-fill { stroke: #EF4444; }

.percentage-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 700;
}

/* Action Buttons */
.btn-action-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.btn-action-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-retry { color: #00BCD4; }
.btn-retry:hover { color: #22d3ee; }

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: var(--bg-surface);
    transition: all 0.2s ease;
}

.upload-dropzone.is-dragover {
    border-color: #00BCD4;
    background: rgba(0, 188, 212, 0.05);
}

.dropzone-link {
    color: #00BCD4;
    cursor: pointer;
    text-decoration: underline;
}

.file-preview-queue {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.preview-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-file {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.btn-remove-file:hover {
    color: #ef4444;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@keyframes rowSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-12px);
        background-color: rgba(0, 188, 212, 0.15);
    }
    60% {
        opacity: 1;
        background-color: rgba(0, 188, 212, 0.1);
    }
    100% {
        transform: translateY(0);
        background-color: transparent;
    }
}

.row-animated-enter {
    animation: rowSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fixed Toast Notification Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 40px);
    pointer-events: none; /* Allows clicking through empty space */
}

/* Base Toast Item */
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-left: 4px solid var(--text-muted);
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.4;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Status Variants */
.toast-success { border-left-color: #10B981; }
.toast-error   { border-left-color: #EF4444; }
.toast-warning { border-left-color: #F59E0B; }
.toast-info    { border-left-color: #00BCD4; }

/* Status Icon Colors */
.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-success .toast-icon { color: #10B981; }
.toast-error .toast-icon   { color: #EF4444; }
.toast-warning .toast-icon { color: #F59E0B; }
.toast-info .toast-icon    { color: #00BCD4; }

.toast-content {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.toast-close:hover {
    opacity: 1;
    color: var(--text-primary);
}

/* Sidebar storage widget */
.sidebar-divider { height: 1px; background: var(--border); margin: 14px 0; }
.storage-widget { padding: 4px 0; }
.storage-bar-wrap {
    height: 6px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 10px;
}
.storage-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 0.4s ease;
}
.storage-bar.is-warning { background: #f59e0b; }
.storage-bar.is-danger  { background: var(--danger); }
.storage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 0.78rem;
}
.storage-label { color: var(--text-muted); }
.storage-row strong { color: var(--text); font-weight: 600; font-size: 0.78rem; }
.storage-pct { font-weight: 600; color: var(--accent); }
.storage-pct.is-warning { color: #f59e0b; }
.storage-pct.is-danger  { color: var(--danger); }

/* Dashboard account info */
.account-info {
    margin: 32px auto 0;
    max-width: 480px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}
.account-info-title {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.account-info-grid { display: flex; flex-direction: column; gap: 10px; }
.account-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
}
.account-info-label { color: var(--text-muted); }
.account-info-value { font-weight: 600; color: var(--text); }
.account-days-left.is-good    { color: var(--success); }
.account-days-left.is-warning { color: #f59e0b; }
.account-days-left.is-danger  { color: var(--danger); }

.sidebar-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px 4px;
}
/* Dashboard account info */
/* Dashboard account info */
.account-info {
    margin: 32px auto 0;
    max-width: 640px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px 28px;
}
.account-info-title {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.account-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.account-stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.account-stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
}
.account-stat-icon svg { width: 100%; height: 100%; }
.account-stat-icon.is-warning { background: rgba(245,158,11,0.12); color: #f59e0b; }
.account-stat-icon.is-danger  { background: rgba(248,113,113,0.12); color: var(--danger); }
.account-stat-label { font-size: 0.72rem; color: var(--text-muted); }
.account-stat-value { font-size: 1rem; font-weight: 700; color: var(--text); font-family: var(--font-display); }
.account-stat-value.is-warning { color: #f59e0b; }
.account-stat-value.is-danger  { color: var(--danger); }
.plan-status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    letter-spacing: 0.04em;
    display: inline-block;
}
.plan-status-badge.is-good    { background: rgba(52,211,153,0.15); color: var(--success); }
.plan-status-badge.is-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.plan-status-badge.is-danger  { background: rgba(248,113,113,0.15); color: var(--danger); }
.account-progress-wrap { margin-top: 4px; }
.account-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.account-progress-track {
    height: 6px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
}
.account-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 1s ease;
}
.account-days-left.is-good    { color: var(--success); }
.account-days-left.is-warning { color: #f59e0b; }
.account-days-left.is-danger  { color: var(--danger); }