/* ==========================================================================
   Digital Oppslagstavle - 16:9 Skjerm og Kiosk Stilark
   ========================================================================== */

:root {
  /* Fargepalett */
  --bg-main: #090d16;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-card-hover: rgba(26, 37, 63, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.10);
  --border-active: rgba(56, 189, 248, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #38bdf8;
  --accent-cyan: #22d3ee;
  --accent-green: #34d399;
  --accent-amber: #f59e0b;
  --accent-red: #f43f5e;

  /* Typografi */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Avrundinger og skygger */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* Nullstilling og Kiosk-grunnlag */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden; /* Ingen rullefelt i kiosk-modus */
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: filter 0.8s ease-in-out;
  position: relative;
}

/* ==========================================================================
   BAKGRUNNSBILDE & KONTRAST-OVERLEGG
   ========================================================================== */
.bg-image-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 1.2s ease-in-out, transform 12s ease-out;
  opacity: 0;
  transform: scale(1.02);
}

.bg-image-layer.loaded {
  opacity: 1;
  transform: scale(1);
}

.bg-overlay-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 50%, rgba(9, 13, 22, 0.55) 0%, rgba(9, 13, 22, 0.85) 100%);
  pointer-events: none;
  transition: background 0.5s ease;
}

/* Skjul musepeker i fullskjerm / kiosk ved inaktivitet */
body.cursor-hidden,
body.cursor-hidden * {
  cursor: none !important;
}

/* Hovedcontainer: 16:9 tilpasning */
.dashboard-container {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 2.2vh 2.5vw;
  display: flex;
  flex-direction: column;
  gap: 2vh;
}

/* Topplinje */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5vh;
  padding: 0 0.5vw;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  transition: background-color 0.3s, box-shadow 0.3s;
}

.status-dot.offline {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.status-dot.syncing {
  background-color: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.25); }
}

.icon-button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s, opacity 0.2s;
  opacity: 0.6;
}

.icon-button:hover,
.icon-button:focus {
  color: var(--text-primary);
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Hovedrutenett (CSS Grid 16:9) */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: var(--col-split, 48%) 1fr;
  gap: clamp(14px, 2vw, 24px);
  min-height: 0;
  position: relative;
}

/* Kolonner */
.column {
  display: flex;
  flex-direction: column;
  gap: 2vh;
  min-height: 0;
}

/* Standard Kortstil (Glassmorphism) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.2vh 1.8vw;
  position: relative;
}

/* ==========================================================================
   1. KLOKKE & DATO
   ========================================================================== */
.clock-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(10px, 1.6vh, 18px) clamp(14px, 1.8vw, 24px);
}

.time-display {
  display: flex;
  align-items: baseline;
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.hours-minutes {
  font-size: clamp(2.8rem, 5.2vw, 4.8rem);
}

.seconds {
  font-size: clamp(1.3rem, 2.2vw, 2.2rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.4vw;
  min-width: 2.5ch;
}

.date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.6vh;
}

.full-date {
  font-size: clamp(0.95rem, 1.35vw, 1.4rem);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.week-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.25vh 0.8vw;
  border-radius: var(--radius-full);
  font-size: clamp(0.75rem, 0.95vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   2. VÆRMELDING (NÅ + TIME- OG 7-DAGERS VARSEL)
   ========================================================================== */
.weather-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden; /* Forhindrer at værdata noen gang sklir utenfor kortet */
  padding: clamp(12px, 1.8vh, 22px) clamp(14px, 1.8vw, 24px);
  gap: clamp(10px, 1.5vh, 20px);
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: clamp(0.8rem, 0.95vw, 0.95rem);
  gap: 8px;
  flex-shrink: 0;
}

.weather-location-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: clamp(0.85rem, 1vw, 1.05rem);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  min-width: 0;
  max-width: 45%;
}

.location-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-location-btn:hover,
.weather-location-btn:focus,
.weather-location-btn:active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-1px);
}

.weather-location-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

.weather-location-btn.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.weather-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 2px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.weather-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: clamp(0.72rem, 0.8vw, 0.82rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.weather-tab.active {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.weather-updated {
  font-size: clamp(0.72rem, 0.8vw, 0.82rem);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Nå-tilstand (Kompakt og fleksibel layout) */
.current-weather {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(8px, 1.2vw, 16px);
  align-items: center;
  flex-shrink: 0;
}

.current-weather-left {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1vw, 12px);
  min-width: 0;
}

.weather-icon-large {
  width: clamp(48px, 4.6vw, 70px);
  height: clamp(48px, 4.6vw, 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.weather-icon-large svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 12px rgba(56, 189, 248, 0.25));
}

.temp-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.current-temp {
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.weather-summary {
  font-size: clamp(0.75rem, 0.9vw, 1rem);
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Vær-detaljer (3 kolonner med minmax(0, 1fr) for å forhindre overflyt) */
.weather-details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 0.6vh, 6px) clamp(4px, 0.6vw, 8px);
  background: rgba(0, 0, 0, 0.28);
  padding: clamp(6px, 0.8vh, 10px) clamp(6px, 0.8vw, 10px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

.detail-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.detail-label {
  font-size: clamp(0.55rem, 0.62vw, 0.65rem);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-value {
  font-size: clamp(0.78rem, 0.92vw, 1rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-sub {
  font-size: clamp(0.58rem, 0.65vw, 0.68rem);
  color: var(--accent-cyan);
  margin-top: 1px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   ASTRO & HAVSTRIPE (SOL, MÅNE, TIDEVANN)
   ========================================================================== */
.astro-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(4px, 0.6vw, 10px);
  flex-shrink: 0;
}

.astro-item {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: clamp(6px, 0.8vh, 12px) clamp(6px, 0.7vw, 10px);
  gap: clamp(4px, 0.5vw, 8px);
  min-width: 0;
  overflow: hidden;
}

.astro-icon {
  font-size: clamp(1rem, 1.3vw, 1.4rem);
  line-height: 1;
  flex-shrink: 0;
}

.astro-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.astro-label {
  font-size: clamp(0.55rem, 0.65vw, 0.68rem);
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.astro-val {
  font-size: clamp(0.72rem, 0.85vw, 0.95rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.astro-sub {
  font-size: clamp(0.58rem, 0.65vw, 0.7rem);
  color: var(--accent-cyan);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Varsel container */
.forecast-container {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-subtle);
  padding-top: clamp(6px, 1vh, 12px);
  margin-top: 0;
}

.forecast-view {
  min-height: 0;
}

.forecast-view.hidden {
  display: none !important;
}

.forecast-title {
  font-size: clamp(0.65rem, 0.72vw, 0.75rem);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: clamp(4px, 0.6vh, 8px);
  font-weight: 600;
}

/* Time-for-time og 7-dagers stripe (7 kolonner på én enkelt rad) */
.hourly-strip,
.daily-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(2px, 0.35vw, 6px);
  width: 100%;
}

.hourly-item,
.daily-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: clamp(4px, 0.6vh, 7px) 2px;
  gap: 2px;
  min-width: 0;
  box-sizing: border-box;
}

.hourly-time,
.daily-day {
  font-size: clamp(0.62rem, 0.7vw, 0.74rem);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.15;
}

.hourly-icon,
.daily-icon {
  width: clamp(16px, 1.6vw, 22px);
  height: clamp(16px, 1.6vw, 22px);
  flex-shrink: 0;
  margin: 1px 0;
}

.hourly-icon svg,
.daily-icon svg {
  width: 100%;
  height: 100%;
}

.hourly-temp,
.daily-temps {
  font-size: clamp(0.68rem, 0.78vw, 0.86rem);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.15;
}

.daily-temps {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: center;
}

.daily-max {
  font-weight: 600;
  color: var(--text-primary);
}

.daily-min {
  font-weight: 400;
  color: var(--text-muted);
}

.hourly-rain,
.daily-rain {
  font-size: clamp(0.55rem, 0.62vw, 0.65rem);
  color: var(--accent-cyan);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.15;
}

/* ==========================================================================
   3. KALENDEROVERSIKT
   ========================================================================== */
.calendar-card {
  flex: 58; /* Fyller ca 58% av høyre kolonne */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 2vh 1.8vw;
  min-height: 0;
}

.calendar-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.calendar-section:not(.upcoming-section) {
  flex-shrink: 0;
  max-height: 52%;
}

.upcoming-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#upcomingEventsList {
  flex: 1;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) rgba(255, 255, 255, 0.05);
}

#upcomingEventsList::-webkit-scrollbar {
  width: 6px;
}

#upcomingEventsList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

#upcomingEventsList::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 4px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1vh;
}

.heading-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.heading-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
}

.today-dot {
  background-color: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue);
}

.upcoming-dot {
  background-color: var(--text-muted);
}

.todo-dot {
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.event-count-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.calendar-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.2vh 0;
}

/* Hendelseslister */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
  overflow-y: hidden;
}

.event-card {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 0.8vh 0.9vw;
  gap: 0.8vw;
  position: relative;
}

.event-card.is-now {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  border-left: 4px solid var(--accent-cyan);
}

.event-time-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 90px;
}

.time-main {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.time-badge-now {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--accent-cyan);
  color: #000;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.all-day-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.event-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.event-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.calendar-source-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.day-group {
  margin-bottom: 1vh;
  flex-shrink: 0 !important;
  display: flex;
  flex-direction: column;
}

.day-group .events-list {
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
  overflow: visible !important;
  flex-shrink: 0 !important;
}

.day-group-header {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-transform: capitalize;
  margin-bottom: 0.5vh;
  flex-shrink: 0 !important;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5vh 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

/* ==========================================================================
   4. GJØREMÅL & HUSKELISTE-KORT
   ========================================================================== */
.todo-card {
  flex: 42; /* Fyller ca 42% av høyre kolonne */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.8vh 1.8vw;
  min-height: 0;
}

.todo-actions-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tiny-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tiny-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}

.todo-source-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.todo-source-tag.connected {
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-blue);
  border-color: rgba(59, 130, 246, 0.4);
}

.todo-sync-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.todo-sync-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  transform: rotate(90deg);
}

.todo-sync-btn.spinning {
  animation: spin 1s linear infinite;
}

.todo-input-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 1vh;
}

.todo-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.todo-input:focus {
  border-color: var(--accent-green);
}

.todo-add-btn {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--accent-green);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.todo-add-btn:hover {
  background: rgba(52, 211, 153, 0.25);
}

.todo-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5vh;
  scrollbar-width: none;
}

.todo-list::-webkit-scrollbar {
  display: none;
}

.todo-item {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6vh 0.8vw;
  gap: 0.8vw;
  transition: all 0.2s;
}

.todo-item.completed {
  opacity: 0.5;
  background: rgba(0, 0, 0, 0.15);
}

.todo-checkbox {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.todo-item.completed .todo-checkbox {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
}

.todo-checkbox svg {
  display: none;
}

.todo-item.completed .todo-checkbox svg {
  display: block;
}

.todo-text {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-primary);
  word-break: break-word;
  cursor: pointer;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
  opacity: 0.4;
  transition: opacity 0.2s, color 0.2s;
}

.todo-delete:hover {
  opacity: 1;
  color: var(--accent-red);
}

/* ==========================================================================
   5. NATTMODUS & DIMMING
   ========================================================================== */
.night-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 1.5s ease-in-out;
}

body.night-mode {
  filter: brightness(0.35) contrast(0.95);
}

body.night-mode .night-overlay {
  opacity: 0.25;
}

/* ==========================================================================
   6. INNSTILLINGS-MODAL (TILPASSET TOUCH OG TABLET)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2vw;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: #111827;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.3rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0.3rem 0;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.setting-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.setting-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.setting-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.8rem;
}

.setting-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-input, .form-select {
  background: #1f293d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.calendar-input-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.color-picker {
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  cursor: pointer;
}

.small-btn {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

.delete-btn {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-red);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
}

.btn-primary {
  background: var(--accent-blue);
  color: #000;
}

/* ==========================================================================
   HURTIGGLIMT: NYHETER VED BERØRING (POP-UP)
   ========================================================================== */
.news-glimpse-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.news-glimpse-btn:hover,
.news-glimpse-btn:focus,
.news-glimpse-btn:active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-1px);
}

.news-glimpse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* ==========================================================================
   DYNAMISK NYHETSSHOW / PRESENTASJON (STORY SLIDESHOW)
   ========================================================================== */
.news-pres-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 18, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  display: none !important;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease;
  padding: 2vw;
}

.news-pres-backdrop.open {
  display: flex !important;
}

.news-pres-window {
  position: relative;
  width: clamp(760px, 86vw, 1150px);
  height: clamp(480px, 76vh, 680px);
  background: #080c16;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Story-indikatorer (fylles i sanntid) */
.news-story-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 6px;
  padding: 14px 18px 8px 18px;
  z-index: 30;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.story-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.story-bar-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 4px;
  transition: width 0.08s linear;
}

.story-bar.completed .story-bar-fill {
  width: 100% !important;
}

/* Topplinje i presentasjonen */
.news-pres-topbar {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 30;
}

.news-pres-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.news-pres-brand-title {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
}

.news-pres-counter {
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(6, 182, 212, 0.18);
  padding: 2px 8px;
  border-radius: 10px;
}

.news-pres-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.news-control-btn {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.news-control-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.news-close-btn {
  font-size: 1.5rem;
  line-height: 1;
}

/* Viewport for slides */
.news-slide-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.news-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s cubic-bezier(0.2, 0.9, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.news-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.news-slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
  will-change: transform;
}

.news-slide.active .news-slide-bg {
  animation: kenBurnsShow 8s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes kenBurnsShow {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.news-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 12, 22, 0.45) 0%,
    rgba(8, 12, 22, 0.1) 40%,
    rgba(8, 12, 22, 0.75) 70%,
    rgba(8, 12, 22, 0.96) 100%
  );
  pointer-events: none;
}

.news-slide-caption {
  position: relative;
  z-index: 10;
  padding: 0 44px 40px 44px;
  max-width: 92%;
  transform: translateY(22px);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.55s ease;
}

.news-slide.active .news-slide-caption {
  transform: translateY(0);
  opacity: 1;
}

.news-slide-tagline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #ffffff;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.45);
}

.news-slide-time {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

.news-slide-headline {
  font-size: clamp(1.4rem, 2.5vw, 2.4rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.22;
  margin: 0;
  letter-spacing: -0.015em;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.9);
}

/* Klikkbare berøringssoner på venstre / høyre side */
.news-nav-zone {
  position: absolute;
  top: 70px;
  bottom: 0;
  width: 14%;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 25;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s, background 0.25s;
  color: #ffffff;
}

.news-nav-zone.nav-prev {
  left: 0;
  justify-content: flex-start;
  padding-left: 20px;
}

.news-nav-zone.nav-next {
  right: 0;
  justify-content: flex-end;
  padding-right: 20px;
}

.news-nav-zone:hover,
.news-nav-zone:active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.2);
}

.nav-arrow {
  font-size: 1.5rem;
  background: rgba(0, 0, 0, 0.65);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   REDIGERINGS-MODUS / ENDRE-MODUS (FLYTT OG TILPASS KORT)
   ========================================================================== */
#editModeToggleBtn.active {
  background: rgba(56, 189, 248, 0.25);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
  opacity: 1;
}

.edit-mode-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(56, 189, 248, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideDownBanner 0.25s ease-out;
  z-index: 50;
  flex-shrink: 0;
}

@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

body.edit-mode .edit-mode-banner {
  display: flex;
}

.edit-mode-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.edit-mode-pill {
  background: var(--accent-blue);
  color: #000;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.edit-mode-buttons {
  display: flex;
  gap: 8px;
}

/* Kortenes utseende i redigeringsmodus */
body.edit-mode .card {
  border: 2px dashed rgba(56, 189, 248, 0.7) !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.18) !important;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.edit-mode .card:hover {
  border-color: var(--accent-blue) !important;
}

/* Verktøylinje festet øverst i hvert kort i endre-modus */
.widget-edit-bar {
  display: none;
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 60;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.8);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  gap: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
}

body.edit-mode .widget-edit-bar {
  display: flex;
}

.widget-move-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: all 0.15s ease;
}

.widget-move-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.widget-move-btn:active {
  transform: scale(0.92);
}

.widget-move-btn.btn-switch {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
}

/* Modulstørrelser */
.card.size-compact {
  padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.2vw, 16px) !important;
}
.card.size-compact .hours-minutes {
  font-size: clamp(2rem, 3.8vw, 3.2rem) !important;
}
.card.size-compact .astro-strip {
  gap: 3px !important;
}
.card.size-compact .astro-item {
  padding: 3px 6px !important;
}
.card.size-compact .events-list {
  max-height: 120px !important;
}

.card.size-large {
  padding: clamp(14px, 2.2vh, 26px) clamp(16px, 2.2vw, 28px) !important;
}
.card.size-large .events-list {
  max-height: 380px !important;
}

.widget-size-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 1px;
  margin-right: 4px;
  border: 1px solid var(--border-subtle);
}

.widget-size-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.widget-size-btn.active {
  background: var(--accent-blue);
  color: #000;
}

.widget-move-btn.btn-trash {
  color: #ef4444;
}
.widget-move-btn.btn-trash:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ff6b6b;
}

/* Interaktiv kolonnesplitter (Horisontal breddejustering) */
.column-splitter {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32px;
  left: calc(var(--col-split, 48%) + (clamp(14px, 2vw, 24px) / 2) - 16px);
  cursor: col-resize;
  z-index: 75;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

body.edit-mode .column-splitter {
  display: flex;
}

.splitter-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: background 0.2s, width 0.2s;
}

.column-splitter:hover .splitter-line,
.column-splitter.dragging .splitter-line {
  background: var(--accent-blue);
  width: 4px;
}

.splitter-handle {
  position: relative;
  z-index: 2;
  background: #0f172a;
  border: 2px solid var(--accent-blue);
  color: var(--accent-blue);
  width: 30px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7), 0 0 14px rgba(56, 189, 248, 0.5);
  transition: transform 0.15s, background 0.15s;
}

.column-splitter:hover .splitter-handle,
.column-splitter.dragging .splitter-handle {
  transform: scale(1.1);
  background: #1e293b;
}

/* Interaktivt hjørnehåndtak for fri vertikal høyde */
.card-resize-handle {
  display: none;
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 34px;
  height: 34px;
  cursor: se-resize;
  z-index: 65;
  touch-action: none;
  user-select: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 5px;
}

body.edit-mode .card-resize-handle {
  display: flex;
}

.card-resize-icon {
  width: 14px;
  height: 14px;
  border-right: 3px solid var(--accent-blue);
  border-bottom: 3px solid var(--accent-blue);
  border-radius: 1px;
  opacity: 0.8;
  transition: opacity 0.15s, transform 0.15s;
}

.card-resize-handle:hover .card-resize-icon,
.card-resize-handle.resizing .card-resize-icon {
  opacity: 1;
  transform: scale(1.25);
  border-color: #38bdf8;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.9));
}

/* Full-bredde kolonner (over og under to-kolonne oppsettet) */
.full-width-col {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 1.5vh;
  width: 100%;
}
.full-width-col:empty {
  display: none;
}

/* --- STRØMPRISER MODUL --- */
.power-card {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 14px);
  min-height: 0;
}

.power-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.power-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-yellow);
}

.power-region-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.power-region-badge:hover {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

.power-main-content {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: clamp(6px, 0.8vw, 12px);
  align-items: center;
}

.power-stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: clamp(6px, 1vh, 12px) clamp(8px, 1vw, 14px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.power-stat-box.current-box {
  background: rgba(234, 179, 8, 0.06);
  border-color: rgba(234, 179, 8, 0.3);
}

.power-label {
  font-size: clamp(0.55rem, 0.65vw, 0.68rem);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.power-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
}

.power-big-val {
  font-size: clamp(1.4rem, 2.2vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.power-val {
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.power-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.power-level-pill {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-block;
  width: fit-content;
  text-transform: uppercase;
}

.level-low { background: rgba(52, 211, 153, 0.2); color: #34d399; }
.level-normal { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.level-high { background: rgba(251, 146, 60, 0.2); color: #fb923c; }
.level-peak { background: rgba(244, 63, 94, 0.2); color: #f43f5e; }

.power-bars-container {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  height: 44px;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border-subtle);
}

.power-bar {
  background: var(--accent-blue);
  border-radius: 2px;
  min-height: 4px;
  transition: height 0.3s ease;
  position: relative;
}

.power-bar.active-hour {
  background: var(--accent-yellow) !important;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.8);
}

/* --- HURTIGNOTAT MODUL --- */
.sticky-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(254, 240, 138, 0.04);
  border-color: rgba(254, 240, 138, 0.2);
}

.sticky-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fef08a;
  font-size: 0.85rem;
  font-weight: 700;
}

.sticky-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sticky-saved-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sticky-textarea {
  flex: 1;
  min-height: 75px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(254, 240, 138, 0.15);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(0.85rem, 1vw, 1rem);
  line-height: 1.4;
  resize: none;
  outline: none;
}

.sticky-textarea:focus {
  border-color: rgba(254, 240, 138, 0.5);
}

.sticky-quick-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.sticky-tag-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.sticky-tag-btn:hover {
  background: rgba(254, 240, 138, 0.2);
  color: #fef08a;
  border-color: rgba(254, 240, 138, 0.4);
}

.sticky-clear-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 3px 6px;
  font-family: inherit;
}
.sticky-clear-btn:hover { color: #f87171; }

/* --- NEDTELLING MODUL --- */
.countdown-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.countdown-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.countdown-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-purple);
  font-size: 0.85rem;
  font-weight: 700;
}

.countdown-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.countdown-title-text {
  font-size: clamp(0.95rem, 1.2vw, 1.2rem);
  font-weight: 700;
  color: var(--text-primary);
}

.countdown-days-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.countdown-days-num {
  font-size: clamp(2.2rem, 3.6vw, 3.2rem);
  font-weight: 900;
  color: var(--accent-purple);
  line-height: 1;
  text-shadow: 0 0 16px rgba(168, 85, 247, 0.35);
}

.countdown-days-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.countdown-date-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- MODULBIBLIOTEK MODAL --- */
.library-modal-window {
  max-width: 680px;
  width: 92%;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--accent-blue);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.2);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.library-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.library-item:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.04);
}

.library-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.library-item-icon {
  font-size: 1.4rem;
}

.library-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  flex: 1;
}

.library-item-btn {
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all 0.2s;
  font-family: inherit;
}

.library-item-btn.active {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.5);
  color: #34d399;
}

.library-item-btn:hover:not(.active) {
  background: var(--accent-blue);
  color: #000;
}

/* ==========================================================================
   RESPONSIV TILPASNING FOR NETTBRETT OG SMÅ SKJERMER
   ========================================================================== */

/* Høyde-tilpasning for vanlige nettbrett (f.eks. 1280x800, 1024x600, 1920x1080) */
@media (max-height: 860px) {
  .dashboard-container {
    padding: clamp(10px, 1.6vh, 16px) clamp(12px, 2vw, 20px);
    gap: clamp(8px, 1.2vh, 14px);
  }

  .column {
    gap: clamp(8px, 1.2vh, 14px);
  }

  .top-bar {
    height: clamp(24px, 3vh, 30px);
  }

  .card {
    padding: clamp(10px, 1.4vh, 16px) clamp(12px, 1.4vw, 18px);
  }

  .clock-card {
    padding: clamp(8px, 1.2vh, 14px) clamp(12px, 1.6vw, 20px);
  }

  .hours-minutes {
    font-size: clamp(2.4rem, 4.5vw, 4rem);
  }

  .weather-card {
    padding: clamp(10px, 1.4vh, 16px) clamp(12px, 1.4vw, 18px);
    gap: clamp(4px, 0.8vh, 8px);
  }

  .weather-details-grid {
    padding: clamp(4px, 0.6vh, 8px) clamp(6px, 0.7vw, 10px);
    gap: clamp(3px, 0.5vh, 6px) clamp(4px, 0.5vw, 8px);
  }

  .astro-item {
    padding: clamp(3px, 0.5vh, 6px) clamp(4px, 0.5vw, 6px);
  }
}

/* Bredde-tilpasning for kompakte nettbrett */
@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: 48% 52%;
    gap: 1.5vw;
  }
  
  .current-weather {
    gap: 8px;
  }

  .detail-label {
    font-size: 0.58rem;
  }

  .detail-value {
    font-size: 0.82rem;
  }
}

/* Vertikal orientering eller smalere enn 4:3 (hvis nettbrettet snus) */
@media (max-aspect-ratio: 1.15/1) {
  html, body {
    overflow-y: auto !important;
    height: auto;
    min-height: 100vh;
  }

  .dashboard-container {
    height: auto;
    min-height: 100vh;
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    overflow-y: visible;
  }

  .column {
    min-height: auto;
  }

  .weather-card, .calendar-card {
    overflow: visible;
  }
}
