/* PostNord Sans (the same files the chat widget ships) and PostNord's design tokens
   (pn-design-assets colors.js); token names in the comments. */
@font-face { font-family: "PostNordSans"; src: url("fonts/PNSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PostNordSans"; src: url("fonts/PNSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "PostNordSans"; src: url("fonts/PNSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --navy: #0d234b; /* blue900 */
  --navy-2: #1b3463; /* blue900, lighter, for the active tab */
  --blue: #005d92; /* blue700: primary actions, links */
  --accent: #00a0d6; /* blue400: focus */
  --blue-50: #e0f8ff; /* blue50 */
  --bg: #f3f5fa; /* my.postnord.no page background */
  --surface: #ffffff;
  --line: #d3cecb; /* gray200 */
  --field: #969087; /* gray400: form field borders (3:1) */
  --muted: #5e554a; /* gray700 */
  --text: #2d2013; /* gray900 */
  --ok: #005e41; /* green700 */
  --ok-bg: #dcf6e7; /* green50 */
  --ok-line: #abe3bb; /* green200 */
  --warn: #99290a; /* orange700 */
  --warn-bg: #fff1e3; /* orange50 */
  --bad: #9b1c2e; /* coral700 */
  --bad-dark: #500715; /* coral900 */
  --bad-bg: #fdefee; /* coral50 */
  --bad-line: #fbc2c1; /* coral200 */
  --soft: #f3f2f2; /* gray50 */
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 "PostNordSans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
.boot { padding: 40px; color: var(--muted); }

/* layout */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.top h1 { font-size: 17px; font-weight: 700; }
.stage { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 6px; background: #ffc8a3; color: #4f1600; } /* orange200/900 */
.stage.prod { background: #f06365; color: #500715; } /* coral400/900 */
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tabs button { background: transparent; border: 0; color: #e0f8ff; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.tabs button[aria-current="page"] { background: var(--navy-2); color: #fff; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: #e0f8ff; font-size: 13px; }
.who button { background: transparent; border: 1px solid #8eddf9; color: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
main { max-width: 1240px; margin: 0 auto; padding: 20px; }

/* basics */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 7px 13px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--field); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--navy); border-color: var(--navy); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack > * + * { margin-top: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.badge.live { background: var(--ok-bg); color: var(--ok); }
.badge.scheduled { background: var(--blue-50); color: var(--blue); }
.badge.draft { background: var(--soft); color: var(--muted); }
.badge.ended, .badge.archived { background: var(--soft); color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 10; max-width: calc(100vw - 32px); }
.toast.bad { background: var(--bad); }
.errors { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-dark); border-radius: 10px; padding: 10px 14px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }

/* login */
.login { max-width: 380px; margin: 10vh auto; }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.field { display: grid; gap: 4px; }
.field > span { font-weight: 600; font-size: 13px; }
.field .hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="password"], input[type="url"], input[type="datetime-local"], select, textarea {
  width: 100%; border: 1px solid var(--field); border-radius: 9px; padding: 8px 10px; background: #fff;
}
textarea { resize: vertical; min-height: 64px; }
.count { font-size: 12px; color: var(--muted); text-align: right; }
.count.over { color: var(--bad); font-weight: 700; }

/* kill switch */
.switch { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid; flex-wrap: wrap; }
.switch.on { background: var(--ok-bg); border-color: var(--ok-line); }
.switch.off { background: var(--bad-bg); border-color: var(--bad-line); }
.switch strong { font-size: 15px; }
.switch .row { margin-left: auto; }

/* list */
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 10px; }
.section-title h2 { font-size: 16px; }
.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.item .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 330px; }
.empty { color: var(--muted); padding: 10px 2px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

/* editor */
.presets { display: grid; gap: 14px; }
.preset-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.preset-opt { font: inherit; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.preset-opt[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0, 93, 146, 0.2); background: var(--blue-50); }
.preset-opt .pnn-tile { width: 28px; height: 28px; border-radius: 7px; }
.preset-opt .pnn-icon { width: 17px; height: 17px; }
.preset-opt b { font-size: 13px; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lang { display: grid; gap: 10px; align-content: start; }
.lang h3 { font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 700; padding: 0 6px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.ranges { font-size: 13px; }
.ranges code { background: var(--soft); padding: 1px 5px; border-radius: 5px; margin: 0 4px 4px 0; display: inline-block; }
.sticky { position: sticky; top: 16px; }

/* preview: a slice of the chat panel */
.chat { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); box-shadow: 0 8px 30px rgba(13, 27, 62, 0.12); }
.chat-head { background: var(--navy); color: #fff; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; background: #1b3463; display: grid; place-items: center; font-size: 16px; }
.chat-head b { display: block; font-size: 14.5px; }
.chat-head span { font-size: 12px; color: #e0f8ff; }
.chat-body { padding: 12px; display: grid; gap: 10px; min-height: 220px; align-content: start; }
.bubble { background: #fff; border-radius: 14px; padding: 10px 12px; max-width: 85%; font-size: 14px; }
.preview-tools { display: flex; gap: 6px; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }

/* audit */
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: top; }
th { background: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

dialog { border: 0; border-radius: 14px; padding: 22px; max-width: 440px; width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(13, 27, 62, 0.45); }
dialog h2 { font-size: 17px; margin-bottom: 8px; }
dialog p { margin: 0 0 18px; color: var(--muted); }

@media (max-width: 960px) {
  .grid2 { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .item { grid-template-columns: 1fr; }
  .item .actions { justify-content: flex-start; max-width: none; }
}
@media (max-width: 640px) {
  .langs { grid-template-columns: 1fr; }
  main { padding: 16px; }
  .top-in { padding: 10px 16px; }
  .tabs { margin-left: 0; }
}
.toolbar { margin-top: 18px; }
.item .pnn-actions { display: none; }
.pnn-swatch { display: inline-flex; }

/* templates */
.templates { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px 14px; }
.templates > summary { cursor: pointer; padding: 2px 0; }
.templates[open] > summary { margin-bottom: 10px; }
.templates .preset-group + .preset-group { margin-top: 12px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.template-opt { font: inherit; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.template-opt:hover { border-color: var(--field); }
.template-opt[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-50); }
.template-opt .pnn-tile { width: 30px; height: 30px; border-radius: 8px; }
.template-opt .pnn-icon { width: 18px; height: 18px; }
.template-opt b { display: block; font-size: 13.5px; }
.template-opt .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.placeholders { background: var(--warn-bg); border: 1px solid #ffc8a3; color: var(--warn); border-radius: 10px; padding: 10px 14px; } /* orange200 */
.placeholders code { background: #fff; border: 1px solid #ffc8a3; padding: 0 5px; border-radius: 5px; margin: 0 4px 2px 0; display: inline-block; color: var(--text); }

/* ---- two kinds of notice: chat banners (blue) and postcode notices (green) ---- */
:root {
  --pc: #005e41; /* green700 */
  --pc-bg: #edfbf3; /* green25 */
  --pc-line: #abe3bb; /* green200 */
  --chat: #005d92; /* blue700 */
  --chat-bg: #effbff; /* blue25 */
  --chat-line: #8eddf9; /* blue200 */
}
.stack-lg > * + * { margin-top: 18px; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; }
.tabs .tab-chat::before, .tabs .tab-postcode::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.tabs .tab-chat::before { background: #00a0d6; } /* blue400 */
.tabs .tab-postcode::before { background: #5ec584; } /* green400 */
.tab-count { font-size: 11px; font-weight: 700; background: #ffffff; color: var(--navy); border-radius: 999px; padding: 0 6px; line-height: 17px; }
.type-badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.type-badge.chat { background: var(--chat-bg); color: var(--chat); border: 1px solid var(--chat-line); }
.type-badge.postcode { background: var(--pc-bg); color: var(--pc); border: 1px solid var(--pc-line); }
.type-badge.small { font-size: 11px; padding: 1px 6px; }
.intro { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 12px 14px; border: 1px solid; border-left-width: 5px; }
.intro p { margin: 0; }
.intro.chat { background: var(--chat-bg); border-color: var(--chat-line); border-left-color: var(--chat); }
.intro.postcode { background: var(--pc-bg); border-color: var(--pc-line); border-left-color: var(--pc); }
.btn.primary.pc-new { background: var(--pc); border-color: var(--pc); }
.btn.primary.pc-new:hover { background: #002f24; border-color: #002f24; } /* green900 */

/* postcode notice rows */
.cat-tile { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--pc); color: #fff; }
.cat-tile svg { width: 20px; height: 20px; }
.cat-tile .pnn-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat-tile .pnn-fill { fill: currentColor; }
.pc-item { border-left: 4px solid var(--pc); }
.pc-head { display: flex; gap: 12px; align-items: flex-start; }
.pc-msg { margin: 2px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-ranges { margin-top: 8px; }
.chips code { display: inline-block; background: var(--pc-bg); border: 1px solid var(--pc-line); color: var(--pc); border-radius: 6px; padding: 0 6px; margin: 0 4px 4px 0; font-size: 13px; }
.pc-check h2 { font-size: 16px; margin-bottom: 2px; }
.checker { display: grid; gap: 8px; }
.checker input { max-width: 160px; font-size: 16px; letter-spacing: 0.08em; }
.checker-out ul { margin: 4px 0 0; padding-left: 18px; }
.checker-out p { margin: 0; }

/* postcode notice editor */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cat-opt { font: inherit; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
.cat-opt .cat-tile { width: 28px; height: 28px; border-radius: 7px; }
.cat-opt .cat-tile svg { width: 17px; height: 17px; }
.cat-opt[aria-pressed="true"] { border-color: var(--pc); background: var(--pc-bg); box-shadow: 0 0 0 2px rgba(0, 94, 65, 0.18); }
.pc-fieldset { border-color: var(--pc-line); background: #fcfffd; }
.pc-fieldset legend { color: var(--pc); }
.help { background: var(--pc-bg); border: 1px solid var(--pc-line); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.help ul { margin: 6px 0 0; padding-left: 18px; }
.help li + li { margin-top: 3px; }
.help code, .range-lines code { background: #fff; border: 1px solid var(--pc-line); border-radius: 5px; padding: 0 5px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shortcuts .btn { font-weight: 600; }
.shortcuts .btn .muted { font-weight: 400; }
.readout p { margin: 0 0 6px; }
.range-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.range-lines li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 5px 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.range-lines li code { font-weight: 700; color: var(--pc); }
.range-lines li span { flex: 1; color: var(--muted); font-size: 14px; }
.field .label { font-weight: 600; font-size: 13px; }
.radios { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--pc); background: var(--pc-bg); }
.radio input { margin-top: 3px; accent-color: var(--pc); }
.radio b, .radio .muted { display: block; }
.demo { padding: 12px; display: grid; gap: 10px; align-content: start; min-height: 160px; }
.bubble.user { justify-self: end; background: var(--navy); color: #fff; }
.bubble mark { background: var(--pc-bg); color: inherit; border-bottom: 2px solid var(--pc-line); padding: 0 2px; }
.intro .type-badge { flex: none; margin-top: 1px; }
.shortcuts-box > summary { cursor: pointer; padding: 2px 0; }
.shortcuts-box[open] > summary { margin-bottom: 8px; }
