/* =========================================
   1. FÄRGPALETT (Ljust & Mörkt läge)
   ========================================= */
:root {
  --bg: #f9f9f8;
  --surface: #ffffff;
  --surface-subtle: #f2f2f0;
  --text: #141413;
  --text-muted: #666662;
  --border: #e5e5e2;
  --border-strong: #141413;
  --accent: #141413;
  --accent-text: #ffffff;
  --save-bg: #f0fdf4;
  --save-text: #166534;
  --save-border: #bbf7d0;
  --paused-bg: #fffbeb;
  --paused-text: #92400e;
  --paused-border: #fde68a;
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #111110;
  --surface: #191918;
  --surface-subtle: #222220;
  --text: #f4f4f2;
  --text-muted: #9a9a94;
  --border: #2b2b28;
  --border-strong: #f4f4f2;
  --accent: #f4f4f2;
  --accent-text: #111110;
  --save-bg: #052e16;
  --save-text: #86efac;
  --save-border: #14532d;
  --paused-bg: #291d06;
  --paused-text: #fcd34d;
  --paused-border: #78350f;
}

/* =========================================
   2. GRUND & TOPPMENY
   ========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding: 1.5rem 1.25rem 3.5rem;
}

.container {
  max-width: 680px;
  margin: 0 auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.back-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* =========================================
   3. VERKTYGSRUBRIK & "A TOOL BY PLANERY"
   ========================================= */
.tool-hero {
  margin-bottom: 1.75rem;
}

.byline {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.byline a {
  color: var(--text);
  text-decoration: none;
}

.tool-title-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.tool-logo {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.tool-hero h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

/* =========================================
   4. SUMMERINGSKORT
   ========================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
}

.summary-card {
  margin-bottom: 2rem;
  position: sticky;
  top: 0.75rem;
  z-index: 10;
}

.period-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--surface-subtle);
  padding: 0.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.period-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.period-tab.active {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.totals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.total-box {
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: var(--surface-subtle);
  border: 1px solid transparent;
}

.total-box.savings {
  background: var(--save-bg);
  color: var(--save-text);
  border-color: var(--save-border);
}

.total-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  opacity: 0.85;
}

.total-amount {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

/* =========================================
   5. PRENUMERATIONSKORT & EGNA RADER
   ========================================= */
.tool-section {
  margin-bottom: 1.75rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.section-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  gap: 0.5rem;
}

.sub-item.selected {
  border-color: var(--border-strong);
}

.sub-item.paused {
  border-style: dashed;
  border-color: #d97706;
  opacity: 0.85;
}

.sub-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.sub-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.brand-badge {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.sub-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sub-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-cat {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.sub-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.price-wrap {
  display: flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
}

.price-input {
  width: 48px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.currency-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.pause-btn {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
}

.sub-item.selected .pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.sub-item.paused .pause-btn {
  background: var(--paused-bg);
  color: var(--paused-text);
  border-color: var(--paused-border);
}

.custom-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.custom-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}

.custom-row.paused {
  border-style: dashed;
  border-color: #d97706;
  opacity: 0.85;
}

.custom-name-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  min-width: 110px;
}

.remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
}

/* =========================================
   6. NOLLSTÄLL, ADSENSE-YTA & MINIMAL SIDFOT
   ========================================= */
.action-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.share-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.share-btn:hover {
  opacity: 0.88;
}

.reset-link {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  font-size: 0.8rem;
  cursor: pointer;
}


.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

/* =========================================
   7. MOBILANPASSNING
   ========================================= */
@media (max-width: 560px) {
  .totals-grid,
  .sub-grid {
    grid-template-columns: 1fr;
  }
}

