/* Arosportalen 2.0
   Layout: en klassisk portal från tidigt 2000-tal – siluettbanner över Mälaren, flikrad,
   huvudkolumn plus sidokolumn med rubricerade boxar. Medvetet ett enda ljust tema. */
:root {
  --page: #dfe7f1;
  --panel: #ffffff;
  --panel-alt: #f3f6fa;
  --ink: #17202c;
  --muted: #586577;
  --line: #b3c2d6;
  --line-soft: #d8e1ec;
  --navy: #0f2a52;
  --blue: #245a9a;
  --blue-2: #3b77be;
  --link: #1a4d8f;
  --gurka: #4a8a1c;
  --gurka-dark: #2c5a12;
  --gurka-soft: #e4f0d6;
  --alert: #d8621c;
  --online: #2fa84f;
  --f-display: "Righteous", "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  --f-body: Verdana, Tahoma, Geneva, "DejaVu Sans", sans-serif;
  --f-mono: "IBM Plex Mono", "Courier New", Courier, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: var(--f-body); font-size: 13px; line-height: 1.5;
}
a { color: var(--link); }
a:hover { color: var(--alert); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #f2b233; outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }

.wrap { max-width: 1060px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 32px; }

/* ---------- Banner ---------- */
.banner {
  position: relative; height: 196px; overflow: hidden;
  border: 1px solid #0a1c38; border-bottom: 0; border-radius: 8px 8px 0 0;
  background:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 31% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 58% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 77% 7%, #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 90% 22%, #fff 50%, transparent 51%),
    linear-gradient(180deg, #0b1f40 0%, #1c4a86 42%, #5b82b6 64%, #e9a565 86%, #f7cf92 100%);
}
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 176px; display: block; }
.brand { position: absolute; left: 22px; top: 16px; z-index: 2; text-decoration: none; color: #fff; display: block; }
.wordmark {
  font-family: var(--f-display); font-size: 44px; line-height: 1; letter-spacing: .01em;
  color: #fff; text-shadow: 0 2px 0 #0a1c38, 0 0 18px rgba(120,170,255,.45);
}
.badge20 {
  display: inline-grid; place-items: center; vertical-align: top; margin-left: 6px;
  width: 46px; height: 46px; border-radius: 50%;
  font-family: var(--f-display); font-size: 17px; color: #fff;
  background: radial-gradient(circle at 35% 30%, #a6e05e, #4a8a1c 70%);
  border: 2px solid #fff; box-shadow: 0 2px 0 #0a1c38; transform: rotate(12deg);
}
.tagline { display: block; margin-top: 6px; font-size: 12px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; color: #cfe0ff; text-shadow: 0 1px 0 #0a1c38; }
.banner-gurre { position: absolute; right: 26px; bottom: 6px; width: 92px; z-index: 3; }
.banner-gurre .gurre { width: 100%; height: auto; display: block; filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }

/* ---------- Gurre ---------- */
.gurre .hand { fill: #6fb534; stroke: #2c5a12; stroke-width: 2; }
.gurre-arm-wave { transform-origin: 33px 92px; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 80% { transform: rotate(8deg); } 90% { transform: rotate(-10deg); } }
@media (prefers-reduced-motion: reduce) { .gurre-arm-wave { animation: none; } }
.gurre-head { width: 18px; height: 14px; vertical-align: -2px; }

.gurre-says { display: flex; gap: 12px; align-items: flex-end; }
.gurre-says .gurre { width: 86px; flex: none; height: auto; }
.bubble {
  position: relative; flex: 1; min-width: 0; background: #fff; border: 2px solid var(--gurka-dark);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 40px; color: var(--ink);
}
.bubble::before { content: ""; position: absolute; left: -12px; bottom: 14px; border: 6px solid transparent; border-right: 10px solid var(--gurka-dark); }
.bubble::after { content: ""; position: absolute; left: -7px; bottom: 16px; border: 4px solid transparent; border-right: 7px solid #fff; }
.bubble b { color: var(--gurka-dark); }

/* ---------- Flikar ---------- */
.tabs {
  display: flex; gap: 3px; padding: 7px 8px 0; overflow-x: auto; scrollbar-width: thin;
  background: linear-gradient(#173c70, var(--navy)); border-inline: 1px solid #0a1c38;
}
.tabs a {
  position: relative; flex: none; padding: 6px 14px 7px; border-radius: 6px 6px 0 0;
  background: linear-gradient(#d7e3f2, #aec3de); color: #0f2a52; font-weight: bold; font-size: 12px;
  text-decoration: none; border: 1px solid #0a1c38; border-bottom: 0;
}
.tabs a:hover { background: linear-gradient(#ffffff, #cfdcee); color: #0f2a52; }
.tabs a.active { background: var(--panel-alt); color: var(--ink); padding-bottom: 8px; margin-bottom: -1px; }
.tabs .spacer { flex: 1; }
.count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 9px;
  background: var(--alert); color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; border: 1px solid #a8470f;
}

/* ---------- Layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; padding: 14px;
  background: var(--panel-alt); border: 1px solid var(--line); border-top: 1px solid #0a1c38;
}
main, aside { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
main:focus { outline: none; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 9px 14px;
  background: var(--navy); color: #c7d6ec; font-size: 11px; border-radius: 0 0 8px 8px;
}
.foot a { color: #fff; }
.best { font-style: italic; opacity: .8; }

/* ---------- Boxar ---------- */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.box > h2, .box > header h2 {
  margin: 0; padding: 5px 11px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: #fff;
  background: linear-gradient(var(--blue-2), var(--blue)); border-bottom: 1px solid #1b4a80;
}
.box.green > h2 { background: linear-gradient(#6aa834, var(--gurka)); border-bottom-color: var(--gurka-dark); }
.box.orange > h2 { background: linear-gradient(#ec8a43, var(--alert)); border-bottom-color: #a8470f; }
.box-body { padding: 12px; }
.box-body > * + * { margin-top: 10px; }
.box-body > p:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
h1.page { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 26px; color: var(--navy); }

/* ---------- Knappar och formulär ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: bold;
  padding: 5px 13px; border-radius: 4px; cursor: pointer; text-decoration: none; line-height: 1.4;
  color: #fff; background: linear-gradient(#4f8ad0, var(--blue)); border: 1px solid #163c6b;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.btn:hover { background: linear-gradient(#5f9ae0, #2b67ad); color: #fff; }
.btn.green { background: linear-gradient(#78b83e, var(--gurka)); border-color: var(--gurka-dark); }
.btn.green:hover { background: linear-gradient(#86c64b, #529824); }
.btn.plain { color: var(--ink); background: linear-gradient(#ffffff, #dde5ef); border-color: #8fa3bd; }
.btn.plain:hover { background: linear-gradient(#ffffff, #cfdcee); color: var(--ink); }
.btn.danger { background: linear-gradient(#e2744a, #b8401a); border-color: #85300f; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 3px; min-width: 0; }
.field > span { font-size: 11px; font-weight: bold; color: var(--navy); }
.field small { color: var(--muted); font-size: 11px; }
.full { grid-column: 1 / -1; }
input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-size: 13px; color: var(--ink); background: #fff; width: 100%;
  border: 1px solid #8fa3bd; border-radius: 3px; padding: 5px 7px; box-shadow: inset 0 1px 2px rgba(15,42,82,.12);
}
textarea { resize: vertical; min-height: 90px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.check input { margin-top: 3px; }
.error { color: #a32d0c; background: #fdece4; border: 1px solid #f0b79c; border-radius: 4px; padding: 6px 9px; font-size: 12px; }
.ok { color: #24520c; background: var(--gurka-soft); border: 1px solid #a9cc85; border-radius: 4px; padding: 6px 9px; font-size: 12px; }

/* ---------- Avatarer ---------- */
.avatar { display: block; border-radius: 4px; border: 1px solid var(--line); background: #e9eef5; object-fit: cover; flex: none; }
.av-wrap { position: relative; display: inline-block; flex: none; }
.dot { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--online); border: 2px solid #fff; }
.dot[hidden] { display: none; }

/* ---------- Medlemskort ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.mcard {
  display: grid; justify-items: center; gap: 4px; padding: 10px 6px; text-align: center; min-width: 0;
  background: var(--panel-alt); border: 1px solid var(--line-soft); border-radius: 5px; text-decoration: none; color: var(--ink);
}
.mcard:hover { border-color: var(--blue-2); background: #fff; color: var(--ink); }
.mcard .name { font-weight: bold; color: var(--link); overflow-wrap: anywhere; }
.mcard .meta { font-size: 11px; color: var(--muted); }
.mini-list { display: grid; gap: 7px; }
.mini { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); min-width: 0; }
.mini .name { font-weight: bold; color: var(--link); overflow-wrap: anywhere; }
.mini .meta { display: block; font-size: 11px; color: var(--muted); }
.av-row { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tag { display: inline-block; font-size: 9.5px; font-weight: bold; color: #fff; background: var(--alert); border-radius: 3px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; letter-spacing: .04em; }

/* ---------- Startsida ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.stat { background: var(--panel-alt); border: 1px solid var(--line-soft); border-radius: 5px; padding: 8px 10px; }
.stat b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 24px; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.league { display: grid; gap: 5px; }
.league-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 34px; gap: 8px; align-items: center; font-size: 12px; }
.league-row .bar { height: 15px; background: linear-gradient(90deg, #78b83e, var(--gurka)); border-radius: 2px; min-width: 3px; }
.league-row .lbl { display: flex; flex-direction: column; min-width: 0; }
.league-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: bold; }
.gurkor { font-size: 18px; letter-spacing: 2px; }

/* ---------- Profil ---------- */
.profile { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-side { display: grid; gap: 8px; justify-items: start; }
.profile h1 { margin: 0 0 2px; font-family: var(--f-display); font-weight: 400; font-size: 28px; color: var(--navy); overflow-wrap: anywhere; }
.pres { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pres th, .pres td { text-align: left; padding: 4px 8px; border-bottom: 1px dotted var(--line); vertical-align: top; }
.pres th { width: 38%; color: var(--muted); font-weight: normal; }
.pres tr:nth-child(odd) td, .pres tr:nth-child(odd) th { background: #f6f9fc; }
.about { white-space: pre-wrap; overflow-wrap: anywhere; }
.status-line { font-size: 12px; color: var(--muted); }
.online-txt { color: var(--online); font-weight: bold; }

/* ---------- Chatt (mIRC-stuk) ---------- */
.irc { border: 2px solid; border-color: #7f93ad #e8eef5 #e8eef5 #7f93ad; background: #fff; }
.irc-title { padding: 4px 9px; background: linear-gradient(90deg, #0f2a52, #3b77be); color: #fff; font-weight: bold; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.irc-topic { padding: 4px 9px; font-size: 11.5px; background: #eef3f9; border-bottom: 1px solid var(--line); color: var(--navy); }
.irc-body { display: grid; grid-template-columns: minmax(0, 1fr) 170px; height: 440px; }
.irc-log { overflow-y: auto; padding: 6px 9px; font-family: var(--f-mono); font-size: 13px; line-height: 1.55; border-right: 1px solid var(--line); }
.irc-line { overflow-wrap: anywhere; position: relative; padding-right: 18px; }
.irc-line .t { color: #8091a7; }
.irc-line .nick { font-weight: 600; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; }
.irc-line .nick:hover { text-decoration: underline; }
.irc-line.me { color: #8a3fa0; font-style: italic; }
.irc-line.gurre { color: var(--gurka-dark); font-weight: 600; }
.irc-line.sys { color: #1d7a3a; }
.irc-line .del { position: absolute; right: 0; top: 0; border: 0; background: none; color: #b8401a; cursor: pointer; font: inherit; opacity: 0; }
.irc-line:hover .del, .irc-line .del:focus-visible { opacity: 1; }
.irc-users { overflow-y: auto; padding: 6px 8px; font-family: var(--f-mono); font-size: 12.5px; background: #fbfcfe; }
.irc-users h3 { margin: 0 0 4px; font-family: var(--f-body); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.irc-users a { display: block; text-decoration: none; overflow-wrap: anywhere; }
.irc-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); background: #eef3f9; }
.irc-form input { font-family: var(--f-mono); }

/* ---------- Meddelanden ---------- */
.msg-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: #fff; min-height: 460px; }
.conv-list { border-right: 1px solid var(--line); background: var(--panel-alt); overflow-y: auto; max-height: 560px; }
.conv { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); min-width: 0; }
.conv:hover { background: #fff; color: var(--ink); }
.conv.active { background: #fff; box-shadow: inset 3px 0 0 var(--blue); }
.conv .txt { min-width: 0; flex: 1; }
.conv .name { font-weight: bold; color: var(--link); }
.conv .prev { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #f6f9fc; }
.thread-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 470px; min-height: 300px; }
.pm { max-width: 78%; padding: 7px 10px; border-radius: 10px; background: #eef3f9; border: 1px solid var(--line-soft); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.pm.mine { align-self: flex-end; background: var(--gurka-soft); border-color: #bcd9a0; }
.pm .when { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.thread-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: #f6f9fc; }
.thread-form textarea { min-height: 40px; height: 40px; }
.back-link { display: none; }

/* ---------- Övrigt ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters .field { flex: 1 1 140px; }
.list-rows { display: grid; gap: 8px; }
.row-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 8px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--panel-alt); }
.row-item .mini { flex: 1 1 180px; }
.empty { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.empty .gurre { width: 60px; height: auto; flex: none; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; align-items: center; }
.landing-hero .gurre { width: 150px; height: auto; }
.landing-hero h1 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 400; font-size: 30px; color: var(--navy); line-height: 1.15; }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.feature { background: var(--panel-alt); border: 1px solid var(--line-soft); border-radius: 5px; padding: 10px; }
.feature b { display: block; color: var(--navy); margin-bottom: 2px; }
.rules ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.avatar-edit { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.confirm-inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; font-weight: bold; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
  background: #0f2a52; color: #fff; padding: 9px 14px; border-radius: 6px; border: 1px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); font-size: 12.5px; display: flex; gap: 8px; align-items: center;
}
#toast .gurre-head { width: 22px; height: 17px; }

/* ---------- Aktuellt i Gurkstaden ---------- */
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.event { display: flex; gap: 12px; align-items: flex-start; padding: 8px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--panel-alt); }
.event-date { flex: none; width: 50px; text-align: center; border-radius: 5px; overflow: hidden; border: 1px solid #a8470f; background: #fff; }
.event-date b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 20px; line-height: 1.3; color: var(--navy); font-variant-numeric: tabular-nums; }
.event-date span { display: block; font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--alert); padding: 1px 0; }
.event-body { display: grid; gap: 1px; min-width: 0; flex: 1; }
.event-title { font-weight: bold; overflow-wrap: anywhere; }
.event-meta { font-size: 11.5px; color: var(--muted); }
.event-note { font-size: 12px; }
.event-admin { flex: none; }
.event-group + .event-group { margin-top: 14px; }
.event-group h3 { margin: 0 0 6px; font-family: var(--f-display); font-weight: 400; font-size: 18px; color: var(--navy); }
.small-btn { padding: 3px 9px; font-size: 11px; }

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 8px; padding-block: 8px 24px; }
  .banner { height: 156px; }
  .skyline { height: 108px; }
  .brand { left: 14px; top: 12px; }
  .wordmark { font-size: 29px; }
  .badge20 { width: 34px; height: 34px; font-size: 13px; }
  .tagline { font-size: 9.5px; }
  .banner-gurre { width: 62px; right: 10px; }
  .layout { padding: 10px; }
  .form-grid, .features { grid-template-columns: minmax(0, 1fr); }
  .profile { grid-template-columns: minmax(0, 1fr); }
  .profile-side { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .irc-body { grid-template-columns: minmax(0, 1fr); height: auto; }
  .irc-log { height: 380px; border-right: 0; }
  .irc-users { max-height: 88px; border-top: 1px solid var(--line); }
  .irc-users a { display: inline-block; margin-right: 10px; }
  .msg-layout { grid-template-columns: minmax(0, 1fr); }
  .msg-layout.has-thread .conv-list { display: none; }
  .msg-layout:not(.has-thread) .thread { display: none; }
  .conv-list { border-right: 0; max-height: none; }
  .back-link { display: inline; }
  .landing-hero { grid-template-columns: minmax(0, 1fr); }
  .landing-hero .gurre { display: none; }
  .gurre-says .gurre { width: 64px; }
}
