: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); }
.version { font-size: 12px; color: var(--dim); letter-spacing: 0; margin-left: 4px; vertical-align: 2px; }
.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: 320px 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; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.aside-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.aside-head .all { display: flex; align-items: center; gap: 8px; cursor: pointer; padding-left: 4px; }
.aside-head .all input { margin: 0; }
.aside-head select { padding: 3px 6px; font-size: 12px; }
#owners h3 { margin: 10px 0 2px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); }
.hint { color: var(--dim); font-size: 12px; margin: 12px 0 0; }

.owner { display: flex; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 6px; }
.owner:hover { background: var(--panel-2); }
.owner.off { opacity: .55; }
.owner label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.owner input { flex: none; margin: 0; }
.owner img { flex: none; width: 34px; height: 34px; border-radius: 4px; background: var(--panel-2); }
.owner .info { flex: 1; min-width: 0; }
.owner .top { display: flex; align-items: baseline; gap: 8px; }
.owner .top b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.owner .isk { flex: none; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.owner small { display: block; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-space { width: 27px; flex: none; }
.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: 230px; }
.gname small { display: block; font-weight: 400; color: var(--dim); font-size: 12px; }

.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; }
}

/* ================================================================ EveSkillsheet additions */
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.brand { color: var(--text); }
.brand:hover { text-decoration: none; }
.good { color: #6cc28a; }
.accent { color: var(--accent); }
.warn { color: var(--bad); }
button.danger { border-color: #5a2a2a; color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--bad); }
button.big { padding: 12px 22px; font-size: 15px; }
.btn { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; color: var(--text); }
.btn:hover { border-color: var(--accent-2); text-decoration: none; }

/* character list */
aside h2 { margin-bottom: 8px; }
.char { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 6px; cursor: pointer; width: 100%; text-align: left; border: 1px solid transparent; background: none; }
.char:hover { background: var(--panel-2); border-color: transparent; }
.char.sel { background: var(--panel-2); border-color: var(--line); }
.char img { flex: none; width: 34px; height: 34px; border-radius: 4px; background: var(--panel-2); }
.char .allicon { flex: none; width: 34px; height: 34px; border-radius: 4px; background: #241a0c; color: var(--accent); display: grid; place-items: center; font-size: 18px; }
.char .info { flex: 1; min-width: 0; }
.char .top { display: flex; align-items: baseline; gap: 6px; }
.char .top b { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.char .sp { margin-left: auto; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; flex: none; }
.char small { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char.all { margin-bottom: 6px; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; padding-bottom: 10px; }
em.main, em.shared { font-style: normal; font-size: 9px; letter-spacing: .8px; padding: 1px 5px; border-radius: 3px; flex: none; }
em.main { background: #3a2a10; color: var(--accent); }
em.shared { background: #12303d; color: var(--accent-2); }
button.icon.confirm { font-size: 11px; color: var(--bad); border-color: var(--bad); padding: 2px 6px; }

/* overview */
table.overview { border: 1px solid var(--line); border-radius: var(--radius); }
table.overview td small { display: block; font-size: 12px; }
.lvl { color: var(--accent); }

/* sheet header */
.sheet-head { display: flex; gap: 18px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.portrait { width: 96px; height: 96px; border-radius: 6px; border: 1px solid var(--line); flex: none; background: var(--panel-2); }
.who { flex: 1; min-width: 0; }
.who h1 { margin: 0 0 4px; font-size: 24px; }
.aff { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 4px; }
.aff span { display: inline-flex; align-items: center; gap: 6px; }
.aff img { width: 20px; height: 20px; border-radius: 3px; }
.meta { font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.verified { color: #6cc28a; border: 1px solid #2c5a3d; background: #10231a; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.stat small { margin-top: 2px; }
.stat b small { font-size: 12px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 14px; color: var(--dim); }
.tabs button:hover { color: var(--text); border-color: transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs i { font-style: normal; font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 0 6px; margin-left: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.legend { margin-left: auto; color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.legend .pip { margin-left: 8px; }

/* groups (details) */
details.group > summary { list-style: none; cursor: pointer; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; color: var(--dim); width: 12px; }
details.group[open] > summary::before { content: "▾"; }
details.group[open] > summary { border-bottom: 1px solid var(--line); }
.group-head b { min-width: 70px; }

/* skills */
.skill-list { padding: 4px 0; }
.skill { display: grid; grid-template-columns: 1fr auto 100px; gap: 14px; align-items: center; padding: 5px 14px 5px 38px; }
.skill:hover { background: #151d27; }
.skill.missing .sname { color: var(--dim); }
.sname small { color: var(--dim); font-size: 11px; margin-left: 4px; }
.pips { display: flex; gap: 3px; }
.pips i, .pip { display: inline-block; width: 14px; height: 10px; border: 1px solid #344458; background: #0f141b; border-radius: 1px; }
.pips i.on, .pip.on { background: var(--accent-2); border-color: var(--accent-2); }
.pips i.on.alpha, .pip.on.alpha { background: #2b4d5c; border-color: #3f7489; }
.pips i.queued, .pip.queued { background: repeating-linear-gradient(45deg, #5b4419 0 3px, #2a200d 3px 6px); border-color: var(--accent); }

/* queue */
table.queue { border: 1px solid var(--line); border-radius: var(--radius); }
.bar { height: 8px; background: #0f141b; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; min-width: 120px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), #7fd0ec); }

/* ships */
.meter-sm { width: 90px; height: 6px; background: #0f141b; border-radius: 3px; overflow: hidden; }
.meter-sm i { display: block; height: 100%; background: #6cc28a; }
.ship-list { padding: 4px 0; }
.ship { padding: 0 14px 0 38px; cursor: pointer; }
.ship:hover { background: #151d27; }
.ship-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.ship-row .sname { flex: 1; }
.ship:not(.ok) .ship-row img { opacity: .55; }
.ship.ok .sname { font-weight: 600; }
.missing-list { margin: 0 0 10px 38px; padding: 8px 12px; list-style: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.missing-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13px; }
.missing-list em { color: var(--bad); font-style: normal; font-size: 12px; }

/* attributes & clones */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.panel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.attr { display: grid; grid-template-columns: 100px 1fr 34px; gap: 12px; align-items: center; padding: 6px 0; }
.attr .bar { height: 10px; }
.attr b { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span small { display: block; font-size: 12px; }
.implants { display: grid; gap: 4px; margin-bottom: 10px; }
.implant { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.jc { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel-2); }
.jc-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }

/* share dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(560px, 92vw); }
dialog::backdrop { background: #000a; }
.dlg { padding: 20px 22px; display: grid; gap: 10px; }
.dlg h2 { margin: 0; font-size: 18px; }
.dlg p { margin: 0; }
.dlg small.warn { margin-left: 6px; }
.linkbox { display: flex; gap: 6px; margin-top: 6px; }
.linkbox input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.dlg-actions { display: flex; gap: 8px; margin-top: 8px; }

/* public page & footer */
.public-main { max-width: 1100px; margin: 0 auto; padding: 20px; }
.foot { color: var(--dim); font-size: 11px; text-align: center; padding: 24px 20px 30px; }
.empty.big h2 { color: var(--text); margin-top: 0; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .sheet-head { flex-wrap: wrap; gap: 12px; }
  .portrait { width: 64px; height: 64px; }
  .who { flex: 1 1 calc(100% - 90px); }
  .who h1 { font-size: 20px; }
  .actions { width: 100%; justify-content: flex-start; }
  .skill { grid-template-columns: 1fr auto; padding-left: 20px; }
  .skill .num { display: none; }
  .legend { margin-left: 0; }
}
.stat b span, .stat small span { display: inline; text-transform: none; letter-spacing: 0; font-size: inherit; color: inherit; }
.stat b span.dim { color: var(--dim); }
.char .glyph { flex: none; font-size: 12px; }
.char .glyph.main { color: var(--accent); }
.char .glyph.shared { color: var(--accent-2); }
