/* Palette from the supplied design.
   #2E343A charcoal · #F8BE14 yellow · #979CA1 grey · #94772B gold · #8651CA purple */
:root{
  --bg:#23282D; --card:#2E343A; --card-2:#343B42; --line:#3C444C;
  --ink:#EDF0F2; --muted:#979CA1; --accent:#F8BE14; --gold:#94772B;
  --purple:#8651CA; --radius:14px;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.22);
}
*{box-sizing:border-box}
/* .field sets display:grid, which would otherwise beat the hidden attribute */
[hidden]{display:none !important}
html,body{margin:0;height:100%}
body{
  background:var(--bg); color:var(--ink); font:14px/1.5 -apple-system,
  BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2{margin:0;font-weight:650;letter-spacing:-.01em}
h1{font-size:22px} h2{font-size:15px}
.crumb{margin:4px 0 0;color:var(--muted);font-size:13px}
.hint{margin:10px 2px 0;color:var(--muted);font-size:12px}

.shell{display:flex;min-height:100vh}

/* ------------------------------------------------------------- sidebar */
.sidebar{
  /* Wide enough for the longest label ("Sammenlign", "Modstander") to sit
     inside the panel rather than spilling over its edge. */
  width:108px;flex:0 0 108px;background:var(--card);
  border-right:1px solid var(--line);
  display:flex;flex-direction:column;align-items:center;padding:18px 0;gap:20px;
  position:sticky;top:0;height:100vh;
}
.brand .mark{
  display:grid;place-items:center;width:40px;height:40px;border-radius:12px;
  background:var(--accent);color:#23282D;font-weight:800;font-size:19px;
}
.nav{display:flex;flex-direction:column;gap:6px;width:100%;align-items:center}
.nav-item{
  width:92px;padding:10px 4px 8px;border:0;border-radius:12px;cursor:pointer;
  background:transparent;color:var(--muted);display:grid;justify-items:center;
  gap:5px;font:600 10px/1.2 inherit;letter-spacing:.01em;text-align:center;
}
.nav-item span{
  display:block;max-width:100%;overflow-wrap:anywhere;hyphens:auto;
}
.nav-item svg{width:20px;height:20px;fill:currentColor}
.nav-item:hover{background:var(--card-2);color:var(--ink)}
.nav-item.is-active{background:var(--accent);color:#23282D}
.nav-item.logout{margin-top:auto;text-decoration:none;opacity:.7}
.nav-item.logout:hover{opacity:1}

/* ---------------------------------------------------------------- main */
.main{flex:1;min-width:0;padding:22px 26px 40px;display:flex;
  flex-direction:column;gap:18px}
.topbar{display:flex;justify-content:space-between;align-items:flex-end;
  gap:16px;flex-wrap:wrap}
.controls{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.field{display:grid;gap:5px}
.field>span{color:var(--muted);font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.06em}
input[type=number]{width:110px}
select,input[type=search],input[type=number],input[type=text],
input[type=password],input:not([type]){
  background:var(--card);color:var(--ink);border:1px solid var(--line);
  border-radius:10px;padding:9px 12px;font:inherit;min-width:150px;outline:0;
}
.login input{background:var(--bg)}
select:focus,input:focus{border-color:var(--accent)}
.search{position:relative}
.search svg{position:absolute;left:11px;top:50%;transform:translateY(-50%);
  width:15px;height:15px;fill:var(--muted);pointer-events:none}
.search input{padding-left:32px;min-width:230px}

/* --------------------------------------------------------------- cards */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:14px}
.card{background:var(--card);border-radius:var(--radius);padding:16px 18px;
  box-shadow:var(--shadow);border:1px solid transparent;position:relative;
  overflow:hidden}
.card .label{color:var(--muted);font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.06em}
.card .value{font-size:26px;font-weight:700;margin-top:6px;letter-spacing:-.02em}
.card .sub{color:var(--muted);font-size:12px;margin-top:2px}
.card::after{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;
  background:var(--accent)}
.card.is-purple::after{background:var(--purple)}
.card.is-gold::after{background:var(--gold)}
.card.is-grey::after{background:var(--muted)}

/* --------------------------------------------------------------- panel */
.panel{background:var(--card);border-radius:var(--radius);padding:16px 18px 18px;
  box-shadow:var(--shadow)}
.panel-head{display:flex;justify-content:space-between;align-items:center;
  gap:14px;margin-bottom:12px;flex-wrap:wrap}
.segmented{display:inline-flex;background:var(--bg);border-radius:10px;padding:3px;
  border:1px solid var(--line)}
.segmented button{border:0;background:transparent;color:var(--muted);
  padding:7px 14px;border-radius:8px;cursor:pointer;font:600 12px/1 inherit}
.segmented button.is-active{background:var(--accent);color:#23282D}
.segmented button:not(.is-active):hover{color:var(--ink)}

.filterbar{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;
  padding-bottom:14px;margin-bottom:4px;border-bottom:1px solid var(--line)}
.filterbar select{min-width:135px}
.reset{background:transparent;border:1px solid var(--line);color:var(--muted);
  border-radius:10px;padding:9px 13px;cursor:pointer;font:600 12px/1 inherit}
.reset:hover{border-color:var(--accent);color:var(--accent)}

/* --------------------------------------------------------------- table */
.table-wrap{overflow-x:auto;border-radius:10px}
table.grid{width:100%;border-collapse:separate;border-spacing:0;font-size:13px;
  min-width:760px}
.grid th{
  text-align:right;color:var(--muted);font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.05em;padding:9px 10px;
  border-bottom:1px solid var(--line);white-space:nowrap;cursor:pointer;
  user-select:none;position:sticky;top:0;background:var(--card);
}
/* The name column stays put while the stat columns scroll sideways. */
.grid th:first-child,.grid td:first-child{
  text-align:left;position:sticky;left:0;z-index:2;background:var(--card);
  box-shadow:1px 0 0 var(--line);
}
.grid th:first-child{z-index:3}
.grid tbody tr:hover td:first-child{background:var(--card-2)}
.grid th.sorted{color:var(--accent)}
.grid th .arrow{opacity:.85;font-size:9px;margin-left:3px}
.grid td{padding:9px 10px;text-align:right;border-bottom:1px solid #333A41;
  border-top:0;
  white-space:nowrap;font-variant-numeric:tabular-nums}
.grid tbody tr{cursor:pointer}
.grid tbody tr:hover{background:var(--card-2)}
.grid .pname{font-weight:600}
.grid .pteam{color:var(--muted);font-size:11px;margin-left:7px;font-weight:500}
.grid.compact{min-width:0}
.grid.compact td:first-child{color:var(--muted)}
.pos{display:inline-grid;place-items:center;width:22px;height:22px;
  border-radius:6px;font-size:10px;font-weight:800;background:var(--card-2);
  color:var(--muted)}
.pos.G{background:rgba(134,81,202,.18);color:#B694E6}
.pos.D{background:rgba(151,156,161,.18);color:#C2C7CC}
.pos.M{background:rgba(248,190,20,.16);color:var(--accent)}
.pos.F{background:rgba(148,119,43,.28);color:#D8B45E}
.tag{display:inline-block;padding:2px 6px;border-radius:5px;font-size:9px;
  font-weight:800;letter-spacing:.04em;margin-left:8px;vertical-align:middle}
.tag.FA{background:rgba(248,190,20,.16);color:var(--accent)}
.tag.WW{background:rgba(134,81,202,.20);color:#B694E6}
.tag.T{background:#3A424A;color:var(--muted)}
.num-strong{color:var(--accent);font-weight:650}
.zero{color:#5C646C}

.report-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));
  gap:16px}
.tagline{color:var(--muted);font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.06em}
.grid.rank{min-width:0}
.grid.rank td{border-bottom:1px solid #333A41}
.grid.rank tr:last-child td{border-bottom:0}
.rankno{display:inline-grid;place-items:center;width:20px;height:20px;
  border-radius:6px;background:var(--card-2);color:var(--muted);
  font-size:10px;font-weight:800}
.grid.rank tr:nth-child(1) .rankno{background:var(--accent);color:#23282D}
.grid.rank tr:nth-child(2) .rankno,
.grid.rank tr:nth-child(3) .rankno{background:var(--gold);color:#23282D}
.big{font-size:15px;font-weight:700;color:var(--accent)}
.up{color:#5FD08A;font-weight:650}
.down{color:#E0736B;font-weight:650}
.muted{color:var(--muted)}
.ref-line{color:var(--muted);font-size:12px;margin:10px 2px 0}
.ref-line b{color:var(--ink)}

/* ------------------------------------------------------------- profile */
.back{background:none;border:0;color:var(--muted);cursor:pointer;padding:0;
  font:600 13px/1 inherit}
.back:hover{color:var(--accent)}
.profile-head{display:flex;justify-content:space-between;align-items:center;
  gap:20px;flex-wrap:wrap}
.identity{display:flex;align-items:center;gap:14px}
.avatar{width:52px;height:52px;border-radius:14px;background:var(--accent);
  color:#23282D;display:grid;place-items:center;font-weight:800;font-size:19px}
.quickstats{display:flex;gap:26px;flex-wrap:wrap}
.quickstats div{text-align:right}
.quickstats .label{color:var(--muted);font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.06em}
.quickstats .value{font-size:19px;font-weight:700;margin-top:3px}

/* --------------------------------------------------------------- chart */
.chart-wrap{overflow-x:auto}
#chart{min-width:640px}
svg.chart{display:block;width:100%;height:280px}
svg.chart .grid-line{stroke:#3C444C;stroke-width:1}
svg.chart .axis{fill:var(--muted);font-size:10px}
svg.chart .bar{fill:var(--accent)}
svg.chart .bar.dim{fill:#4A525A}
svg.chart .bar-min{fill:var(--purple);opacity:.32}
svg.chart .cline{fill:none;stroke-width:2.2;stroke-linejoin:round}
svg.chart .cdot{r:2.6}
.legend .sw-c0{background:#F8BE14}
.legend .sw-c1{background:#8651CA}
.legend .sw-c2{background:#5FD08A}
.legend .sw-c3{background:#E0736B}
svg.chart .axis-min{fill:#A379DC}
.legend{display:flex;gap:18px;align-items:center;margin:0 0 8px 46px;
  color:var(--muted);font-size:11px;font-weight:600}
.legend .sw{display:inline-block;width:9px;height:9px;border-radius:2px;
  margin-right:6px;vertical-align:middle}
.legend .sw-stat{background:var(--accent)}
.legend .sw-min{background:var(--purple);opacity:.55}
.empty{color:var(--muted);padding:26px 4px}


/* ---------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .cards{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
  .report-grid{grid-template-columns:1fr}
  .main{padding:18px 16px 32px}
}

/* Below this the sidebar becomes a bottom bar: a 108px rail costs too much
   of a phone's width, and thumbs reach the bottom of the screen, not the
   left edge. */
@media (max-width: 760px) {
  .shell{flex-direction:column}
  .sidebar{
    width:100%;flex:0 0 auto;height:auto;position:fixed;bottom:0;left:0;
    right:0;top:auto;z-index:50;flex-direction:row;padding:6px 8px;gap:0;
    border-right:0;border-top:1px solid var(--line);
    box-shadow:0 -6px 20px rgba(0,0,0,.35);
  }
  .brand{display:none}
  .nav{flex-direction:row;gap:2px;overflow-x:auto;justify-content:flex-start;
       -webkit-overflow-scrolling:touch;scrollbar-width:none}
  .nav::-webkit-scrollbar{display:none}
  .nav-item{width:auto;min-width:64px;flex:1 0 auto;padding:8px 6px 6px;
            font-size:9px;border-radius:10px}
  .nav-item.logout{margin-top:0;min-width:52px}
  .nav-item svg{width:19px;height:19px}

  .main{padding:14px 12px 84px;gap:14px}   /* room for the bottom bar */
  h1{font-size:19px}
  .topbar{align-items:stretch;gap:12px}
  .controls{width:100%}
  .field{flex:1 1 150px}
  select,input[type=search],input[type=number],input[type=text],
  input[type=password],input:not([type]){min-width:0;width:100%}
  .search{flex:1 1 100%}
  .search input{min-width:0;width:100%}

  .panel{padding:14px 12px 16px;border-radius:12px}
  .panel-head{gap:10px}
  .filterbar{gap:10px}
  .segmented{width:100%}
  .segmented button{flex:1}

  .card{padding:13px 14px}
  .card .value{font-size:22px}

  .profile-head{align-items:flex-start}
  .quickstats{gap:16px;width:100%}
  .quickstats div{text-align:left}
  .quickstats .value{font-size:16px}

  /* The sticky name column has to earn its width on a phone: capped and
     ellipsised so more than one stat column stays visible beside it. */
  .grid{font-size:12px}
  .grid th,.grid td{padding:8px 7px}
  .grid th:first-child,.grid td:first-child{max-width:158px}
  .grid .pname{display:inline-block;max-width:88px;overflow:hidden;
    text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
  .grid .pteam{margin-left:5px;font-size:10px}
  .tag{margin-left:5px;padding:1px 4px}
  .pos{width:19px;height:19px;font-size:9px}

  /* Charts keep a minimum width and scroll sideways rather than squashing
     38 rounds into a phone's width. */
  #chart, #cChart{min-width:560px}
  svg.chart{height:230px}
  .legend{margin-left:0;flex-wrap:wrap;gap:10px}
}

@media (max-width: 420px) {
  .cards{grid-template-columns:1fr 1fr}
  .card .value{font-size:19px}
  .nav-item{min-width:56px;font-size:8px}
}
