:root {
    --bg: #f5f6f8;
    --panel: #fff;
    --text: #1f2933;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #2563eb;
    --ok: #15803d;
    --warn: #b45309;
    --err: #b91c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: #111827;
    color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 16px; }
.topbar .brand small { color: #9ca3af; font-weight: 400; margin-left: 8px; font-size: 12px; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a, .topbar nav .link { color: #d1d5db; }
.topbar nav a.active { color: #fff; font-weight: 700; }
.topbar form { margin: 0; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.narrow { max-width: 440px; margin: 64px auto; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.header-row h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: #dcfce7; color: var(--ok); }
.badge.off { background: #f3f4f6; color: var(--muted); }
.badge.bad { background: #fee2e2; color: var(--err); }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { background: #dcfce7; color: var(--ok); }
.flash.warn { background: #fef3c7; color: var(--warn); }
.flash.err { background: #fee2e2; color: var(--err); }

label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.error { color: var(--err); font-size: 12px; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 80px; }

button, .button {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .button:hover { background: #f9fafb; text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.danger { border-color: #fca5a5; color: var(--err); }
button.danger:hover { background: #fef2f2; }
button.link { border: none; background: none; padding: 0; color: var(--accent); }
button.small { padding: 3px 10px; font-size: 12px; }

.creds { display: grid; grid-template-columns: 180px 1fr auto; gap: 0; }
.creds > div { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.creds .k { color: var(--muted); }
.creds .v { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; padding-right: 12px; }
.creds .c { justify-content: flex-end; }

pre.guide {
    white-space: pre-wrap;
    background: #f9fafb;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 14px;
    font-size: 13px;
    max-height: 420px;
    overflow: auto;
}

.qr svg { width: 200px; height: 200px; }
.codes { columns: 2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.pagination { display: flex; gap: 6px; list-style: none; padding: 0; }
