/* ===== CSS Variables ===== */
:root {
    --bg: #f0f2f7;
    --sidebar-bg: #1b1f2e;
    --sidebar-width: 240px;
    --sidebar-text: #9aa0b8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(108, 99, 255, 0.18);
    --sidebar-active-text: #a89cff;
    --sidebar-border: rgba(255,255,255,0.07);
    --card-bg: #ffffff;
    --card-border: #e4e8f0;
    --card-shadow: 0 1px 4px rgba(0,0,0,0.06);
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --accent-light: #ede9ff;
    --success: #22c77a;
    --success-light: #e6faf1;
    --error: #f04a4a;
    --error-light: #fef0f0;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --text-primary: #1a1d2e;
    --text-secondary: #6b7380;
    --text-muted: #9aa0b8;
    --border: #e4e8f0;
    --input-bg: #f8f9fc;
    --input-border: #d8dce8;
    --input-focus: #6c63ff;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --transition: 0.18s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo .app-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo .app-name svg {
    flex-shrink: 0;
}

.sidebar-logo .app-tagline {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sidebar-text);
    padding: 10px 20px 4px;
    opacity: 0.6;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 0;
    transition: color var(--transition), background var(--transition);
    text-decoration: none;
}

.sidebar-nav a:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
}

.sidebar-nav a svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar-nav a.active svg, .sidebar-nav a:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 0.82rem;
    color: var(--sidebar-text);
}

.sidebar-footer .username {
    font-weight: 600;
    color: var(--sidebar-text-hover);
}

.sidebar-footer a {
    color: var(--sidebar-text);
    font-size: 0.82rem;
    transition: color var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}

.sidebar-footer a:hover { color: var(--error); text-decoration: none; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page-header {
    padding: 28px 32px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-header-left .breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.page-header-left .breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
}

.page-header-left .breadcrumb a:hover {
    color: var(--accent);
}

.page-content {
    padding: 24px 32px 40px;
    flex: 1;
    min-width: 0;
}

/* ===== Flash Messages ===== */
.flash-messages {
    padding: 0 32px;
    margin-top: 16px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.flash-success { background: var(--success-light); color: #166041; border: 1px solid #a7f0cb; }
.flash-error { background: var(--error-light); color: #9b1c1c; border: 1px solid #fca5a5; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.flash-info { background: var(--accent-light); color: #4338ca; border: 1px solid #c4b5fd; }

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
}

.card + .card { margin-top: 16px; }

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition), opacity var(--transition), transform var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

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

.btn-secondary { background: var(--card-bg); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text-primary); }

.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #d93a3a; border-color: #d93a3a; color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }

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

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required-star { color: var(--error); }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
input[type="search"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.88rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
    background: #fff;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa0b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

textarea { resize: vertical; min-height: 80px; }

input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px dashed var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

input[type="file"]:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.checkbox-row label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

.error-list {
    background: var(--error-light);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.error-list ul { list-style: none; }
.error-list li {
    font-size: 0.86rem;
    color: #9b1c1c;
    padding: 2px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 8px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead tr {
    background: #f8f9fc;
    border-bottom: 1px solid var(--border);
}

thead th {
    padding: 11px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8f9fc; }

tbody td {
    padding: 13px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}

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

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-system { background: #fef3c7; color: #92400e; }
.badge-user { background: var(--accent-light); color: #4338ca; }
.badge-required { background: #fee2e2; color: #9b1c1c; }
.badge-optional { background: #f3f4f6; color: #6b7380; }
.badge-text { background: #e0f2fe; color: #0c4a6e; }
.badge-boolean { background: #fce7f3; color: #9d174d; }
.badge-integer { background: #f0fdf4; color: #166041; }
.badge-float { background: #f0fdf4; color: #166041; }
.badge-datetime { background: #faf5ff; color: #6b21a8; }
.badge-multiline_text { background: #e0f2fe; color: #0c4a6e; }
.badge-neutral { background: #f3f4f6; color: #374151; }

/* ===== Search Page ===== */
.search-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}

.search-filters {
    position: sticky;
    top: 24px;
}

.search-filters .card { padding: 20px; }

.filter-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

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

.filter-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 5px;
}

.filter-actions {
    display: flex;
    gap: 6px;
    padding-top: 6px;
}

.filter-actions .btn { flex: 1; justify-content: center; }

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

.results-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.results-count strong { color: var(--text-primary); }

.file-cards { display: flex; flex-direction: column; gap: 10px; }

.file-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.file-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: var(--accent);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.file-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.file-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.file-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.file-card-meta span { display: flex; align-items: center; gap: 4px; }

.file-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: pre-wrap;
}

.file-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f3f4f6;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.pagination a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    text-decoration: none;
}

.pagination .current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== File Detail ===== */
.file-detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.meta-table { width: 100%; }
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table tr:last-child { border-bottom: none; }
.meta-table th {
    width: 35%;
    padding: 10px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    vertical-align: top;
}
.meta-table td {
    padding: 10px 0 10px 12px;
    font-size: 0.88rem;
    color: var(--text-primary);
    word-break: break-all;
}

.file-uuid-mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== Upload Form ===== */
.upload-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

.category-list-select a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    border: 1px solid transparent;
}

.category-list-select a:hover {
    background: var(--bg);
    text-decoration: none;
}

.category-list-select a.selected {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.dynamic-fields-loading {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Login Page ===== */
.login-wrap {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    padding: 40px 36px;
}

/* ===== Upload Tabs ===== */
.upload-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--input-bg);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
}

.upload-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: calc(var(--radius-sm) - 2px);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: transparent;
}

.upload-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.5);
}

.upload-tab.active {
    background: #ffffff;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.upload-tab svg {
    width: 15px;
    height: 15px;
}

.upload-method-content {
    animation: fadeIn 0.2s ease-out;
}

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

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

.login-logo .app-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-logo .app-name svg { width: 32px; height: 32px; }

.login-logo .tagline {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* ===== Error Pages ===== */
.error-wrap {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    text-align: center;
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.05em;
}

.error-msg {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.error-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 360px;
}

/* ===== Dividers & helpers ===== */
.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--error); }
.text-success { color: var(--success); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== Danger zone ===== */
.danger-zone {
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 16px 20px;
    background: #fff8f8;
}

.danger-zone-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--error);
    margin-bottom: 6px;
}

.danger-zone p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ===== File Preview ===== */
.preview-card {
    overflow: hidden;
    margin-bottom: 20px;
    padding: 20px;
}

.preview-image-wrap {
    text-align: center;
    background: #f0f2f7;
    border-radius: var(--radius-sm);
    padding: 16px;
}

.preview-image {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    display: block;
    margin: 0 auto;
}

.preview-audio {
    width: 100%;
    display: block;
    accent-color: var(--accent);
}

.preview-video {
    width: 100%;
    max-height: 480px;
    background: #000;
    border-radius: var(--radius-sm);
    display: block;
}

.preview-text {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    background: #1b1f2e;
    color: #c8cdd9;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    display: block;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 380px;
    white-space: pre;
    margin: 0;
}
.preview-pdf {
    width: 100%;
    height: 750px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: block;
}

.preview-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 12px 0;
}

.ext-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: #f3f4f6;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

/* ===== Custom Multi-Select ===== */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    cursor: pointer;
    font-size: 0.88rem;
    min-height: 40px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.multi-select.active .multi-select-trigger {
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
    background: #fff;
}

.multi-select-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

.multi-select-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--accent);
    color: #fff;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.multi-select-tag-remove {
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.multi-select-tag-remove:hover {
    opacity: 1;
}

.multi-select-placeholder {
    color: var(--text-muted);
}

.multi-select-arrow {
    margin-left: 8px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.multi-select.active .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.multi-select.active .multi-select-dropdown {
    display: block;
}

.multi-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background var(--transition);
}

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

.multi-select-option.selected {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.multi-select-option .option-check {
    width: 14px;
    height: 14px;
    color: var(--accent);
    display: none;
}

.multi-select-option.selected .option-check {
    display: block;
}
