* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; color: #1f2937; background: #f3f4f6; }
a { color: #3b44c4; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    background: #3b44c4; color: #fff; padding: 12px 24px; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 16px; }
.topbar nav a { color: #fff; text-decoration: none; margin-left: 18px; opacity: .9; }
.topbar nav a:hover { opacity: 1; text-decoration: underline; }
.wrap { max-width: 1150px; margin: 24px auto; padding: 0 16px; }
.flash { background: #ecfdf5; border: 1px solid #10b981; color: #065f46; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.error { background: #fef2f2; border: 1px solid #ef4444; color: #991b1b; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 14px; font-size: 16px; color: #3b44c4; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h1 { margin: 0; font-size: 20px; }
.btn { display: inline-block; border: 0; border-radius: 6px; padding: 8px 14px; background: #3b44c4; color: #fff;
    text-decoration: none; cursor: pointer; font-size: 14px; }
.btn:hover { background: #2f37a3; }
.btn.light { background: #e5e7eb; color: #111827; }
.btn.danger { background: #dc2626; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 9px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
table.list th { background: #f9fafb; font-weight: 600; }
table.list td.actions { white-space: nowrap; }
.table-scroll { overflow-x: auto; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g4 { grid-template-columns: repeat(4, 1fr); }
.full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
label small { font-weight: 400; color: #6b7280; }
input[type=text], input[type=date], input[type=number], input[type=email], textarea, select {
    width: 100%; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 5px; font: inherit; background: #fff; }
textarea { min-height: 60px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid #a5b4fc; border-color: #6366f1; }
.ref-badge { display: inline-block; background: #eef2ff; color: #3b44c4; font-weight: 700; padding: 4px 10px; border-radius: 4px; }
.calc { background: #f9fafb; border: 1px dashed #c7d2fe; border-radius: 6px; padding: 12px; margin-top: 12px; line-height: 1.8; }
.calc b { color: #111827; }
.area-table { width: 100%; border-collapse: collapse; }
.area-table td, .area-table th { padding: 4px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.thumbs figure { margin: 0; text-align: center; font-size: 12px; }
.thumbs img { width: 120px; height: 90px; object-fit: cover; border: 1px solid #d1d5db; border-radius: 4px; display: block; }
.search { display: flex; gap: 8px; }
.search input { width: 280px; }
.muted { color: #6b7280; }
.pager { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 10px; border-radius: 4px; background: #fff; text-decoration: none; border: 1px solid #e5e7eb; }
.pager span { background: #3b44c4; color: #fff; }
.form-actions { position: sticky; bottom: 0; background: #f3f4f6; padding: 12px 0; display: flex; gap: 10px; }
@media (max-width: 760px) {
    .grid, .grid.g3, .grid.g4 { grid-template-columns: 1fr; }
    .search input { width: 100%; }
    .topbar nav a { margin: 0 14px 0 0; }
}
