/*
 * «Godkännanden» / «Ansökningar» (overview/approvals.html), the page's own look on top of tokens.css, admin-v2.css and page.css
 * (round 47, panel redesign R4; it was the page's inline style block). One approval card, shared in look with «Granska papper»
 * (taxi/css/review.css): who applied and for what, then the papers at once, each with «Visa» before any decision, then
 * «Godkänn» and «Avslå» with the reason, as large buttons. Colours only through the panel's variables and page.css's tones
 * (a darker or lighter shade is a mix of two of them), so light and dark both follow the theme button. Logical properties, so
 * Arabic mirrors by itself. Bigger, calmer type (owner, note 86): what is read at 15-18 px, labels and chips from 13 px.
 */
.ap-page [hidden] { display: none !important; }

/* ---- the line icons beside the words (they were glyphs), and the arrows turned for right-to-left ---- */
.ap-ico { width: 18px; height: 18px; flex: none; }
.pg-btn.sm .ap-ico { width: 16px; height: 16px; }
[dir="rtl"] .ap-flip { transform: scaleX(-1); }

/* ---- the header: the lead and the one action ---- */
.ap-page .pg-sub { font-size: 16px; line-height: 1.5; }
.ap-page .pg-head .pg-btn { min-height: 42px; padding: 9px 20px; font-size: 15px; }

/* ---- the four views as capsule tabs, each with the server's count ---- */
.ap-tabs { border-radius: var(--radius-full); padding: 5px; gap: 4px; margin-block-end: 16px; }
.ap-tabs .pg-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 20px; border-radius: var(--radius-full); font-size: 15px; }
.ap-tabs .pg-tab .pg-count { margin-inline-start: 0; padding: 2px 9px; font-size: 13px; }
.ap-tab .pg-count:empty { display: none; }
.ap-tabs .pg-tab:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: 2px; }

/* ---- the line under the views, and the list's state: calm while it loads or is empty, red when it failed ---- */
.ap-page .pg-lead { font-size: 15px; line-height: 1.55; }
.ap-page .pg-note { font-size: 15px; }
.ap-page .ap-note:not(.error) { color: var(--pg-muted); background: var(--pg-inner); border-color: var(--pg-line); }
.ap-page .ap-note.is-empty:not(.error) { padding: 30px 20px; text-align: center; font-size: 16px; }

/* ---- the card: who, what, the papers, the company, then the decision ---- */
/* one column no wider than the page: a grid track's min-content would be the reason list's longest option, which made the
   wrap 395 px at 390 (an 11 px right gutter); the lists show their choice cut to the card instead */
.ap-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.ap-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; padding: 20px 22px; border-radius: var(--radius-xl); background: var(--pg-surface); border: 1px solid var(--pg-line); box-shadow: var(--pg-lift); }
.ap-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; }
.ap-who { display: flex; gap: 14px; align-items: center; min-width: 0; flex: 1 1 260px; }
/* the initials in the violet tone of page.css (the class beside it) */
.ap-avatar { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; font-size: 17px; font-weight: 800; color: var(--a); background: var(--a-bg); border: 1px solid var(--a-line); }
.ap-id { min-width: 0; }
.ap-name { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.3; color: var(--pg-text); overflow-wrap: anywhere; }
.ap-mail { margin-top: 2px; font-size: 15px; color: var(--pg-muted); overflow-wrap: anywhere; }
.ap-role { text-align: end; }
.ap-role > b { display: block; font-size: 16px; color: var(--pg-text); }
.ap-role > span { display: block; margin-top: 2px; font-size: 15px; color: var(--pg-muted); }

/* ---- the papers: the first thing after the name, each with «Visa» first ---- */
.ap-sec { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pg-muted); }
html[dir="rtl"] .ap-sec { letter-spacing: 0; }
.ap-docs { display: grid; gap: 10px; min-width: 0; }
.ap-doc { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--pg-inner); border: 1px solid var(--pg-line); }
.ap-doc-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; flex: 1 1 240px; }
.ap-doc-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; color: var(--pg-muted); background: var(--pg-surface-flat); border: 1px solid var(--pg-line); }
.ap-doc-ico svg { width: 20px; height: 20px; }
.ap-doc-text { min-width: 0; }
.ap-doc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ap-doc .t { font-size: 16px; font-weight: 700; color: var(--pg-text); overflow-wrap: anywhere; }
.ap-doc .s { margin-top: 3px; font-size: 15px; line-height: 1.45; color: var(--pg-muted); overflow-wrap: anywhere; }
/* a row that wraps (a long name, the reason beside «Avslå») keeps its buttons at the end, as an unwrapped row */
.ap-doc > .ap-actions { margin-inline-start: auto; justify-content: flex-end; }
/* each paper's icon in its state's colour: waiting, approved, refused or missing */
.ap-doc[data-doc-state="pending"] .ap-doc-ico { color: var(--orange); }
.ap-doc[data-doc-state="approved"] .ap-doc-ico { color: var(--accent); }
.ap-doc[data-doc-state="rejected"] .ap-doc-ico, .ap-doc[data-doc-state="missing"] .ap-doc-ico { color: var(--red); }
/* the company the application is for, after the papers */
.ap-biz .ap-doc-ico { color: var(--pg-accent); }

/* «Visa»: the paper opened for this reviewer (data-opened, which «Godkänn» waits for) turns the eye into a check, in green
   (58% of the accent in the text: 72% read 4.2:1 on its own tint over the inner ground, flow admin-approvals-pills) */
.ap-view .ap-ico-done { display: none; }
.ap-view[data-opened="true"] .ap-ico-eye { display: none; }
.ap-view[data-opened="true"] .ap-ico-done { display: inline-block; }
.ap-card .ap-view[data-opened="true"] { color: var(--accent); color: color-mix(in srgb, var(--accent) 58%, var(--pg-text)); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- the buttons and fields of a card: large and clear ---- */
.ap-card .pg-btn { min-height: 44px; padding: 10px 20px; font-size: 15px; }
.ap-card .pg-btn.sm { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.ap-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-width: 0; }
.ap-actions select, .ap-actions .ap-in { max-width: 100%; min-width: 0; min-height: 42px; padding: 8px 12px; border-radius: var(--radius-md); border: 1px solid var(--pg-line-hi); background: var(--pg-field); color: var(--pg-text); font: inherit; font-size: 15px; }
.ap-actions select:focus, .ap-actions .ap-in:focus { outline: none; border-color: var(--pg-accent); box-shadow: 0 0 0 3px var(--primary-glow); }
/* a field's name beside it (the permit's number and last day), in the panel's label words, on the decision's row */
.ap-field { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; margin: 0; color: var(--pg-muted); font-size: 14px; font-weight: 700; }

/* the decision: «Godkänn» (with the permit for a taxi company) on one side, the reason and «Avslå» on the other */
.ap-decide { padding-top: 16px; border-top: 1px solid var(--pg-line); gap: 12px 16px; }
.ap-decide-ok, .ap-decide-no { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.ap-decide-no { margin-inline-start: auto; }
.ap-decide > [data-msg] { flex: 1 1 100%; }
.ap-actions > [data-msg]:empty { display: none; }
/* a card with nothing to decide (an approved one) keeps no empty row under it */
.ap-card > .ap-actions:not(.ap-decide):has(> [data-msg]:empty:only-child) { display: none; }

/* ---- the lines that say why: the open hint, what is missing, the refusal's reason, a reader's note ---- */
.ap-msg { font-size: 15px; line-height: 1.5; color: var(--pg-muted); overflow-wrap: anywhere; }
.ap-msg.err { color: var(--red); color: color-mix(in srgb, var(--red) 82%, var(--pg-text)); }
.ap-why { padding: 12px 14px; border-radius: var(--radius-md); font-size: 15px; line-height: 1.5; color: var(--pg-text); background: color-mix(in srgb, var(--red) 7%, transparent); border: 1px solid color-mix(in srgb, var(--red) 24%, transparent); overflow-wrap: anywhere; }
.ap-link { display: inline-flex; align-items: center; gap: 6px; color: var(--pg-accent); font-size: 15px; font-weight: 700; text-decoration: none; }
.ap-link:hover { text-decoration: underline; }
.ap-link:focus-visible { outline: 2px solid var(--pg-accent); outline-offset: 2px; border-radius: 4px; }

/* ---- «Från webbplatsen»: a lead's contact, shown only after «Visa kontaktuppgifter» (logged) ---- */
.ap-card [data-contact] { padding: 12px 14px; border-radius: var(--radius-md); background: var(--pg-inner); border: 1px solid var(--pg-line); color: var(--pg-text); }

@media (max-width: 640px) {
  .ap-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; border-radius: 24px; }
  .ap-tabs .pg-tab { padding: 8px 10px; line-height: 1.25; text-align: center; white-space: normal; }
  /* 18 px inside the card, so no field or button comes closer than that to its edge */
  .ap-card { padding: 18px; gap: 14px; }
  .ap-role { text-align: start; }
  .ap-doc { padding: 12px 14px; }
  .ap-doc > .ap-actions { width: 100%; margin-inline-start: 0; justify-content: flex-start; }
  .ap-doc > .ap-actions > select { flex: 1 1 160px; }
  /* a decision row on a phone: each field and button a line of its own, never two squeezed side by side */
  .ap-decide-ok, .ap-decide-no { flex: 1 1 100%; margin-inline-start: 0; }
  .ap-decide-ok > select, .ap-decide-ok > .pg-btn, .ap-decide-ok > .ap-field, .ap-decide-no > select, .ap-decide-no > .pg-btn, .ap-field .ap-in { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-card .pg-btn { transition: none; }
}
