/* Kruthornsgränden 12 — intern presentation */
:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --panel-2: #243044;
  --border: #2e3f56;
  --text: #e8eef6;
  --muted: #9aabbf;
  --accent: #5b9fd4;
  --accent-2: #7ec8a3;
  --warn: #e6b35a;
  --danger: #d47a7a;
  --banner: #3d2e14;
  --banner-text: #f0d9a0;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Banner */
.banner {
  background: var(--banner);
  color: var(--banner-text);
  text-align: center;
  padding: .55rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .01em;
  border-bottom: 1px solid #5a4420;
  flex-shrink: 0;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.site-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
}
.site-header .sub {
  color: var(--muted);
  font-size: .85rem;
  margin-top: .15rem;
}

.nav-tabs {
  display: flex;
  gap: .4rem;
}
.nav-tabs button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .45rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
}
.nav-tabs button:hover { border-color: var(--accent); color: var(--accent); }
.nav-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1520;
  font-weight: 600;
}

/* Main layout */
main {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.view.active { display: flex; }

/* 3D view */
#view-3d {
  flex-direction: row;
  position: relative;
}

#canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  background: radial-gradient(ellipse at 50% 30%, #1e2a3a 0%, #0f1419 70%);
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.hud {
  position: absolute;
  left: .85rem;
  bottom: .85rem;
  background: rgba(26,35,50,.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .85rem;
  font-size: .8rem;
  color: var(--muted);
  max-width: min(320px, 90%);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.hud strong { color: var(--text); }
.hud kbd {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 .35rem;
  font-size: .75rem;
  color: var(--text);
  font-family: ui-monospace, monospace;
}

.toolbar {
  position: absolute;
  top: .85rem;
  right: .85rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  z-index: 2;
}
.toolbar button {
  background: rgba(26,35,50,.92);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  backdrop-filter: blur(6px);
  text-align: left;
  min-width: 140px;
}
.toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#load-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26,35,50,.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.4rem;
  font-size: .95rem;
  z-index: 3;
  text-align: center;
  max-width: 90%;
}
#load-status.error { border-color: var(--danger); color: #f0c0c0; }
#load-status.hidden { display: none; }

/* Sidebar legend */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
}
.sidebar h2 {
  margin: 0 0 .75rem;
  font-size: 1rem;
}
.sidebar .note {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.room-list li {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: .85rem;
  line-height: 1.35;
}
.room-list li .tag {
  display: inline-block;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent-2);
  margin-bottom: .15rem;
}
.room-list li.own-cost .tag { color: var(--warn); }

/* Handlingar */
#view-handlingar {
  flex-direction: column;
  overflow: auto;
  padding: 1.25rem 1.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
#view-handlingar h2 {
  margin: 0 0 .35rem;
  font-size: 1.35rem;
}
#view-handlingar .intro {
  color: var(--muted);
  margin: 0 0 1.25rem;
  font-size: .95rem;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
table.handlingar {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.handlingar th,
table.handlingar td {
  padding: .7rem .9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.handlingar th {
  background: var(--panel-2);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
table.handlingar tr:last-child td { border-bottom: none; }
table.handlingar tr:hover td { background: rgba(91,159,212,.06); }

.status {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 650;
  white-space: nowrap;
}
.status.redo { background: rgba(126,200,163,.18); color: var(--accent-2); }
.status.utkast { background: rgba(230,179,90,.18); color: var(--warn); }
.status.saknas { background: rgba(212,122,122,.18); color: var(--danger); }

table.handlingar a {
  color: var(--accent);
  text-decoration: none;
}
table.handlingar a:hover { text-decoration: underline; }
.muted-link { color: var(--muted); font-style: italic; }

.thumb {
  margin-top: .35rem;
  max-width: 120px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}

.footer-note {
  margin-top: 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 860px) {
  #view-3d { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }
  .toolbar {
    flex-direction: row;
    flex-wrap: wrap;
    right: .5rem;
    top: .5rem;
  }
  .toolbar button { min-width: auto; }
  .hud { font-size: .72rem; }
  .site-header h1 { font-size: 1rem; }
}
