:root {
  --bg: #f4f5f7;
  --surface: #fff;
  --line: #dde1e6;
  --text: #1c2430;
  --muted: #667085;
  --accent: #1f4e8c;
  --danger: #b42318;
  --side: #1b2533;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

h1 { margin: 0; font-size: 20px; font-weight: 600; }
h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
a { color: var(--accent); }

input, select {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 4px;
  padding: 0 10px;
  border: 1px solid #c6ccd4;
  border-radius: 4px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}

input[type="file"] { padding: 6px; height: auto; }
input[type="checkbox"] { display: inline-block; width: auto; height: auto; margin: 0 8px 0 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-block;
  height: 36px;
  padding: 0 14px;
  border: 1px solid #c6ccd4;
  border-radius: 4px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  line-height: 34px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover { background: #eef1f4; }
.btn.primary { border-color: var(--accent); color: #fff; background: var(--accent); }
.btn:disabled { opacity: 0.6; cursor: default; }
.error { min-height: 1.5em; margin: 0 0 8px; color: var(--danger); }

.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-box { width: 100%; max-width: 360px; padding: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.auth-box > p:first-of-type { margin: 4px 0 20px; color: var(--muted); }
.auth-box .btn { width: 100%; margin-bottom: 12px; }

.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; color: #c9d1dc; background: var(--side); }
.side-title { padding: 18px 20px; color: #fff; font-weight: 600; border-bottom: 1px solid #2f3b4c; }
.side-title small { display: block; color: #93a0b2; font-weight: 400; }
.side nav { display: flex; flex-direction: column; padding: 10px 0; }

.side a, .side button {
  display: block;
  padding: 9px 20px;
  border: 0;
  border-left: 3px solid transparent;
  color: inherit;
  background: none;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.side a:hover, .side button:hover { color: #fff; background: #243043; }
.side a[aria-current="page"] { border-left-color: #6ea8fe; color: #fff; background: #243043; }
.side-foot { margin-top: auto; padding: 10px 0; border-top: 1px solid #2f3b4c; }
.side-foot button { width: 100%; }

.main { padding: 20px 28px 48px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools input, .tools select { width: auto; min-width: 200px; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.stat { padding: 14px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat span { display: block; color: var(--muted); font-size: 12.5px; }
.stat strong { font-size: 24px; font-weight: 600; }

.panel { margin-bottom: 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.panel.table { padding: 0; overflow-x: auto; }
.panel.table > h2 { padding: 14px 18px 0; }
.panel.narrow { max-width: 460px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafbfc; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
td small { display: block; color: var(--muted); }
.actions { text-align: right; white-space: nowrap; }
.link { padding: 0 6px; border: 0; color: var(--accent); background: none; font: inherit; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }
.empty { padding: 24px 18px; color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 3px; font-size: 12px; white-space: nowrap; }
.tag.good { border-color: #a6d9b8; color: #16643a; background: #eef8f1; }
.tag.bad { border-color: #f1b8b2; color: var(--danger); background: #fdf1f0; }

dialog { max-height: calc(100vh - 32px); width: min(480px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
dialog::backdrop { background: rgba(16, 24, 40, 0.5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.hint { margin: -6px 0 12px; color: var(--muted); font-size: 12.5px; }
.notice { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 10px 16px; border-radius: 4px; color: #fff; background: #1c2430; }
.notice.bad { background: var(--danger); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: flex; margin: 0; }
  .main { padding: 16px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
}
