/* Kreatek Admin — mørk, polert app-stil */

:root {
  --bg-0: #0d0d14;
  --bg-1: #14141f;
  --bg-2: #161624;
  --bg-3: #1f2937;
  --bg-4: #111827;
  --text-1: #ffffff;
  --text-2: #cbd5e1;
  --text-3: #8a8aa0;
  --text-4: #5a5a70;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --success: #34d399;
  --success-bg: rgba(16,185,129,0.18);
  --amber: #fbbf24;
  --amber-bg: rgba(245,158,11,0.18);
  --danger: #ff6b6b;
  --indigo: #818cf8;
  --pink: #f472b6;
  --purple: #a855f7;
  --green-grad: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --amber-grad: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --pink-grad: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  --indigo-grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --purple-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --mic-grad: linear-gradient(135deg, #ec4899 0%, #a855f7 50%, #6366f1 100%);
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  color: var(--text-1);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.hidden { display: none !important; }
.muted { color: var(--text-3); }
.small { font-size: 11px; }
.label { font-size: 10px; color: var(--text-3); letter-spacing: 1.5px; font-weight: 500; text-transform: uppercase; }
.error { color: #ff8a8a; font-size: 13px; margin-top: 8px; }

/* ---------- LOGIN ---------- */
#view-login {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.logo { text-align: center; margin-bottom: 22px; }
.logo-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--mic-grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 500;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(168,85,247,0.45);
}
.logo h1 { font-size: 20px; font-weight: 500; margin: 0 0 4px; }
#login-form { display: flex; flex-direction: column; gap: 12px; }
#login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-3); }
#login-form input {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text-1);
  outline: none;
}
#login-form input:focus { border-color: var(--purple); }

/* ---------- HOVEDAPP / TOPPLINJE ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px 10px;
}
.topbar .title { font-size: 22px; font-weight: 500; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border: none; color: white; font-weight: 500;
  box-shadow: 0 6px 18px rgba(99,102,241,0.45);
  cursor: pointer;
}

/* ---------- KORT ---------- */
.card {
  margin: 0 22px 14px;
  padding: 14px 16px;
  background: var(--bg-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 20px rgba(0,0,0,0.35), inset 0 0 0 1px var(--border);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}

/* Preview-kort med iframe */
.preview-card { padding: 14px 14px 0; }
.preview-card .card-head { padding: 0 4px 12px; }
.preview-card iframe {
  width: 100%; height: 200px;
  border: 0;
  border-radius: 14px;
  background: #0f172a;
  filter: brightness(0.9);
}

/* Kostnads-kort */
.cost-card { background: linear-gradient(135deg, var(--bg-3), var(--bg-4)); }
.cost-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.cost-amount { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.cost-amount > span:first-child { font-size: 26px; font-weight: 500; }
.cost-actions { display: flex; gap: 10px; }

/* Pill (status-tag) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 500;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-success .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.pill-warn { background: var(--amber-bg); color: var(--amber); }
.pill-warn .dot { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pill-muted { background: rgba(255,255,255,0.08); color: var(--text-3); }
.pill-muted .dot { background: var(--text-3); }
.pill-danger { background: rgba(255,107,107,0.18); color: var(--danger); }
.pill-danger .dot { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

/* Knapper */
button { cursor: pointer; font-family: inherit; }
.btn-primary, .btn-success, .btn-danger, .btn-ghost {
  border: none; border-radius: var(--radius-md);
  padding: 12px 16px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: white;
}
.btn-primary { background: var(--purple-grad); width: 100%; padding: 14px; box-shadow: 0 4px 14px rgba(99,102,241,0.4); }
.btn-success { background: var(--green-grad); flex: 1; box-shadow: 0 4px 14px rgba(16,185,129,0.4); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); flex: 1; box-shadow: 0 4px 14px rgba(239,68,68,0.4); }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--text-1); border: 1px solid var(--border-strong); }
.btn-back {
  background: rgba(255,255,255,0.06);
  border: none; color: var(--text-1);
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 22px 14px;
}

/* Hurtigknapper */
.quick-grid {
  padding: 0 22px 14px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.quick {
  border: none; padding: 14px 12px; border-radius: 16px;
  color: white; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
}
.quick strong { font-size: 13px; font-weight: 500; }
.quick .small { font-size: 10px; opacity: 0.85; }
.quick-green  { background: var(--green-grad);  box-shadow: 0 8px 18px rgba(16,185,129,0.35); }
.quick-amber  { background: var(--amber-grad);  box-shadow: 0 8px 18px rgba(245,158,11,0.35); }
.quick-pink   { background: var(--pink-grad);   box-shadow: 0 8px 18px rgba(236,72,153,0.35); }
.quick-indigo { background: var(--indigo-grad); box-shadow: 0 8px 18px rgba(99,102,241,0.35); }

/* Strip */
.strip { padding: 0 22px 14px; display: flex; gap: 8px; }
.strip-item {
  flex: 1; padding: 8px 10px; border-radius: 12px;
}
.s-green  { background: rgba(16,185,129,0.1);  border: 1px solid rgba(16,185,129,0.2); }
.s-green  .label { color: var(--success); }
.s-amber  { background: rgba(245,158,11,0.1);  border: 1px solid rgba(245,158,11,0.2); }
.s-amber  .label { color: var(--amber); }
.s-indigo { background: rgba(99,102,241,0.1);  border: 1px solid rgba(99,102,241,0.2); }
.s-indigo .label { color: var(--indigo); }
.strip-item > div:last-child { font-size: 12px; margin-top: 2px; }

/* Aktivitet */
.activity { font-size: 12px; line-height: 1.7; max-height: 200px; overflow-y: auto; padding-right: 4px; }
.activity .entry { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.activity .entry:last-child { border-bottom: none; }
.activity .ts { color: var(--text-4); font-variant-numeric: tabular-nums; font-size: 10px; padding-top: 3px; min-width: 48px; }
.activity .who-user   { color: var(--purple); }
.activity .who-codex  { color: var(--success); }
.activity .who-system { color: var(--amber); }

/* Produkter */
#view-products { padding-bottom: 100px; }
.search-row { padding: 0 22px 14px; display: flex; gap: 8px; }
.search-row input {
  flex: 1; background: var(--bg-2); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 12px 16px; color: var(--text-1); font-size: 14px;
  outline: none;
}
.search-row input:focus { border-color: var(--purple); }
.mic-btn-small {
  width: 44px; height: 44px; border-radius: 50%;
  border: none; background: var(--mic-grad); color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(168,85,247,0.45);
}
.prod-list { padding: 0 22px; display: flex; flex-direction: column; gap: 10px; }
.prod-item {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  text-align: left; width: 100%;
}
.prod-thumb {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--purple-grad);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 500;
}
.prod-meta { flex: 1; }
.prod-meta .name { font-weight: 500; }
.prod-meta .price { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* Produktdetalj */
.prod-detail-hero {
  margin: 0 22px 14px; height: 140px;
  border-radius: 20px; overflow: hidden;
  background: linear-gradient(135deg, #312e81, #7e22ce);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
}
.discount-list { display: flex; flex-direction: column; gap: 8px; }
.discount-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px;
}
.discount-row.d1 { background: rgba(16,185,129,0.08);  border: 1px solid rgba(16,185,129,0.2); }
.discount-row.d2 { background: rgba(245,158,11,0.08);  border: 1px solid rgba(245,158,11,0.2); }
.discount-row.d3 { background: rgba(236,72,153,0.08);  border: 1px solid rgba(236,72,153,0.2); }
.discount-row .qty {
  width: 36px; height: 28px; border-radius: 8px; color: white;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500;
}
.discount-row.d1 .qty { background: var(--green-grad); }
.discount-row.d2 .qty { background: var(--amber-grad); }
.discount-row.d3 .qty { background: var(--pink-grad); }

/* Transcript */
.transcript { font-size: 13px; line-height: 1.6; max-height: 60vh; overflow-y: auto; }
.transcript .msg { padding: 8px 0; border-bottom: 1px solid var(--border); }
.transcript .msg:last-child { border-bottom: none; }
.transcript .msg.user { color: var(--text-2); }
.transcript .msg .role { font-size: 10px; letter-spacing: 1.5px; color: var(--text-4); margin-bottom: 2px; }

/* Intent-sheet */
.sheet {
  position: fixed; left: 22px; right: 22px; bottom: 110px;
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(168,85,247,0.18));
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(168,85,247,0.3);
  padding: 14px 16px;
  z-index: 30;
}
.user-said { font-size: 13px; font-style: italic; color: white; line-height: 1.5; margin: 6px 0 0; }
.intent-summary { font-size: 14px; color: white; line-height: 1.5; margin: 6px 0 0; }
.sheet-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Voice-overlay */
.voice-overlay {
  position: fixed; inset: 0;
  background: rgba(13,13,20,0.92);
  backdrop-filter: blur(12px);
  z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px;
}
.voice-ring {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--mic-grad);
  box-shadow: 0 0 0 0 rgba(168,85,247,0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(168,85,247,0.6); }
  100% { box-shadow: 0 0 0 40px rgba(168,85,247,0); }
}
.voice-text { font-size: 16px; color: var(--text-2); }
.voice-interim { font-size: 14px; color: var(--text-3); text-align: center; min-height: 22px; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(20,20,31,0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  border: none; background: transparent; color: var(--text-4);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 9px; padding: 4px 8px;
}
.tab.tab-active { color: var(--purple); }
.tab-spacer { width: 64px; }

/* Flytende mic */
.mic-btn {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(50px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--mic-grad); border: none; color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 32px rgba(168,85,247,0.55), 0 0 0 6px rgba(168,85,247,0.08);
  z-index: 25;
}
.mic-btn:active { transform: translateX(-50%) scale(0.96); }

/* Padding under hovedinnholdet så tabbar ikke dekker noe */
#view-dashboard, #view-codex, #view-product { padding-bottom: 130px; }

/* SVG-aktig ikoner (rene inline via CSS, ingen ekstern font) */
.i { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; background-repeat: no-repeat; background-position: center; background-size: contain; }
.i-mic     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='9' y='2' width='6' height='12' rx='3'/><path d='M5 10a7 7 0 0 0 14 0'/><line x1='12' y1='17' x2='12' y2='21'/></svg>"); }
.i-home    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 11l9-8 9 8'/><path d='M5 10v10h14V10'/></svg>"); }
.i-pkg     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 16V8l-9-5-9 5v8l9 5z'/><polyline points='3 8 12 13 21 8'/><line x1='12' y1='13' x2='12' y2='22'/></svg>"); }
.i-term    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 17 10 11 4 5'/><line x1='12' y1='19' x2='20' y2='19'/></svg>"); }
.i-out     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/><polyline points='16 17 21 12 16 7'/><line x1='21' y1='12' x2='9' y2='12'/></svg>"); }
.i-back    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>"); width: 22px; height: 22px; }
.i-rocket  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 14l6 6 4-2 6-12-12 6z'/><circle cx='15' cy='9' r='1.5'/></svg>"); width: 20px; height: 20px; }
.i-tag     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 12l-8 8-9-9V3h8z'/><circle cx='7' cy='7' r='1.5'/></svg>"); width: 20px; height: 20px; }
.i-layout  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><line x1='3' y1='9' x2='21' y2='9'/><line x1='9' y1='21' x2='9' y2='9'/></svg>"); width: 20px; height: 20px; }
.i-bug     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='8' y='6' width='8' height='14' rx='4'/><path d='M3 12h5M16 12h5M5 8l3 2M19 8l-3 2M5 18l3-2M19 18l-3-2M9 4l1 2M15 4l-1 2'/></svg>"); width: 20px; height: 20px; }
.i-play, .i-pause, .i-check, .i-x { width: 16px; height: 16px; display: inline-block; vertical-align: -2px; background-repeat: no-repeat; background-position: center; background-size: contain; }
.i-play  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><polygon points='6 4 20 12 6 20'/></svg>"); }
.i-pause { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><rect x='6' y='4' width='4' height='16'/><rect x='14' y='4' width='4' height='16'/></svg>"); }
.i-check { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 18 20 6'/></svg>"); }
.i-x     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='18' y1='6' x2='6' y2='18'/></svg>"); }
