* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", Arial, sans-serif; color: #222; background: #f4f5f7; }
a { color: #1a5fb4; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0 0 8px; }

.topbar { background: #1f2d3d; color: #fff; display: flex; align-items: center; gap: 16px; padding: 8px 16px; }
.topbar .brand { font-weight: 600; font-size: 16px; color: #fff; }
.topbar .spacer { flex: 1; }
.topbar select { padding: 4px 6px; }
.topbar button { background: none; border: 1px solid #5c6b7a; color: #fff; padding: 4px 10px; cursor: pointer; border-radius: 3px; }

.nav { background: #fff; border-bottom: 1px solid #d9dce1; padding: 0 16px; display: flex; flex-wrap: wrap; }
.nav a { padding: 9px 12px; color: #333; border-bottom: 2px solid transparent; }
.nav a.active { border-bottom-color: #1a5fb4; color: #1a5fb4; font-weight: 600; }

.page { padding: 16px; max-width: 1280px; margin: 0 auto; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.head h1 { margin: 0; }
.muted { color: #6b7280; }
.small { font-size: 12px; }

.card { background: #fff; border: 1px solid #d9dce1; border-radius: 4px; padding: 12px; margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.stat .label { color: #6b7280; font-size: 12px; text-transform: uppercase; }
.stat .value { font-size: 20px; font-weight: 600; margin-top: 2px; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 6px 8px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
th { background: #f0f2f5; font-weight: 600; font-size: 12px; text-transform: uppercase; color: #4b5563; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.heading td { background: #f7f8fa; font-weight: 600; }
tr.total td { font-weight: 600; border-top: 1px solid #9ca3af; }
tr.voided td { color: #9ca3af; text-decoration: line-through; }
.table-wrap { overflow-x: auto; border: 1px solid #d9dce1; border-radius: 4px; }

form.inline { display: inline; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12px; color: #4b5563; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; max-width: 760px; }
.form-grid .wide { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select {
    padding: 6px 8px; border: 1px solid #c3c8d0; border-radius: 3px; font: inherit; background: #fff; min-width: 0; width: 100%;
}
.form-row input, .form-row select { width: auto; }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid #1a5fb4; background: #1a5fb4; color: #fff; border-radius: 3px; cursor: pointer; font: inherit; }
.btn:hover { text-decoration: none; background: #174f96; }
.btn.plain { background: #fff; color: #1a5fb4; }
.btn.danger { background: #fff; color: #b42318; border-color: #b42318; }
.btn.sm { padding: 2px 8px; font-size: 12px; }

.alert { padding: 8px 12px; border-radius: 3px; margin-bottom: 12px; border: 1px solid; }
.alert.success { background: #ecfdf3; border-color: #a6e3c0; color: #05603a; }
.alert.error { background: #fef3f2; border-color: #f5b5ae; color: #b42318; }
.alert ul { margin: 0; padding-left: 18px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #e5e7eb; color: #374151; }
.pager { margin-top: 10px; }
.pager nav > div:first-child { display: none; }
code.key { background: #fff8db; padding: 3px 6px; border: 1px solid #e6d58a; word-break: break-all; }

.login { max-width: 340px; margin: 80px auto; }

@media (max-width: 900px) { .grid.c4, .grid.c2, .form-grid { grid-template-columns: 1fr; } }

@media print {
    .topbar, .nav, .no-print, .alert { display: none !important; }
    body { background: #fff; }
    .page { padding: 0; max-width: none; }
    .table-wrap { border: 0; overflow: visible; }
}
