* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; line-height: 1.6; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }

.navbar { background: #1a1a2e; color: white; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav-brand { color: white; font-size: 1.25rem; font-weight: 700; }
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: #ccc; font-size: 0.9rem; }
.nav-links a:hover { color: white; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 0.75rem; }
.nav-user-link { color: white; font-size: 0.9rem; }
.nav-user-link:hover { color: #ddd; }
.nav-logout { color: #ccc; border-color: #555; }
.nav-logout:hover { color: white; background: #333; }

.container { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }
.footer { text-align: center; padding: 2rem; color: #888; font-size: 0.85rem; }

h1 { margin-bottom: 1.5rem; font-size: 1.75rem; }
h2 { margin: 1.5rem 0 1rem; font-size: 1.25rem; }
h3 { margin-bottom: 0.5rem; font-size: 1rem; color: #555; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.btn { display: inline-block; padding: 0.5rem 1rem; border: 1px solid #ddd; border-radius: 6px; background: white; color: #333; cursor: pointer; font-size: 0.9rem; text-decoration: none; }
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: #007bff; color: white; border-color: #007bff; }
.btn-primary:hover { background: #0056b3; }
.btn-success { background: #28a745; color: white; border-color: #28a745; }
.btn-success:hover { background: #1e7e34; }
.btn-danger { background: #dc3545; color: white; border-color: #dc3545; }
.btn-danger:hover { background: #bd2130; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-group { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); text-align: center; }
.stat-card h3 { color: #666; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 2rem; font-weight: 700; color: #1a1a2e; margin-top: 0.25rem; }
.stat-normal .stat-value { color: #28a745; }
.stat-damaged .stat-value { color: #dc3545; }
.stat-unopened .stat-value { color: #ffc107; }
.stat-missing .stat-value { color: #dc3545; }

.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 1rem; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background: #f8f9fa; font-weight: 600; font-size: 0.85rem; color: #555; text-transform: uppercase; letter-spacing: 0.3px; }
.data-table tr:hover { background: #f8f9fa; }
.data-table.compact th, .data-table.compact td { padding: 0.5rem 0.75rem; font-size: 0.85rem; }
.actions { white-space: nowrap; }
.text-danger { color: #dc3545; font-weight: 600; }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; font-weight: 500; }
.badge-normal { background: #d4edda; color: #155724; }
.badge-damaged { background: #f8d7da; color: #721c24; }
.badge-unopened { background: #fff3cd; color: #856404; }
.badge-found { background: #d4edda; color: #155724; }
.badge-missing { background: #f8d7da; color: #721c24; }
.badge-super_admin { background: #6f42c1; color: white; }
.badge-admin { background: #fd7e14; color: white; }
.badge-user { background: #17a2b8; color: white; }

.form { background: white; border-radius: 8px; padding: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); max-width: 600px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.9rem; }
.form-group small { font-weight: normal; color: #888; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #007bff; box-shadow: 0 0 0 2px rgba(0,123,255,0.25); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: end; background: white; padding: 1rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.filter-bar input, .filter-bar select { padding: 0.5rem 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.9rem; }
.filter-bar input { flex: 1; min-width: 200px; }

.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; }
.detail-card { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 1rem; }
.detail-card dl { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem 1rem; }
.detail-card dt { font-weight: 600; color: #555; font-size: 0.85rem; }
.detail-card dd { font-size: 0.95rem; }
.asset-number { font-size: 1.1rem; background: #f0f2f5; padding: 0.2rem 0.5rem; border-radius: 4px; }
.qr-card { text-align: center; }
.qr-image { width: 100%; max-width: 200px; margin: 1rem 0; }
.asset-number-large { font-size: 1.5rem; font-weight: 700; font-family: monospace; letter-spacing: 3px; }

.check-layout { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
.scan-panel { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); position: sticky; top: 1rem; }
.scan-form { margin-bottom: 1rem; }
.asset-input { font-size: 1.2rem !important; font-family: monospace !important; letter-spacing: 2px !important; text-transform: uppercase; }
.complete-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eee; }
.checked-panel { background: white; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.row-found { background: #f8fff8; }
.row-missing { background: #fff8f8; }
.row-damaged { background: #fffaf0; }

.remaining-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.remaining-item { background: #f0f2f5; padding: 0.25rem 0.5rem; border-radius: 4px; font-family: monospace; font-size: 0.85rem; }

.report-summary { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.report-summary .stat-card { flex: 1; min-width: 140px; }

.empty-state { text-align: center; padding: 3rem; color: #888; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.info-text { color: #666; font-size: 0.9rem; }

/* Login page */
.login-page { background: #1a1a2e; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-container { width: 100%; max-width: 400px; padding: 1.5rem; }
.login-card { background: white; border-radius: 12px; padding: 2.5rem; box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.login-card h1 { text-align: center; margin-bottom: 0.25rem; font-size: 1.5rem; color: #1a1a2e; }
.login-subtitle { text-align: center; color: #888; margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; }

/* TOTP input */
.totp-input { font-size: 1.5rem !important; font-family: monospace !important; letter-spacing: 8px !important; text-align: center; }

/* Profile */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; }

/* Permissions grid */
.permissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; padding: 0.4rem 0.6rem; background: #f8f9fa; border-radius: 4px; cursor: pointer; }
.checkbox-label:hover { background: #e9ecef; }
.checkbox-label input[type="checkbox"] { width: auto; }

@media (max-width: 768px) {
    .detail-grid, .check-layout { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .scan-panel { position: static; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .profile-grid, .settings-grid { grid-template-columns: 1fr; }
    .navbar { flex-wrap: wrap; height: auto; padding: 0.75rem 1rem; gap: 0.5rem; }
    .nav-links { gap: 0.75rem; flex-wrap: wrap; }
    .nav-user { width: 100%; justify-content: space-between; }
}

/* Settings / option management */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.option-list { list-style: none; padding: 0; margin: 1rem 0 0 0; }
.option-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.option-list li:last-child { border-bottom: none; }
.option-list span { font-size: 0.95rem; }
.option-add { display: flex; gap: 0.5rem; margin-top: 1rem; }
.option-add input { flex: 1; }
