* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif; color: #1f2933; background: #f4f6f8; }
a { color: #1565c0; }
.top { display: flex; align-items: center; gap: 24px; padding: 8px 20px; background: #1e3a5f; color: #fff; flex-wrap: wrap; }
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 18px; }
.brand span { font-weight: 400; font-size: 13px; opacity: .75; margin-left: 6px; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 4px 10px; border-radius: 4px; }
.top nav a:hover, .top nav a.on { background: rgba(255,255,255,.15); }
.who { margin-left: auto; font-size: 13px; }
.who a, .who .link { color: #cfe2ff; }
main { padding: 16px 20px; max-width: 1500px; margin: 0 auto; }
footer { text-align: center; color: #8a96a3; font-size: 12px; padding: 20px; }
h1 { font-size: 22px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; color: #334e68; }
h3 { grid-column: 1 / -1; font-size: 13px; margin: 14px 0 2px; color: #486581; border-bottom: 1px solid #d9e2ec; padding-bottom: 3px; }
.muted { color: #627d98; }
.small { font-size: 12px; }
.red { color: #c62828; }
.r { text-align: right; }
.inline { display: inline; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.btns { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.head .btns { margin-top: 0; }
.btn { display: inline-block; padding: 6px 14px; border: 1px solid #9fb3c8; border-radius: 4px; background: #fff; color: #243b53; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f0f4f8; }
.btn.green { background: #2e7d32; border-color: #1b5e20; color: #fff; }
.btn.green:hover { background: #43a047; }
.btn.red { background: #c62828; border-color: #961414; color: #fff; }
.btn.red:hover { background: #e53935; }
.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.flash { padding: 8px 12px; border-radius: 4px; margin: 0 0 10px; background: #e3f2e6; border: 1px solid #a5d6a7; }
.flash.err { background: #fdecea; border-color: #f5b5b0; color: #8a1c1c; }
.login { max-width: 360px; margin: 40px auto; background: #fff; padding: 24px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.login label { display: block; margin: 10px 0; }
.login input { display: block; width: 100%; margin-top: 4px; }
input, select, textarea { font: inherit; padding: 5px 7px; border: 1px solid #bcccdc; border-radius: 4px; background: #fff; }
input[readonly], textarea[readonly], input:disabled { background: #eef2f6; color: #334e68; }
.menu { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 24px; max-width: 1000px; }
.menu h2 { margin-top: 0; }
.mbtn { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; margin: 0 0 8px; background: #e3f0fc; border: 1px solid #90c2f0; border-radius: 4px; color: #0b3d66; text-decoration: none; }
.mbtn:hover { background: #cfe5fa; }
.mbtn small { color: #627d98; font-size: 11px; }
.mbtn.off { background: #f0f2f4; border-color: #d3d9df; color: #8a96a3; }
.split { display: grid; grid-template-columns: minmax(320px, 2fr) 3fr; gap: 16px; align-items: start; }
.split.single { grid-template-columns: 1fr; }
.listbox, .recbox { background: #fff; border: 1px solid #d9e2ec; border-radius: 6px; padding: 12px; }
.search { display: flex; gap: 6px; margin-bottom: 8px; }
.search input { flex: 1; min-width: 160px; }
.scroll { max-height: 62vh; overflow: auto; border: 1px solid #e4e9ee; }
.scroll.tall { max-height: 70vh; }
table.grid { border-collapse: collapse; width: 100%; background: #fff; }
.grid th { position: sticky; top: 0; background: #e8eef4; text-align: left; font-weight: 600; font-size: 12px; padding: 5px 8px; border-bottom: 1px solid #c8d4e0; white-space: nowrap; }
.grid td { padding: 4px 8px; border-bottom: 1px solid #eef2f6; font-size: 13px; }
.grid tr[data-href] { cursor: pointer; }
.grid tr[data-href]:hover td { background: #f0f7ff; }
.grid tr.sel td { background: #fff3c4; }
.grid tr.tot td { font-weight: 600; background: #f4f6f8; }
.mode { font-weight: 700; font-size: 12px; color: #c62828; margin-bottom: 8px; }
.mode.editing { color: #2e7d32; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 18px; }
.fld { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.fld span { color: #486581; }
.fld input:not([type=checkbox]), .fld select, .fld textarea { width: 100%; }
.fld input[type=checkbox] { justify-self: start; width: 18px; height: 18px; }
.fld.wide { grid-column: 1 / -1; grid-template-columns: 150px 1fr; }
.del { margin-top: 10px; text-align: right; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.card { background: #fff; border: 1px solid #d9e2ec; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
@media (max-width: 900px) {
  .split, .menu { grid-template-columns: 1fr; }
  .fld, .fld.wide { grid-template-columns: 1fr; }
}
