* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; color: #1f2933; background: #f4f6f8; }
a { color: #1a64c8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: #1f2933; color: #fff; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a, .topbar .link { color: #cfd8e3; }
.topbar .muted { color: #9aa5b1; margin-right: 8px; }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.card { background: #fff; border: 1px solid #e1e5ea; border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; }
.card.narrow { max-width: 380px; margin: 80px auto; }
.card.narrow label { display: block; margin-bottom: 12px; }
.card.narrow input { width: 100%; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e1e5ea; border-radius: 8px; overflow: hidden; margin-bottom: 16px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef1f4; }
th { background: #f8fafc; font-weight: 600; font-size: 13px; color: #52606d; }

input, select, button { font: inherit; padding: 6px 10px; border: 1px solid #cbd2d9; border-radius: 6px; background: #fff; }
button { background: #1a64c8; border-color: #1a64c8; color: #fff; cursor: pointer; }
button.secondary { background: #fff; color: #1a64c8; }
button.danger { background: #c62828; border-color: #c62828; }
button.link { background: none; border: none; color: #1a64c8; padding: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { display: inline; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 4px; }

.muted { color: #7b8794; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.badge.ok { background: #e3f6e8; color: #1e7b34; }
.badge.off { background: #eceff1; color: #616e7c; }
.badge.warn { background: #fff4e0; color: #a35a00; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.flash-success { background: #e3f6e8; color: #1e7b34; }
.flash-error { background: #fdecea; color: #b3261e; }
.pager { display: flex; gap: 16px; justify-content: center; }
.topbar nav a.active { color: #fff; font-weight: 600; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
.table-scroll > table { margin-bottom: 0; }

@media (max-width: 720px) {
    body { font-size: 15px; }
    .topbar { flex-wrap: wrap; gap: 6px 12px; padding: 10px 12px; }
    .topbar strong { flex: 1; }
    .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; gap: 18px; padding: 4px 0 2px; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .topbar nav a { padding: 4px 0; }

    main { margin: 12px auto; padding: 0 10px; }
    h1 { font-size: 19px; }
    .page-head { flex-wrap: wrap; gap: 8px; }
    .card { padding: 12px 14px; }
    .card.narrow { margin: 32px auto; }

    /* 16px stops iOS from zooming into fields; full-width controls are easier to tap. */
    input, select, button { font-size: 16px; min-height: 40px; }
    input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; }
    .row > input, .row > select, .row > button { flex: 1 1 100%; }
    .row > label.check:has(> input:not([type="checkbox"])) { flex: 1 1 100%; flex-wrap: wrap; }
    .row > label.check > input:not([type="checkbox"]) { flex: 1 1 100%; }
    .check { gap: 6px; min-height: 32px; }
    button.link { min-height: 0; }
    .page-head form.inline button { width: 100%; }

    /* Tables keep their columns; cells wrap, and only very wide tables scroll sideways (.table-scroll). */
    th, td { padding: 8px; }
    td button { min-height: 36px; padding: 6px 12px; }
    .hide-sm { display: none; }
}
