/* ===== CSS Variables ===== */
:root {
    --background: 0 0% 98%;
    --foreground: 0 0% 12%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 12%;
    --primary: 0 72% 51%;
    --primary-foreground: 0 0% 100%;
    --secondary: 0 0% 95%;
    --secondary-foreground: 0 0% 12%;
    --muted: 0 0% 93%;
    --muted-foreground: 0 0% 40%;
    --accent: 0 60% 95%;
    --accent-foreground: 0 72% 40%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 100%;
    --border: 0 0% 88%;
    --input: 0 0% 88%;
    --ring: 0 72% 51%;
    --radius: 0.5rem;
    --sidebar-width: 16rem;
    --sidebar-background: 0 0% 100%;
    --sidebar-foreground: 0 0% 25%;
    --sidebar-primary: 0 72% 51%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 0 60% 96%;
    --sidebar-accent-foreground: 0 72% 40%;
    --sidebar-border: 0 0% 90%;
}

/* ===== Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-color: hsl(var(--border));
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    margin: 0;
    min-height: 100vh;
    display: flex;
}

a { color: inherit; text-decoration: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
table { border-collapse: collapse; }
img, svg { display: block; }
ol, ul { list-style: none; }

.hidden { display: none !important; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: hsl(var(--sidebar-background));
    border-right: 1px solid hsl(var(--sidebar-border));
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--sidebar-border));
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 2.25rem;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-logo-fallback {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--primary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    line-height: 1rem;
}

.sidebar-content {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-section {
    padding: 0.25rem 0;
}

.sidebar-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--sidebar-foreground) / 0.7);
    padding: 0.375rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: hsl(var(--sidebar-foreground));
    font-size: 14px;
    font-family: sans-serif;
    font-weight: 400;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    text-decoration: none;
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-accent-foreground));
}

.sidebar-link.active {
    background: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-accent-foreground));
    font-weight: 500;
}

.sidebar-link svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

/* ===== Mobile overlay ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
}

/* ===== Main Area ===== */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

/* ===== Sidebar Collapsed (Desktop) ===== */
body.sidebar-collapsed .sidebar {
    width: 3.5rem;
}

body.sidebar-collapsed .main-area {
    margin-left: 3.5rem;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-link span {
    display: none;
}

body.sidebar-collapsed .sidebar-header {
    padding: 0.75rem 0.5rem;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
}

body.sidebar-collapsed .brand-logo {
    height: 1.75rem;
}

body.sidebar-collapsed .sidebar-nav {
    padding: 0 0.25rem;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.625rem;
    gap: 0;
}

/* ===== Topbar ===== */
.topbar {
    height: 3.5rem;
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border-radius: calc(var(--radius) - 2px);
    transition: background-color 0.15s;
}

.sidebar-toggle:hover {
    background: hsl(var(--accent));
}

.topbar-title {
    font-size: 14px;
    font-family: sans-serif;
    font-weight: 600;
    color: hsl(var(--foreground));
    white-space: nowrap;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===== Connection Badge ===== */
.connection-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    transition: all 0.2s;
}

.connection-badge.connected {
    background: hsl(142 76% 36% / 0.15);
    color: hsl(142 76% 36%);
}

.badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: currentColor;
    opacity: 0.7;
}

.connection-badge.connected .badge-dot {
    background: hsl(142 76% 36%);
    opacity: 1;
}

/* ===== Views ===== */
.view {
    display: none;
    flex: 1;
}

.view.active {
    display: flex;
}

.view-container {
    width: 100%;
    max-width: 48rem;
    margin: 0 auto;
    padding: 1.5rem;
}

#view-files .view-container {
    max-width: none;
}

/* ===== View Header ===== */
.view-header {
    margin-bottom: 1.5rem;
}

.view-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
}

.view-desc {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* ===== Cards ===== */
.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--card-foreground));
}

.card-title svg {
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Settings Grid ===== */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    margin-bottom: 0;
}

.form-grid .col-span {
    grid-column: 1;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group select {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.form-group input::placeholder {
    color: hsl(var(--muted-foreground));
}

.form-group input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper input {
    padding-right: 2.75rem;
}

.input-icon-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    padding: 0.25rem;
    cursor: pointer;
    border-radius: calc(var(--radius) - 4px);
    transition: color 0.15s;
}

.input-icon-btn:hover {
    color: hsl(var(--foreground));
}

.input-icon-btn svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* ===== Status Display ===== */
.status-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-indicator {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-indicator.disconnected {
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

.status-indicator.connected {
    background: hsl(142 76% 36% / 0.15);
    color: hsl(142 76% 36%);
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.status-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.status-detail {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* ===== Alerts ===== */
.alert {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
}

.alert.success {
    background: hsl(142 76% 36% / 0.1);
    color: hsl(142 72% 29%);
    border: 1px solid hsl(142 76% 36% / 0.2);
}

.alert.error {
    background: hsl(var(--destructive) / 0.1);
    color: hsl(0 72% 40%);
    border: 1px solid hsl(var(--destructive) / 0.2);
}

/* ===== Action Bar ===== */
.action-bar {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0 1.5rem;
    justify-content: center;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 2.5rem;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
}

.btn-outline {
    background: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--input));
}

.btn-outline:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--muted-foreground));
    border: none;
}

.btn-ghost:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-icon-only {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
}

.btn-destructive {
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover {
    background: hsl(var(--destructive) / 0.9);
}

/* ===== Icon Buttons (table actions) ===== */
.icon-btn {
    padding: 0.375rem;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border: none;
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.icon-btn.danger:hover {
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
}

.icon-btn svg {
    width: 1rem;
    height: 1rem;
}

/* ===== Saved Connections List ===== */
.saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: hsl(var(--secondary));
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    transition: border-color 0.15s;
}

.saved-item:hover {
    border-color: hsl(var(--primary) / 0.5);
}

.saved-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.saved-item-host {
    font-weight: 600;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

.saved-item-user {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.saved-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    color: hsl(var(--muted-foreground));
    padding: 1.5rem 1rem;
    font-size: 0.875rem;
}

/* ===== File Toolbar ===== */
.file-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.breadcrumb-item {
    font-size: 0.875rem;
    color: hsl(var(--primary));
    font-weight: 500;
    padding: 0.25rem 0.375rem;
    border-radius: calc(var(--radius) - 4px);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s;
}

.breadcrumb-item:hover {
    background: hsl(var(--accent));
}

.breadcrumb-sep {
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    user-select: none;
}

.file-toolbar-actions {
    display: flex;
    gap: 0.25rem;
}

/* ===== File Card / Table ===== */
.file-card {
    margin-bottom: 0;
}

.file-card .card-body {
    padding: 0;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted) / 0.5);
    border-bottom: 1px solid hsl(var(--border));
}

.data-table tbody tr {
    border-bottom: 1px solid hsl(var(--border));
    transition: background-color 0.1s;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

.data-table td {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    vertical-align: middle;
    color: hsl(var(--foreground));
}

.col-size { width: 100px; }
.col-date { width: 160px; }
.col-actions { width: 130px; }

.file-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: hsl(var(--foreground));
    text-decoration: none;
    font-weight: 400;
}

.file-name:hover {
    color: hsl(var(--primary));
}

.file-name svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.file-name.directory {
    font-weight: 600;
}

.file-name.directory svg {
    color: hsl(45 93% 47%);
}

.file-name.file svg {
    color: hsl(var(--muted-foreground));
}

.file-size,
.file-date {
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
}

.file-actions {
    display: flex;
    gap: 0.125rem;
}

.empty-cell {
    text-align: center;
    color: hsl(var(--muted-foreground));
    padding: 2rem 1rem !important;
    font-size: 0.875rem;
}

.table-footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid hsl(var(--border));
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--muted) / 0.3);
}

/* ===== Drop Zone ===== */
.drop-zone {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    margin-bottom: 1rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: hsl(var(--primary));
    background: hsl(var(--accent));
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.drop-zone-icon {
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.5rem;
}

.drop-zone-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.drop-zone-hint {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.75rem;
}

.upload-path {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

.upload-path-label {
    font-weight: 500;
    color: hsl(var(--foreground));
}

/* ===== Progress ===== */
.progress-track {
    width: 100%;
    height: 0.5rem;
    background: hsl(var(--muted));
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: hsl(var(--primary));
    border-radius: 9999px;
    transition: width 0.3s;
    width: 0%;
}

.progress-text {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.modal-dialog {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    padding: 1.5rem;
    width: 90%;
    max-width: 25rem;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: hsl(var(--foreground));
}

.modal-input {
    width: 100%;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    outline: none;
    margin-bottom: 1.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ===== Preview Modal ===== */
.preview-dialog {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.4);
    width: 92vw;
    max-width: 68rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
    flex-shrink: 0;
}

.preview-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 3rem);
}

.preview-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s;
}

.preview-close:hover {
    background: hsl(var(--accent));
}

.preview-close svg {
    width: 1.125rem;
    height: 1.125rem;
}

.preview-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--background));
}

.preview-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.preview-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0;
}

.preview-video {
    max-width: 100%;
    max-height: 80vh;
    background: #000;
}

.preview-audio-wrap {
    padding: 2rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.preview-audio {
    width: 100%;
    max-width: 36rem;
}

.preview-pdf {
    width: 100%;
    height: 78vh;
    border: none;
}

.preview-text {
    width: 100%;
    height: 78vh;
    margin: 0;
    padding: 1.25rem;
    overflow: auto;
    font-size: 0.8125rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.6;
    color: hsl(var(--foreground));
    background: hsl(var(--background));
    white-space: pre;
    align-self: stretch;
}

.preview-error {
    color: hsl(var(--destructive));
    font-size: 0.875rem;
    padding: 2rem;
    text-align: center;
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 400;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    max-width: 24rem;
}

.toast {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    animation: toastIn 0.3s ease;
}

.toast.success {
    border-left: 3px solid hsl(142 76% 36%);
}

.toast.error {
    border-left: 3px solid hsl(var(--destructive));
}

.toast.info {
    border-left: 3px solid hsl(217 91% 60%);
}

@keyframes toastIn {
    from { transform: translateY(1rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== Spinner ===== */
.spinner {
    display: inline-block;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid hsl(var(--muted));
    border-top-color: hsl(var(--primary));
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .main-area {
        margin-left: 0;
    }

    .topbar-title {
        font-size: 0.875rem;
    }

    .view-container {
        padding: 1rem;
    }

    .view-title {
        font-size: 1.25rem;
    }

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

    .action-bar {
        flex-direction: column;
    }

    .action-bar .btn {
        width: 100%;
    }

    .col-date {
        display: none;
    }

    .col-size {
        width: 70px;
    }

    .data-table td,
    .data-table thead th {
        padding: 0.5rem;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .saved-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .saved-item-actions {
        align-self: flex-end;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }
}
