*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f4f8; color: #1a202c; min-height: 100vh; }
header { background: linear-gradient(135deg, #1a56db, #0e3a9a); color: white; padding: 18px 32px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
header .logo { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.5px; }
header .subtitle { font-size: 0.85rem; opacity: 0.8; margin-top: 2px; }
header .user { font-size: 0.8rem; opacity: 0.9; text-align: right; }
header .user strong { display: block; }
.tab-bar { background: white; border-bottom: 2px solid #e2e8f0; display: flex; padding: 0 32px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); overflow-x: auto; }
.tab-btn { padding: 14px 22px; border: none; background: transparent; font-size: 0.9rem; font-weight: 600; color: #718096; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color 0.15s; display: flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 0; }
.tab-btn:hover { color: #1a56db; }
.tab-btn.active { color: #1a56db; border-bottom-color: #1a56db; }
.tab-btn:active { transform: none; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.container { max-width: 1300px; margin: 32px auto; padding: 0 20px; }
.card { background: white; border-radius: 12px; box-shadow: 0 1px 6px rgba(0,0,0,0.08); padding: 28px 32px; margin-bottom: 28px; }
.card h2 { font-size: 1.05rem; font-weight: 700; color: #1a56db; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 24px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group.hidden { display: none; }
label { font-size: 0.78rem; font-weight: 600; color: #4a5568; text-transform: uppercase; letter-spacing: 0.4px; }
label .required { color: #e53e3e; margin-left: 2px; }
input, select { padding: 9px 12px; border: 1.5px solid #cbd5e0; border-radius: 7px; font-size: 0.93rem; color: #2d3748; background: #f7fafc; transition: border-color 0.2s; outline: none; width: 100%; }
input:focus, select:focus { border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,0.12); background: white; }
input.error, select.error { border-color: #e53e3e; }
.input-prefix-wrap { position: relative; display: flex; align-items: center; }
.input-prefix-wrap .prefix { position: absolute; left: 11px; font-size: 0.85rem; color: #718096; font-weight: 600; pointer-events: none; }
.input-prefix-wrap input { padding-left: 34px; }
.input-prefix-wrap .suffix { position: absolute; right: 11px; font-size: 0.85rem; color: #718096; font-weight: 600; pointer-events: none; }
.input-prefix-wrap input.has-suffix { padding-left: 12px; padding-right: 32px; }
.radio-group { display: flex; gap: 20px; align-items: center; padding: 9px 0; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: #2d3748; cursor: pointer; }
.radio-group input[type="radio"] { width: auto; margin: 0; }
.form-section-divider { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.form-section-divider.hidden { display: none; }
.form-section-divider .divider-label { font-size: 0.78rem; font-weight: 700; color: #2c5282; background: #ebf4ff; padding: 3px 12px; border-radius: 20px; white-space: nowrap; }
.form-section-divider hr { flex: 1; border: none; border-top: 1.5px solid #e2e8f0; }
.btn-row { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
button { padding: 10px 22px; border: none; border-radius: 7px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: background 0.15s, transform 0.1s; }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: #1a56db; color: white; }
.btn-primary:hover { background: #1648c0; }
.btn-secondary { background: #e2e8f0; color: #2d3748; }
.btn-secondary:hover { background: #cbd5e0; }
.btn-danger { background: #fff5f5; color: #c53030; border: 1.5px solid #fed7d7; }
.btn-danger:hover { background: #fed7d7; }
.btn-export { background: #276749; color: white; }
.btn-export:hover { background: #1e5237; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-motor { background: #2c5282; color: white; }
.btn-motor:hover { background: #2a4a75; }
.btn-motorcycle { background: #6b46c1; color: white; }
.btn-motorcycle:hover { background: #553c9a; }
.btn-nonmotor { background: #744210; color: white; }
.btn-nonmotor:hover { background: #5f3510; }
.btn-inspect { background: #276749; color: white; }
.btn-inspect:hover { background: #1e5237; }
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.table-header h2 { margin-bottom: 0; }
.search-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box input { padding: 7px 12px; font-size: 0.85rem; border-radius: 7px; width: 220px; }
.search-box select { width: auto; padding: 6px 8px; font-size: 0.85rem; }
.search-box .per-page { font-size: 0.75rem; font-weight: 600; color: #4a5568; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead th { background: #ebf4ff; color: #2c5282; font-weight: 700; padding: 10px; text-align: left; white-space: nowrap; border-bottom: 2px solid #bee3f8; }
thead th.num-col { text-align: right; }
tbody tr { border-bottom: 1px solid #e2e8f0; transition: background 0.1s; }
tbody tr:hover { background: #f7fafc; }
tbody td { padding: 8px 10px; vertical-align: middle; }
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody td.actions { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.badge-entity { background: #e9d8fd; color: #553c9a; }
.badge-personal { background: #c6f6d5; color: #22543d; }
.badge-motor { background: #bee3f8; color: #2c5282; }
.badge-fire { background: #feebc8; color: #7b341e; }
.empty-state { text-align: center; padding: 48px 20px; color: #a0aec0; }
.empty-state p { font-size: 0.95rem; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.record-count { font-size: 0.8rem; color: #718096; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pager button { padding: 5px 11px; font-size: 0.8rem; background: #e2e8f0; color: #2d3748; }
.pager button.current { background: #1a56db; color: white; }
.pager span { color: #718096; font-size: 0.8rem; }
.report-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.report-row label { font-size: 0.8rem; font-weight: 600; color: #4a5568; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.report-row input[type="month"] { width: auto; }
.loading { opacity: 0.5; pointer-events: none; }
.toast { position: fixed; bottom: 24px; right: 24px; left: auto; max-width: calc(100vw - 32px); background: #2d3748; color: white; padding: 12px 20px; border-radius: 8px; font-size: 0.88rem; box-shadow: 0 4px 16px rgba(0,0,0,0.25); opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; z-index: 9999; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #276749; }
.toast.error { background: #c53030; }

@media (max-width: 640px) {
  header { padding: 14px 16px; }
  .tab-bar { padding: 0 8px; }
  .tab-btn { padding: 12px 12px; }
  .container { margin: 16px auto; padding: 0 16px; }
  .card { padding: 18px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }
  .search-box { width: 100%; }
  .toast { right: 16px; bottom: 16px; }
}
