:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --secondary: #0f172a;
    --bg-main: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden { display: none !important; }
.text-accent { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.inline-form { display: inline; }

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 68px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.25rem;
}
.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.role-badge {
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 99px;
    vertical-align: middle;
}
.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.admin-greeting {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.btn-sm { padding: 7px 13px; font-size: 0.84rem; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #1e293b; }

.btn-outline {
    background: var(--surface);
    color: var(--text-main);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-main); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text-main); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border-color: #fecaca;
}
.btn-danger-outline:hover { background: var(--danger-soft); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.main-hero {
    padding: 48px 20px 72px;
}
.hero-header {
    text-align: center;
    max-width: 660px;
    margin: 0 auto 36px;
}
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 6px 14px;
    border-radius: 99px;
    margin-bottom: 14px;
}
.hero-header h1 {
    font-size: clamp(1.85rem, 3.5vw, 2.65rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.02rem;
}

.upload-workspace {
    max-width: 560px;
    margin: 0 auto;
}
.upload-card, .result-card {
    padding: 28px;
}

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.2s ease;
    margin-bottom: 18px;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.dropzone-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 10px;
}
.dropzone h3 {
    font-size: 1.08rem;
    margin-bottom: 4px;
}
.dropzone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}
.file-specs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.file-specs span {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 99px;
}

.selected-file-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-soft);
    border: 1px solid #bfdbfe;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
}
.file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.file-meta i {
    font-size: 1.4rem;
    color: var(--primary);
}
.file-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
}
.file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
}

.result-card {
    text-align: center;
}
.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-soft);
    color: var(--success);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 5px 12px;
    border-radius: 99px;
    margin-bottom: 10px;
}
.result-filename {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 18px;
    word-break: break-all;
}
.qr-stage {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 18px;
}
.qr-stage.compact { padding: 16px; }
.qr-box img, .qr-box canvas {
    display: block;
    margin: 0 auto;
}

.url-copy-group {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}
.url-copy-group input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-size: 0.85rem;
    color: var(--text-main);
}
.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.reset-btn { margin-top: 6px; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 56px;
}
.feature-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.feature-item h4 { margin-bottom: 6px; font-size: 1rem; }
.feature-item p { color: var(--text-muted); font-size: 0.88rem; }

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card { padding: 34px 30px; }
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.auth-header h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-header p { color: var(--text-muted); font-size: 0.9rem; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-icon-wrap input { padding-left: 38px !important; }
.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.86rem;
}
.auth-footer a { color: var(--text-muted); text-decoration: none; }
.auth-footer a:hover { color: var(--primary); }

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.admin-main { padding: 32px 20px 64px; }
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.dashboard-header h1 { font-size: 1.55rem; }
.dashboard-header p { color: var(--text-muted); font-size: 0.9rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.stat-icon.blue { background: #eff6ff; color: #2563eb; }
.stat-icon.red { background: #fef2f2; color: #dc2626; }
.stat-icon.green { background: #f0fdf4; color: #16a34a; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.stat-value { font-size: 1.3rem; font-weight: 700; }

.table-card { overflow: hidden; }
.table-toolbar {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}
.search-box i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 9px 13px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
}
.filter-controls select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--surface);
}

.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    text-align: left;
    padding: 12px 18px;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:hover td { background: #f8fafc; }

.doc-title-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 290px;
}
.file-badge {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.badge-pdf { background: #fef2f2; color: #dc2626; }
.badge-img { background: #eff6ff; color: #2563eb; }
.doc-name-text {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ext-pill {
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 5px;
}
.uuid-code {
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 3px 7px;
    border-radius: 4px;
    color: #334155;
}

.action-btn-group {
    display: inline-flex;
    gap: 6px;
}
.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn-action:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.btn-action.delete:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.empty-table-cell {
    text-align: center;
    padding: 48px 20px !important;
    color: var(--text-muted);
}
.empty-table-cell i { font-size: 2rem; margin-bottom: 8px; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}
.modal-dialog {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.modal-dialog.modal-sm { max-width: 400px; }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.modal-doc-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 14px;
    word-break: break-all;
}

.details-list {
    display: grid;
    grid-template-columns: 135px 1fr;
    gap: 10px 12px;
    font-size: 0.88rem;
}
.details-list dt { font-weight: 600; color: var(--text-muted); }
.details-list dd { word-break: break-all; }

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--secondary);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .result-actions { grid-template-columns: 1fr; }
}
