:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #dfe3e8;
  --text: #1c2431;
  --muted: #6b7684;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --ok: #0f7a3d;
  --ok-bg: #e7f6ed;
  --warn: #8a5a00;
  --warn-bg: #fdf3d8;
  --err: #a51b1b;
  --err-bg: #fdeaea;
  --info-bg: #eaf1fd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

header.top {
  background: #1e293b;
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 50px;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.top .brand { font-weight: 600; letter-spacing: .2px; }
header.top nav { display: flex; gap: 18px; flex: 1; }
header.top nav a { color: #c9d3e0; font-size: 13px; }
header.top nav a:hover, header.top nav a.on { color: #fff; text-decoration: none; }
header.top .user { color: #94a3b8; font-size: 12px; display: flex; align-items: center; gap: 12px; }
header.top .user form { margin: 0; }
header.top .user button {
  background: none; border: 1px solid #475569; color: #cbd5e1;
  border-radius: 4px; padding: 3px 9px; cursor: pointer; font-size: 12px;
}

main { padding: 20px; max-width: 1500px; margin: 0 auto; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card > h2 { display: flex; align-items: center; gap: 10px; }
.card .hint { color: var(--muted); font-size: 12px; font-weight: normal; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; background: #eef1f5; color: var(--muted); white-space: nowrap;
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.err { background: var(--err-bg); color: var(--err); }
.tag.info { background: var(--info-bg); color: var(--accent-dark); }

.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.msg.info { background: var(--info-bg); color: #14356e; }
.msg.error { background: var(--err-bg); color: var(--err); }

.issue { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.issue:last-child { border-bottom: none; }
.issue .body { flex: 1; }
.issue .where { color: var(--muted); font-size: 12px; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 5px; font: inherit; background: #fff; color: var(--text);
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.field { margin-bottom: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 140px; }
.check { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-size: 13px; }
.check input { width: auto; }
.check label { margin: 0; color: var(--text); font-size: 13px; }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 5px;
  padding: 7px 14px; font: inherit; cursor: pointer; display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-dark); text-decoration: none; }
button.ghost, .btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover, .btn.ghost:hover { background: #f1f3f6; }
button.danger { background: #b91c1c; }
button.small, .btn.small { padding: 3px 9px; font-size: 12px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
form.inline { display: inline; }

pre.code {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 6px;
  overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; max-height: 460px;
}
pre.diff { background: #fff; color: var(--text); border: 1px solid var(--line); }
pre.diff .add { background: #e7f6ed; color: #0f5132; display: block; }
pre.diff .del { background: #fdeaea; color: #842029; display: block; }

.stat { display: flex; gap: 14px; flex-wrap: wrap; }
.stat .box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 16px; min-width: 130px; flex: 1;
}
.stat .box .n { font-size: 24px; font-weight: 600; }
.stat .box .t { color: var(--muted); font-size: 12px; }
.stat .box.err .n { color: var(--err); }
.stat .box.warn .n { color: var(--warn); }

.gridwrap { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: 6px; }
table.sheet { font-size: 12px; white-space: nowrap; }
table.sheet th, table.sheet td { border: 1px solid var(--line); padding: 3px 7px; }
table.sheet th.col { cursor: pointer; background: #f1f3f6; text-align: center; min-width: 60px; }
table.sheet th.col:hover { background: #e2e8f0; }
table.sheet th.col.picked { background: var(--accent); color: #fff; }
table.sheet td.rownum, table.sheet th.rownum { background: #f8f9fb; color: var(--muted); text-align: right; }
table.sheet tr.skip td { color: #b6bcc6; }
table.sheet .role { display: block; font-size: 10px; opacity: .85; }

.roles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.roles .role {
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; background: #fff; min-width: 120px;
}
.roles .role.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.roles .role .name { font-size: 12px; color: var(--muted); }
.roles .role .val { font-weight: 600; }
.roles .role button { margin-top: 4px; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
