:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18202a;
  --line: #243040;
  --text: #d8e0ea;
  --dim: #8796a8;
  --accent: #e2a03f;
  --accent-2: #4fb3d9;
  --bad: #e06464;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, select, input { font: inherit; color: inherit; }
button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent-2); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
select, input[type=search] {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
input[type=search] { flex: 1; min-width: 180px; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 18px; letter-spacing: .5px; margin-right: auto; }
.brand b { color: var(--accent); }
.status { color: var(--dim); font-size: 13px; }
.status.working::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  border: 2px solid var(--accent-2); border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.field { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 13px; }

.banner { margin: 12px 20px 0; padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: #2a1f0e; }
.banner.small { margin: 0 0 12px; font-size: 13px; }

.layout { display: grid; grid-template-columns: 290px 1fr; gap: 20px; padding: 20px; align-items: start; }
aside { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 72px; }
aside h2 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.hint { color: var(--dim); font-size: 12px; margin: 12px 0 0; }

.owner { display: flex; align-items: center; gap: 4px; padding: 6px 4px; border-radius: 6px; }
.owner:hover { background: var(--panel-2); }
.owner.corp { margin-left: 18px; }
.owner label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.owner img { width: 34px; height: 34px; border-radius: 4px; background: var(--panel-2); }
.owner span { display: flex; flex-direction: column; min-width: 0; }
.owner b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.owner small { color: var(--dim); font-size: 12px; }
.warn { color: var(--bad); }
button.icon { padding: 0 7px; background: none; border-color: transparent; color: var(--dim); font-size: 18px; }
button.icon:hover { color: var(--bad); border-color: transparent; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat span { display: block; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat:first-child b { color: var(--accent); }
.stat small { display: block; color: var(--dim); font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters select { max-width: 280px; }

.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  border: 0; border-radius: 0; background: none; padding: 10px 14px;
}
.group-head:hover { background: var(--panel-2); }
.group.open .group-head { border-bottom: 1px solid var(--line); }
.caret { color: var(--dim); width: 12px; }
.gname { flex: 1; font-weight: 600; }
.share { color: var(--dim); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.countdown { color: var(--dim); }
.countdown.ready { color: #6cc28a; }
.group-head b { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; }

table { width: 100%; border-collapse: collapse; background: var(--panel); }
main > #content > table { border: 1px solid var(--line); border-radius: var(--radius); }
th, td { padding: 6px 10px; border-bottom: 1px solid #1b2430; text-align: left; vertical-align: middle; }
th { color: var(--dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; background: var(--panel-2); position: sticky; top: 52px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.on { color: var(--text); }
tr:hover td { background: #151d27; }
tr.click { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dim { color: var(--dim); }
.item { display: flex; align-items: center; gap: 8px; }
.item img { width: 28px; height: 28px; flex: none; }
.item small { display: block; color: var(--accent-2); font-size: 12px; }
.tag { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #2b3a4d; color: var(--accent-2); }
.more { display: block; margin: 10px auto; }

.empty { color: var(--dim); }
.empty.big { padding: 60px 20px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent-2); padding: 10px 14px; border-radius: 6px; max-width: 420px; box-shadow: 0 6px 20px #0008; }
.toast.error { border-left-color: var(--bad); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  aside { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; }
  th { position: static; }
}
