/* ─── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Navigation ───────────────────────────────── */
.nav {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}
.nav-brand:hover { text-decoration: none; }
.nav-link {
    font-size: 14px;
    color: #555;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.nav-link:hover { background: #f0f0f0; text-decoration: none; }

/* ─── Container ────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* ─── Workflow Bar ─────────────────────────────── */
.workflow-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.workflow-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
}
.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.workflow-arrow {
    color: #ccc;
    font-size: 16px;
}

/* ─── Page Header ──────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

/* ─── Buttons ──────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
}
.btn-primary:hover { background: #1557b0; }
.btn-danger {
    color: #d32f2f;
    border-color: #f0c0c0;
}
.btn-danger:hover { background: #fde8e8; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.inline-form { display: inline; }

/* ─── Table ────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}
.table th {
    font-weight: 600;
    color: #666;
    font-size: 13px;
    background: #fafafa;
}
.table tbody tr:hover { background: #fafafa; }
.cell-name { font-weight: 500; }
.cell-time { color: #888; font-size: 13px; white-space: nowrap; }
.cell-actions { white-space: nowrap; }
.cell-actions > * + * { margin-left: 4px; }

.code-tag {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: "SF Mono", "Menlo", monospace;
}
.code-large { font-size: 16px; padding: 6px 12px; }

/* ─── Status Badges ────────────────────────────── */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.status-active { background: #e6f7e6; color: #2e7d32; }
.status-warning { background: #fff3e0; color: #e65100; }
.status-expired { background: #fde8e8; color: #c62828; }
.status-muted { background: #f5f5f5; color: #999; }

/* ─── Card ──────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
}
.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.card-header-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.card-header-between h3 { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

/* ─── Grid ──────────────────────────────────────── */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .grid-2col { grid-template-columns: 1fr; }
}

/* ─── Form ──────────────────────────────────────── */
.card-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    max-width: 520px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
textarea.form-control { resize: vertical; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }
.required { color: #d32f2f; }
.form-actions { margin-top: 20px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; }

/* ─── Alert ─────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
}
.alert-error {
    background: #fde8e8;
    color: #c62828;
    border: 1px solid #f5c6c6;
}

/* ─── Empty State ───────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #999;
}

/* ─── Stats ─────────────────────────────────────── */
.stat-row {
    display: flex;
    gap: 24px;
}
.stat-item {
    text-align: center;
    padding: 16px 24px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
}
.stat-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: #1a73e8;
}
.stat-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}
.scan-list {
    max-height: 240px;
    overflow-y: auto;
}
.scan-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
}
.scan-time { color: #888; }
.scan-target { color: #555; }

/* ─── QR Code Display ──────────────────────────── */
.qrcode-display-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.qrcode-wrapper {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    display: inline-block;
    margin-bottom: 24px;
}
.qrcode-img-large {
    width: 240px;
    height: 240px;
    display: block;
}
.qrcode-info {
    max-width: 400px;
}
.qrcode-url {
    background: #f5f5f5;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    word-break: break-all;
}
.qrcode-url label { font-weight: 500; color: #666; }
.qrcode-hint {
    font-size: 14px;
    color: #888;
    margin-bottom: 20px;
}
.qrcode-download {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ─── Modal ─────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.modal h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

/* ─── Login Page ─────────────────────────────── */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.login-box h1 {
    text-align: center;
    font-size: 22px;
    margin-bottom: 28px;
    color: #333;
}
.login-box .form-group {
    margin-bottom: 20px;
}
.login-box input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.15s;
}
.login-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}
.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
    margin-top: 8px;
}
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}
.flash.error {
    background: #fde8e8;
    color: #c62828;
    border: 1px solid #f5c6c6;
}
.nav-right {
    margin-left: auto;
}

/* ─── Footer ──────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: #999;
}
.site-footer a {
    color: #999;
}
.site-footer a:hover {
    color: #666;
}
.login-icp {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}
.login-icp a {
    color: rgba(255,255,255,0.6);
}
.login-icp a:hover {
    color: rgba(255,255,255,0.9);
}
