/* ============================================================
   Jarvis 2.0 – Material 3 inspired theme
   ============================================================ */

:root {
  /* M3 Color tokens */
  --primary: #1a73e8;
  --primary-container: #d3e3fd;
  --on-primary: #ffffff;
  --on-primary-container: #041e49;
  --secondary: #5f6368;
  --surface: #f8f9fa;
  --surface-container: #ffffff;
  --surface-container-high: #f1f3f4;
  --surface-container-highest: #e8eaed;
  --on-surface: #1f1f1f;
  --on-surface-variant: #444746;
  --outline: #747775;
  --outline-variant: #c4c7c5;
  --error: #d93025;
  --error-container: #fce8e6;
  --success: #188038;
  --success-container: #e6f4ea;
  --warning: #e37400;
  --warning-container: #fef7e0;

  /* Elevation */
  --shadow-1: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-2: 0 3px 6px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-3: 0 8px 24px rgba(0,0,0,.12);

  /* Shape */
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-xl: 28px;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  color: var(--primary);
  font-size: 28px;
}

.brand-text {
  font-weight: 600;
  font-size: 18px;
  color: var(--on-surface);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 6px 16px 6px 12px;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.period-selector:hover {
  border-color: var(--primary);
}
.period-selector.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}

.period-selector .material-symbols-rounded {
  font-size: 20px;
  color: var(--primary);
}

#period-label {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
  min-width: 80px;
}

.period-chevron {
  font-size: 20px !important;
  color: var(--outline) !important;
  transition: transform 0.2s;
}
.period-selector.open .period-chevron {
  transform: rotate(180deg);
}

.period-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-3);
  padding: 6px 0;
  z-index: 1000;
  max-height: 320px;
  overflow-y: auto;
}
.period-selector.open .period-menu {
  display: block;
  animation: menuSlideIn 0.15s ease-out;
}

@keyframes menuSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.period-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 400;
  color: var(--on-surface);
  cursor: pointer;
  transition: background 0.1s;
}
.period-menu-item:hover {
  background: var(--surface-container-high);
}
.period-menu-item.selected {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
}
.period-menu-item .material-symbols-rounded {
  font-size: 18px;
  color: var(--primary);
  opacity: 0;
}
.period-menu-item.selected .material-symbols-rounded {
  opacity: 1;
}

.period-selector select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

/* ── Layout ── */
.layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  background: var(--surface-container);
  border-right: 1px solid var(--outline-variant);
  padding: 12px 8px;
  overflow-y: auto;
  transition: width .2s, transform .2s;
  z-index: 50;
}

.nav-collapsed .sidebar {
  width: 0;
  padding: 0;
  overflow: hidden;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--on-surface-variant);
  padding: 12px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  color: var(--on-surface-variant);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: background .15s;
}

.nav-item:hover {
  background: var(--surface-container-high);
}

.nav-item.active {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.nav-item .material-symbols-rounded {
  font-size: 22px;
}

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  transition: margin-left .2s;
}

.nav-collapsed .content {
  margin-left: 0;
}

/* ── Icon button ── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--on-surface-variant);
  transition: background .15s;
}

.icon-btn:hover {
  background: var(--surface-container-high);
}

.icon-btn.danger:hover {
  background: var(--error-container);
  color: var(--error);
}

/* ── Page header ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--on-surface);
}

.subtitle {
  color: var(--on-surface-variant);
  margin-top: 4px;
}

/* ── Cards ── */
.card {
  background: var(--surface-container);
  border-radius: var(--radius-m);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-action {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px;
  transition: box-shadow .2s, transform .1s;
  cursor: pointer;
}

.card-action:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 40px;
  color: var(--primary);
  margin-bottom: 12px;
}

.card-action h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-action p {
  font-size: 13px;
  color: var(--on-surface-variant);
}

/* ── Summary hero row ── */
.summary-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.hero-card {
  background: var(--surface-container);
  border-radius: var(--radius-m);
  padding: 24px 20px;
  box-shadow: var(--shadow-1);
  text-align: center;
  border-top: 3px solid var(--outline-variant);
}
.hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
}
.hero-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--on-surface);
  line-height: 1.1;
}
.hero-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  margin-top: 4px;
}
.summary-hero.four-col { grid-template-columns: repeat(4, 1fr); }
.summary-hero.four-col .hero-value { font-size: 24px; }
.summary-hero.four-col .hero-card { padding: 20px 16px; }
@media (max-width: 768px) {
  .summary-hero { grid-template-columns: 1fr; }
}

/* ── Summary detail cards (used by other reports) ── */
.summary-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.detail-card {
  background: var(--surface-container);
  border-radius: var(--radius-m);
  padding: 20px;
  box-shadow: var(--shadow-1);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: .3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--outline-variant);
  margin-bottom: 12px;
}

.detail-header .material-symbols-rounded {
  font-size: 20px;
  color: var(--primary);
}

.detail-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  color: var(--on-surface-variant);
}

.detail-row span:last-child {
  font-weight: 500;
  color: var(--on-surface);
  font-variant-numeric: tabular-nums;
}

.detail-row.negative span:last-child {
  color: var(--error);
}

.detail-row.total {
  border-top: 1px solid var(--outline-variant);
  margin-top: 4px;
  padding-top: 8px;
}

.detail-row.total span {
  font-weight: 600;
  color: var(--on-surface);
}

/* ── Summary two-column layout ── */
.summary-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}
.summary-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Static volume card */
.vol-card {
  width: 100%;
  background: var(--surface-container);
  border-radius: var(--radius-m);
  border: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
}
.vol-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
  border-bottom: 1px solid var(--outline-variant);
}
.vol-header .material-symbols-rounded {
  font-size: 22px;
  color: var(--primary);
}
.vol-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
}
.vol-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.vol-row span:last-child {
  font-weight: 600;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .summary-two-col { grid-template-columns: 1fr; }
}

/* ── Financial statement layout ── */
.fin-statement {
  background: var(--surface-container);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  max-width: 560px;
}
.fin-section {
  padding: 14px 24px;
  border-bottom: 1px solid var(--outline-variant);
}
.fin-section:last-child {
  border-bottom: none;
}
.fin-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--outline);
  margin-bottom: 8px;
}
.fin-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.fin-row span:last-child {
  font-weight: 500;
  color: var(--on-surface);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.fin-row.neg span:last-child {
  color: var(--error);
}
.fin-row.indent {
  padding-left: 20px;
  font-size: 12px;
  color: var(--outline);
}
.fin-row.indent span:last-child {
  color: var(--on-surface-variant);
  font-size: 12px;
}
.fin-row.subtotal {
  border-top: 1px solid var(--outline-variant);
  margin-top: 4px;
  padding-top: 6px;
}
.fin-row.subtotal span {
  color: var(--on-surface);
  font-weight: 600;
}
.fin-result {
  padding: 12px 24px;
  border-top: 2px solid var(--on-surface);
  border-bottom: 1px solid var(--outline-variant);
  font-size: 14px;
  font-weight: 700;
  color: var(--on-surface);
}
.fin-result span:last-child {
  font-variant-numeric: tabular-nums;
}
.fin-volumes {
  background: var(--surface-container-high);
}

/* ── Tables ── */
.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  color: var(--on-surface-variant);
  border-bottom: 2px solid var(--outline-variant);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface-container);
  z-index: 5;
  user-select: none;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--surface-container-highest);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: var(--surface-container-high);
}

.data-table.compact td {
  padding: 6px 10px;
  font-size: 12px;
}

.data-table.compact th {
  padding: 8px 10px;
  font-size: 11px;
}

/* Sortable headers */
.sortable th[data-sort] {
  cursor: pointer;
}

.sortable th[data-sort]:hover {
  color: var(--primary);
}

.sortable th.sort-asc::after { content: ' ▲'; font-size: 10px; }
.sortable th.sort-desc::after { content: ' ▼'; font-size: 10px; }

/* Type badges */
.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.type-badge.mob { background: #deeaf1; color: #1a4472; }
.type-badge.sip { background: #d9e2f3; color: #2c3e6b; }
.type-badge.vxl { background: #e2d9f3; color: #4a2d7a; }
.type-badge.ds  { background: #e2efda; color: #2d5016; }
.type-badge.mb  { background: #fff2cc; color: #7a5a00; }
.type-badge.drv { background: #fce4ec; color: #880e4f; }

/* Negative values */
.neg { color: var(--error); }
.pos { color: var(--success); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--outline-variant);
  margin-bottom: 16px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}

.tab:hover {
  color: var(--primary);
  background: var(--surface-container-high);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab .material-symbols-rounded {
  font-size: 20px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── Forms ── */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
}

.form-field input[type="text"] {
  padding: 10px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-s);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  transition: border-color .15s;
  width: 140px;
}

.form-field input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-container);
}

.file-field {
  flex: 1;
  min-width: 250px;
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px dashed var(--outline-variant);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--on-surface-variant);
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-container);
}

.file-drop.has-file {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-container);
  color: var(--success);
}

.file-drop .material-symbols-rounded {
  font-size: 24px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-xl);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn-primary:hover {
  box-shadow: var(--shadow-2);
}

.btn-primary:disabled {
  background: var(--surface-container-highest);
  color: var(--outline);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-text {
  background: transparent;
  color: var(--primary);
}

.btn-text:hover {
  background: var(--primary-container);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  box-shadow: var(--shadow-2);
}

/* ── Progress ── */
.progress-bar {
  height: 4px;
  background: var(--surface-container-highest);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .3s ease;
  width: 0;
}

/* ── Messages ── */
.message {
  font-size: 13px;
  padding: 8px 0;
}

.message.success { color: var(--success); }
.message.error { color: var(--error); }

/* ── Dialog ── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.dialog {
  background: var(--surface-container);
  border-radius: var(--radius-l);
  padding: 24px;
  min-width: 320px;
  max-width: 480px;
  box-shadow: var(--shadow-3);
}

.dialog h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.dialog p {
  color: var(--on-surface-variant);
  margin-bottom: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Search ── */
.search-input {
  padding: 8px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  width: 280px;
  transition: border-color .15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.table-info {
  font-size: 13px;
  color: var(--on-surface-variant);
}

.table-footer {
  text-align: center;
  padding: 12px 0;
}

/* ── Detail column toggle ── */
.toggle-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--on-surface-variant);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toggle-detail input { margin: 0 2px 0 0; }
.detail-col { display: none; }
.show-detail .detail-col { display: table-cell; }

/* ── Antaganden / Assumptions – Accordion ── */
.assumptions-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 720px;
}

/* Group-level accordion */
.acc-group {
  background: var(--surface-container);
  border-radius: var(--radius-m);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
}
.acc-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: var(--surface-container);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
  transition: background .15s;
}
.acc-group-header:hover {
  background: var(--surface-container-high);
}
.acc-group-icon {
  font-size: 22px;
  color: var(--primary);
}
.acc-group-label { flex: 1; text-align: left; }
.acc-group-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
  margin-right: 4px;
}
.acc-group-header .acc-chevron {
  font-size: 20px;
  color: var(--on-surface-variant);
  transition: transform .25s;
}
.acc-group.open > .acc-group-header .acc-chevron {
  transform: rotate(180deg);
}
.acc-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.acc-group.open > .acc-group-body {
  max-height: 2000px;
}

/* Single-section body (no sub-accordions) */
.acc-single-body {
  padding: 4px 20px 16px;
}

/* Sub-section accordion (inside Telenor etc.) */
.acc-sub {
  border-top: 1px solid var(--outline-variant);
}
.acc-sub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px 10px 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--on-surface);
  transition: background .15s;
}
.acc-sub-header:hover {
  background: var(--surface-container-high);
}
.acc-sub-icon {
  font-size: 18px;
  color: var(--primary);
}
.acc-sub-title {
  font-weight: 500;
  flex: 1;
  text-align: left;
}
.acc-sub-subtitle {
  font-size: 12px;
  color: var(--on-surface-variant);
}
.acc-sub-header .acc-chevron {
  font-size: 18px;
  color: var(--on-surface-variant);
  transition: transform .25s;
}
.acc-sub.open > .acc-sub-header .acc-chevron {
  transform: rotate(180deg);
}
.acc-sub-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 20px 0 44px;
  transition: max-height .3s ease, padding .3s ease;
}
.acc-sub.open > .acc-sub-body {
  max-height: 1200px;
  padding: 4px 20px 14px 44px;
}

/* Shared row styles */
.assumption-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--surface-container-highest);
  gap: 8px;
}
.assumption-row:last-child {
  border-bottom: none;
}
.assumption-label {
  font-size: 13px;
  color: var(--on-surface);
}
.assumption-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.assumption-note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: -4px;
}

/* Tier tables */
.assumption-tiers {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--outline-variant);
}
.tier-header {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  padding: 6px 12px;
  background: var(--surface-container-high);
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tier-row {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  padding: 5px 12px;
  font-size: 12px;
  border-top: 1px solid var(--surface-container-highest);
}
.tier-row:nth-child(even) {
  background: var(--surface-container-high);
}
.tier-val {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--on-surface);
}

/* ── States ── */
.loading, .loading-state, .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--on-surface-variant);
}

.empty-state.error {
  color: var(--error);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Page loader (top progress bar) ── */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #4fc3f7);
  z-index: 9999;
  transition: none;
  opacity: 0;
  pointer-events: none;
}
.page-loader.active {
  opacity: 1;
  animation: page-load-progress 8s cubic-bezier(0.1, 0.05, 0.1, 1) forwards;
}
@keyframes page-load-progress {
  0%   { width: 0; }
  10%  { width: 25%; }
  30%  { width: 55%; }
  50%  { width: 70%; }
  80%  { width: 85%; }
  100% { width: 95%; }
}

/* ── Loading state enhancement ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 64px 24px;
  color: var(--outline);
}
.loading-state p {
  margin: 0;
  font-size: 15px;
  animation: pulse-text 1.5s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Two column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.text-danger {
  color: var(--error);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    padding: 0;
    overflow: hidden;
  }
  .content { margin-left: 0; }
  body:not(.nav-collapsed) .sidebar {
    width: var(--sidebar-width);
    padding: 12px 8px;
    overflow-y: auto;
    box-shadow: var(--shadow-3);
  }
}

/* Chips */
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-okategoriserad { background: var(--error-container, #ffdad6); color: var(--on-error-container, #410002); }
.chip-rabatt { background: #e0f2e9; color: #1b5e20; }
.chip-pristillagg { background: #fff3e0; color: #e65100; }

/* ── Bug report dialog ── */
.bug-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--outline);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bug-select, .bug-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  transition: border-color 0.15s;
}
.bug-select:focus, .bug-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.bug-textarea { resize: vertical; min-height: 80px; }
#bug-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
#bug-dialog::backdrop { background: rgba(0,0,0,.35); }

/* Standalone bug icon in sidebar bottom */
.nav-icon-only {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--outline);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  align-self: flex-end;
  margin-top: 4px;
}
.nav-icon-only:hover {
  background: var(--surface-container-high);
  color: var(--primary);
}

/* ── Ticket system ── */
.ticket-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.status-ny     { background: #e3f2fd; color: #1565c0; }
.status-oppen  { background: #fff3e0; color: #e65100; }
.status-avvisad{ background: #fce4ec; color: #c62828; }
.status-lost   { background: #e8f5e9; color: #2e7d32; }

.ticket-row { cursor: pointer; transition: background 0.15s; }
.ticket-row:hover { background: var(--surface-variant, #f5f5f5); }

.ticket-detail {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 16px;
  padding: 24px;
  margin-top: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.ticket-detail h3 { margin: 0 0 16px; font-size: 16px; }
.ticket-field { margin-bottom: 14px; }
.ticket-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--outline);
  margin-bottom: 4px;
}
.ticket-field-value { font-size: 14px; line-height: 1.5; }
