/* ═══════════════════════════════════════════════════════════════════════
   LEGO Studio Photo Assistant — Dark Theme CSS
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────── */

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

html {
    font-size: 18px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    font-weight: 600;
}

a {
    color: #5dade2;
    text-decoration: none;
}

a:hover {
    color: #85c1e9;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Custom Scrollbar ─────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #30363d #0d1117;
}

/* ── Navbar ────────────────────────────────────────────────────────── */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 46px;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.nav-logo {
    height: 28px;
    width: auto;
}

.nav-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.nav-version {
    color: #6e7681;
    font-size: 0.75rem;
    white-space: nowrap;
}

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

.nav-user {
    color: #c9d1d9;
    font-size: 0.85rem;
}

.nav-greeting {
    color: #e0e0e0;
    font-size: 0.85rem;
    font-weight: 500;
}

.lang-select {
    background: #21262d;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.nav-link {
    color: #c9d1d9;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.nav-link:hover {
    background: #21262d;
    text-decoration: none;
    color: #ffffff;
}

/* ── Main Content ─────────────────────────────────────────────────── */

.main-content {
    margin-top: 46px;
    min-height: calc(100vh - 46px);
}

/* ── Flash Messages ───────────────────────────────────────────────── */

.flash-container {
    position: fixed;
    top: 46px;
    left: 0;
    right: 0;
    z-index: 999;
}

.flash {
    padding: 10px 20px;
    font-size: 0.9rem;
    text-align: center;
    animation: flashSlideIn 0.3s ease-out;
}

.flash-success {
    background: #4CAF7A;
    color: #ffffff;
}

.flash-error, .flash-danger {
    background: #E07070;
    color: #ffffff;
}

.flash-warning {
    background: #F0A860;
    color: #ffffff;
}

.flash-info {
    background: #2A4A7F;
    color: #e0e0e0;
}

@keyframes flashSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    line-height: 1;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    opacity: 0.8;
}

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

.btn-primary {
    background: #4CAF7A;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: #348C0E;
}

.btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.btn-secondary:hover:not(:disabled) {
    background: #30363d;
    color: #ffffff;
}

.btn-accent {
    background: #2A4A7F;
    color: #ffffff;
}

.btn-accent:hover:not(:disabled) {
    background: #154785;
}

.btn-danger {
    background: #E07070;
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background: #D44637;
}

.btn-warning {
    background: #F0A860;
    color: #ffffff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 4px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-close {
    background: none;
    border: none;
    color: #6e7681;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.btn-close:hover {
    color: #ffffff;
    background: #30363d;
}

.icon {
    font-size: 1rem;
}

/* ── Forms ─────────────────────────────────────────────────────────── */

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #c9d1d9;
    font-weight: 500;
}

.form-check label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #5B9BD5;
    box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.25);
}

input::placeholder,
textarea::placeholder {
    color: #484f58;
}

select {
    cursor: pointer;
    appearance: auto;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: #c9d1d9;
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 2000;
    animation: modalFadeIn 0.15s ease-out;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 1px solid #21262d;
    border-radius: 10px;
    padding: 24px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal-wide {
    max-width: 780px;
}

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

.modal-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

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

.modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #21262d;
    flex-wrap: wrap;
}

.modal-selection-count {
    margin-right: auto;
}

.modal-add-options {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.modal-opt-label {
    color: #8b949e;
    font-size: 0.75rem;
}

.modal-global-select {
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.78rem;
}

.modal-global-qty {
    width: 50px;
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.78rem;
    text-align: center;
    -moz-appearance: textfield;
}

.modal-global-qty::-webkit-outer-spin-button,
.modal-global-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modal-selection-count {
    margin-right: auto;
    font-size: 0.85rem;
    color: #6e7681;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Login Page ────────────────────────────────────────────────────── */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 46px);
    padding: 24px;
}

.login-card {
    background: #16213e;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    height: 64px;
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.login-subtitle {
    color: #6e7681;
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-form .form-group {
    text-align: left;
}

.login-form .btn-full {
    margin-top: 8px;
}

/* ── Dashboard ─────────────────────────────────────────────────────── */

.dashboard {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

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

.dashboard-header h1 {
    font-size: 1.5rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.project-card {
    background: #16213e;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    transition: border-color 0.15s;
}

.project-card:hover {
    border-color: #30363d;
}

.project-thumb {
    width: 56px;
    height: 56px;
    background: #2A4A7F;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

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

.project-name {
    font-size: 1rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-meta {
    font-size: 0.78rem;
    color: #6e7681;
}

.project-date {
    font-size: 0.75rem;
    color: #484f58;
}

.project-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6e7681;
    font-size: 0.95rem;
}

/* ── Workspace: Toolbar ────────────────────────────────────────────── */

.workspace {
    height: calc(100vh - 46px);
    display: flex;
    flex-direction: column;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #0d1117;
    border-bottom: 1px solid #21262d;
    gap: 8px;
    flex-shrink: 0;
}

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

/* ── Workspace: 3-Column Grid ──────────────────────────────────────── */

.workspace-grid {
    display: grid;
    grid-template-columns: 250px 1fr 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left Sidebar ──────────────────────────────────────────────────── */

.sidebar {
    background: #16213e;
    border-right: 1px solid #21262d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 220px;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

.project-name-editable {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    padding: 4px 6px;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
    cursor: text;
}

.project-name-editable:hover {
    border-color: #30363d;
}

.project-name-editable:focus {
    border-color: #5B9BD5;
    background: #0d1117;
}

.steps-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ── Step Cards ────────────────────────────────────────────────────── */

.step-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #1a1a2e;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    position: relative;
}

.step-card:hover {
    background: #2A4A7F;
}

.step-card.selected {
    border-color: #5B9BD5;
    background: #2A4A7F;
}

.step-card.dragging {
    opacity: 0.5;
    border-color: #F0A860;
    border-style: dashed;
}

.step-card.drag-over {
    border-color: #4CAF7A;
    background: rgba(43, 122, 11, 0.15);
}

.step-thumb {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    background: #0d1117;
    flex-shrink: 0;
}

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

.step-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-tag-dropdown {
    font-size: 0.7rem;
    padding: 1px 4px;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 3px;
    margin-top: 2px;
    cursor: pointer;
    width: 100%;
}

.step-badge-analyzed {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 5px;
    background: #4CAF7A;
    color: #ffffff;
    border-radius: 3px;
    margin-top: 2px;
}

.step-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.step-action-btn {
    background: none;
    border: none;
    color: #6e7681;
    font-size: 0.85rem;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1;
}

.step-action-btn:hover {
    color: #ffffff;
    background: #30363d;
}

.step-action-btn.btn-delete:hover {
    color: #ffffff;
    background: #E07070;
}

/* ── Center Panel ──────────────────────────────────────────────────── */

.center-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1a1a2e;
    border-right: 1px solid #21262d;
    min-width: 400px;
}

/* ── Progress Bar ──────────────────────────────────────────────────── */

.progress-bar-container {
    padding: 8px 12px;
    flex-shrink: 0;
}

.progress-bar {
    height: 22px;
    background: #0d1117;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF7A, #34a853);
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.progress-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    white-space: nowrap;
    padding: 0 8px;
}

/* ── Action Bar ────────────────────────────────────────────────────── */

.action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.action-checkbox {
    margin-left: auto;
}

/* ── Parts Table ───────────────────────────────────────────────────── */

.parts-table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0;
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.parts-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.parts-table th {
    background: #0d1117;
    color: #6e7681;
    font-weight: 600;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.parts-table td {
    padding: 5px 8px;
    vertical-align: middle;
    border-bottom: 1px solid #161b22;
}

.parts-table tbody tr {
    transition: background 0.1s;
}

.parts-table tbody tr:nth-child(even) {
    background: rgba(13, 17, 23, 0.3);
}

.parts-table tbody tr:hover {
    background: rgba(15, 52, 96, 0.35);
}

.parts-table tbody tr.from-previous {
    opacity: 0.5;
}

.parts-table tbody tr.from-previous.hidden-prev {
    display: none;
}

.parts-table tbody tr.highlight {
    background: rgba(21, 101, 192, 0.25);
}

/* Column widths */
.col-check { width: 32px; text-align: center; }
.col-thumb  { width: 68px; }
.col-mag    { width: 32px; }
.col-partid { width: 100px; }
.col-name   { min-width: 140px; }
.col-color  { width: 140px; }
.col-swatch { width: 32px; }
.col-qty    { width: 72px; }
.col-conf   { width: 60px; }
.col-del    { width: 36px; }

.part-thumb {
    width: 60px;
    height: 45px;
    object-fit: contain;
    background: #0d1117;
    border-radius: 3px;
}

.btn-magnify {
    background: none;
    border: none;
    color: #6e7681;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
}

.btn-magnify:hover {
    color: #ffffff;
    background: #30363d;
}

.part-id-cell {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: #5dade2;
}

.color-dropdown {
    font-size: 0.75rem;
    padding: 2px 4px;
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 3px;
    max-width: 110px;
    cursor: pointer;
}

.color-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #30363d;
    vertical-align: middle;
}

.qty-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 0.85rem;
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 3px;
    text-align: center;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.conf-value {
    font-size: 0.75rem;
    color: #6e7681;
}

.conf-high { color: #4CAF7A; }
.conf-mid  { color: #F0A860; }
.conf-low  { color: #E07070; }

.btn-delete-part {
    background: none;
    border: none;
    color: #6e7681;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
}

.btn-delete-part:hover {
    color: #E07070;
    background: rgba(192, 57, 43, 0.15);
}

/* ── Right Panel (Images) ──────────────────────────────────────────── */

.right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #16213e;
    min-width: 300px;
}

.image-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.image-section + .image-section {
    flex: 2;
    border-top: 1px solid #21262d;
}

.image-label {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    background: #0d1117;
    color: #6e7681;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 8px;
    position: relative;
    min-height: 0;
}

.step-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

canvas.step-image {
    cursor: crosshair;
}

.image-placeholder {
    text-align: center;
    color: #484f58;
    font-size: 0.85rem;
}

.image-placeholder p {
    margin-top: 8px;
}

/* ── Add Part Modal — Search Results Grid ─────────────────────────── */

.modal-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.modal-search-row input[type="text"] {
    flex: 1;
}

.modal-search-row select {
    width: 180px;
    flex-shrink: 0;
}

.modal-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding: 4px;
}

.part-result-category-header {
    grid-column: 1 / -1;
    background: #2A4A7F;
    color: #e0e0e0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    margin: 4px 0 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.part-result-card {
    background: #1a1a2e;
    border: 2px solid #21262d;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    text-align: center;
}

.part-result-card:hover {
    border-color: #30363d;
    background: #2A4A7F;
}

.part-result-card.selected {
    border-color: #5B9BD5;
    background: rgba(21, 101, 192, 0.2);
}

.part-result-controls {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    justify-content: center;
    align-items: center;
}

.modal-color-select {
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 3px;
    padding: 2px 3px;
    font-size: 0.7rem;
    max-width: 110px;
}

.modal-qty-input {
    width: 40px;
    padding: 2px 4px;
    font-size: 0.75rem;
    background: #0d1117;
    color: #e0e0e0;
    border: 1px solid #30363d;
    border-radius: 3px;
    text-align: center;
}

.part-result-thumb {
    width: 100px;
    height: 75px;
    object-fit: contain;
    background: #0d1117;
    border-radius: 3px;
    margin: 0 auto 6px;
    display: block;
}

.part-result-id {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #5dade2;
    margin-bottom: 2px;
}

.part-result-name {
    font-size: 0.72rem;
    color: #c9d1d9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.part-result-check {
    position: absolute;
    top: 4px;
    right: 4px;
}

/* ── Export Options ────────────────────────────────────────────────── */

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Settings Page ─────────────────────────────────────────────────── */

.settings-page {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.settings-header h1 {
    flex: 1;
    font-size: 1.3rem;
}

.settings-autosave {
    color: #4CAF7A;
    font-size: 0.8rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Dual-list (MS Office style) ──────────────────────────────── */

.dual-list-container {
    display: flex;
    gap: 12px;
    align-items: stretch;
    height: calc(100vh - 160px);
}

.dual-list-panel {
    flex: 1;
    background: #16213e;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.dual-list-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #c9d1d9;
}

.dual-list-box {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #21262d;
    border-radius: 4px;
    background: #0d1117;
}

.dual-list-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #c9d1d9;
    border-bottom: 1px solid #161b22;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.dual-list-item:hover {
    background: #21262d;
}

.dual-list-item.active {
    background: #5B9BD5;
    color: #fff;
}

.dual-list-item.dragging {
    opacity: 0.4;
}

.dual-list-item.drag-over {
    border-top: 2px solid #4CAF7A;
}

.dual-list-pos {
    color: #6e7681;
    font-size: 0.7rem;
    min-width: 24px;
}

.dual-list-label {
    flex: 1;
}

.dual-list-arrows {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 0 4px;
}

.dual-list-reorder {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
}

.cat-toggle {
    cursor: pointer;
    font-size: 0.65rem;
    color: #8b949e;
    min-width: 16px;
    text-align: center;
    margin-right: 4px;
}

.cat-toggle:hover {
    color: #e0e0e0;
}

.cat-toggle-spacer {
    min-width: 16px;
    margin-right: 4px;
}

.dual-list-part {
    padding: 4px 10px;
}

.dual-list-partid {
    color: #5B9BD5;
    font-size: 0.7rem;
    min-width: 60px;
}

.settings-column {
    background: #16213e;
    border-radius: 8px;
    padding: 16px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

.settings-column h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.settings-hint {
    color: #8b949e;
    font-size: 0.75rem;
    margin-bottom: 12px;
}

.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    border: 1px solid #21262d;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: grab;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.sortable-item:hover {
    border-color: #30363d;
    background: #21262d;
}

.sortable-item.selected {
    border-color: #5B9BD5;
    background: rgba(91, 155, 213, 0.15);
}

.sortable-item.dragging {
    opacity: 0.5;
    border-color: #5B9BD5;
}

.sortable-item.drag-over {
    border-color: #4CAF7A;
    background: rgba(76, 175, 122, 0.1);
}

.sortable-handle {
    color: #484f58;
    cursor: grab;
    font-size: 0.9rem;
}

.sortable-label {
    flex: 1;
    font-size: 0.8rem;
    color: #e0e0e0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sortable-pos {
    color: #6e7681;
    font-size: 0.7rem;
    min-width: 20px;
    text-align: center;
}

.sortable-arrows {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sortable-arrows .arrow-btn {
    background: none;
    border: none;
    color: #6e7681;
    cursor: pointer;
    font-size: 0.6rem;
    padding: 0 4px;
    line-height: 1;
}

.sortable-arrows .arrow-btn:hover {
    color: #e0e0e0;
}

.sortable-thumb {
    width: 40px;
    height: 30px;
    object-fit: contain;
    background: #0d1117;
    border-radius: 2px;
}

.sortable-part-id {
    color: #5B9BD5;
    font-size: 0.7rem;
    min-width: 60px;
}

.empty-hint {
    color: #6e7681;
    font-size: 0.8rem;
    text-align: center;
    padding: 20px;
}

/* ── Admin Panel ───────────────────────────────────────────────────── */

.admin-panel {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

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

.admin-header h1 {
    font-size: 1.5rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #21262d;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th {
    background: #0d1117;
    color: #6e7681;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #21262d;
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #161b22;
    vertical-align: middle;
}

.admin-table tbody tr {
    background: #16213e;
    transition: background 0.1s;
}

.admin-table tbody tr:nth-child(even) {
    background: #1a1a2e;
}

.admin-table tbody tr:hover {
    background: rgba(15, 52, 96, 0.4);
}

.cell-actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.cell-date {
    color: #6e7681;
    font-size: 0.78rem;
    white-space: nowrap;
}

.empty-cell {
    text-align: center;
    color: #6e7681;
    padding: 32px 14px;
}

/* ── Badges ────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 10px;
    white-space: nowrap;
}

.badge-admin {
    background: rgba(15, 52, 96, 0.5);
    color: #5dade2;
}

.badge-user {
    background: rgba(110, 118, 129, 0.2);
    color: #6e7681;
}

.badge-active {
    background: rgba(43, 122, 11, 0.25);
    color: #4CAF7A;
}

.badge-inactive {
    background: rgba(192, 57, 43, 0.2);
    color: #E07070;
}

/* ── Password Display ──────────────────────────────────────────────── */

.password-display {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 1.1rem;
    color: #4CAF7A;
    text-align: center;
    margin: 12px 0;
    user-select: all;
    letter-spacing: 1px;
}

.help-text {
    font-size: 0.78rem;
    color: #6e7681;
    text-align: center;
}

.reset-pw-result p {
    text-align: center;
    margin-bottom: 4px;
}

/* ── Responsive: prevent columns from collapsing below min widths ── */

@media (max-width: 1200px) {
    .workspace-grid {
        grid-template-columns: 220px 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .workspace-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .sidebar {
        border-right: none;
        border-bottom: 1px solid #21262d;
        max-height: 180px;
    }
    .right-panel {
        max-height: 300px;
    }
}
