:root {
    --bg-1: #f4f1ea;
    --bg-2: #e2f0ee;
    --card: #ffffff;
    --ink: #1f2a30;
    --muted: #55606a;
    --accent: #0a7f76;
    --accent-2: #d97706;
    --line: #d9e1e0;
    --shadow: 0 20px 40px rgba(20, 40, 38, 0.12);
    --radius: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Noto Sans", "DejaVu Sans", sans-serif;
    color: var(--ink);
    background: radial-gradient(80% 80% at 0% 0%, #fdf7ef 0%, var(--bg-1) 45%, var(--bg-2) 100%);
    min-height: 100vh;
    padding: 32px;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(10, 127, 118, 0.12) 1px, transparent 1px);
    background-size: 26px 26px;
    opacity: 0.35;
    pointer-events: none;
    z-index: -1;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 auto 28px;
    max-width: 1100px;
    animation: slideDown 600ms ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--accent), #0b4f4a);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
    letter-spacing: 0.08em;
    box-shadow: 0 12px 24px rgba(10, 79, 74, 0.28);
}

.brand-title {
    font-size: 1.45rem;
    font-weight: 700;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.95rem;
}

.pill {
    background: #fff6e7;
    color: #8a4b00;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 20px rgba(160, 100, 20, 0.15);
}

.shell {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.panel {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    animation: rise 650ms ease;
}

.panel h2,
.panel h3 {
    margin: 0 0 12px;
}

.muted {
    color: var(--muted);
    margin-top: 0;
}

.dropzone {
    position: relative;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    padding: 24px;
    background: #fdfdfb;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
    min-height: 200px;
}

.dropzone.dragover {
    border-color: var(--accent);
    box-shadow: 0 16px 32px rgba(10, 127, 118, 0.18);
    transform: translateY(-2px);
}

.dropzone-inner {
    display: grid;
    place-items: center;
    text-align: center;
    gap: 8px;
    height: 100%;
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(10, 127, 118, 0.12);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 600;
}

.dropzone-text {
    font-weight: 600;
}

.dropzone-hint {
    font-size: 0.9rem;
    color: var(--muted);
}

.dropzone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-meta {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
}

.meta-item strong {
    color: var(--ink);
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.workspace-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-list {
    display: grid;
    gap: 10px;
    min-height: 140px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fbfbfa;
    overflow: visible;
}

.file-item {
    display: grid;
    grid-template-columns: auto 96px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #eef2f1;
    box-shadow: 0 8px 16px rgba(31, 42, 48, 0.06);
    overflow: visible;
    position: relative;
}

.file-item.dragging {
    opacity: 0.6;
}

.file-item.drag-over {
    border-color: var(--accent);
    box-shadow: 0 12px 20px rgba(10, 127, 118, 0.12);
}

.file-handle {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #eef7f6;
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    cursor: grab;
}

.file-thumb {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    background: #f7f9f9;
    border: 1px solid #e4ecea;
    display: grid;
    place-items: center;
    overflow: hidden;
    position: relative;
    z-index: 1;
    transition: transform 160ms ease, box-shadow 160ms ease;
    transform-origin: left center;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center;
}

.file-item:hover .file-thumb,
.file-thumb:focus-within {
    transform: scale(1.05);
    box-shadow: 0 10px 24px rgba(31, 42, 48, 0.12);
    background: #ffffff;
}

.file-preview {
    position: absolute;
    left: 50%;
    top: 50%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: 0 24px 48px rgba(20, 30, 36, 0.28);
    border: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.98);
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    z-index: 10;
    max-width: min(720px, 80vw);
    max-height: min(720px, 80vh);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    max-width: min(720px, 80vw);
    max-height: min(720px, 80vh);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.file-thumb:hover + .file-preview,
.file-thumb:focus-within + .file-preview {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.file-info {
    font-size: 0.85rem;
    color: var(--muted);
}

.file-actions {
    display: flex;
    gap: 6px;
}

.session-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.summary-card {
    border-radius: 14px;
    border: 1px solid #e3ebe9;
    background: #f6f8f7;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--muted);
}

.summary-card strong {
    color: var(--ink);
    font-size: 1.05rem;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
    background: #eceff0;
    color: var(--ink);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(31, 42, 48, 0.12);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

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

.btn.success {
    background: #1a925d;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn.danger {
    border: 1px solid #d6452b;
    color: #b42318;
    background: #fff4f2;
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--line);
}

.btn.small {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

.dropzone.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.advanced {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: 12px 16px;
    background: #f9fbfb;
}

.advanced summary {
    font-weight: 600;
    cursor: pointer;
}

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 12px;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

.field input,
.field select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    font-family: inherit;
}

.status {
    min-height: 24px;
    color: var(--muted);
}

.status strong {
    color: var(--ink);
}

.queue-panel {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #e3ebe9;
    background: #f7f9f8;
    display: grid;
    gap: 10px;
}

.queue-title {
    font-weight: 700;
}

.queue-message {
    color: var(--muted);
}

.queue-progress {
    display: grid;
    gap: 8px;
}

.queue-bar {
    width: 100%;
    height: 10px;
    background: #e6efed;
    border-radius: 999px;
    overflow: hidden;
}

.queue-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(120deg, var(--accent), #5fc4bc);
    transition: width 220ms ease;
}

.queue-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--muted);
}

.queue-active {
    font-size: 0.9rem;
    color: var(--muted);
}

.visitor-meta {
    margin-top: 6px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.visitor-meta span + span::before,
.visitor-meta img + span::before {
    content: "·";
    margin: 0 6px 0 2px;
    opacity: 0.6;
}

.visitor-meta .flag-icon {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    object-fit: cover;
}

.note {
    margin: 24px auto 0;
    max-width: 1100px;
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.global-stats {
    margin: 24px auto 0;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(120deg, #fff6e7, #ffffff);
    border: 1px solid #f1dfc8;
}

.global-stats-count {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-2);
}

.note code {
    background: #f1f5f4;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.85rem;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 700px) {
    body {
        padding: 20px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .workspace-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .global-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .global-stats-count {
        font-size: 1.8rem;
    }

    .file-preview {
        left: 50%;
        top: 50%;
        width: 90vw;
        max-width: 90vw;
    }

    .file-preview img {
        max-width: 90vw;
        max-height: 80vh;
    }
}
