/* Portrait UI 2: the modern layer for Landscape (session UI, 16 Nov 2026).
 *
 * Ben, 16 Nov 2026: the estate looked dated; the target is a cutting-edge
 * large-corporate product (Octopus Energy, HSBC), and the secondary and hint
 * colours had to move on. Same palette and shapes as My Account's
 * portal_modern.css and Perspective's pos_modern.css.
 *
 * Colour, shape, type and motion only: no markup, wording or behaviour
 * changes, and the 3D viewer page keeps its own chrome. It loads straight
 * after app.css; removing the one <link> in base.html rolls it back.
 */
:root {
  --dark: #061726;
  --header: #071B2C;
  --surface: #10293F;
  --surface-alt: #0C2438;
  /* Fills are solid colours (17 Nov 2026). app.css defines --surface-2 and the four -bg tints as solid; the
     first version of this layer made them see-through washes, and a fill that is see-through shows whatever
     is behind it (found in Perspective, where a line showed through its markers). Each value is the old wash
     laid over --surface. Borders stay as washes: a border has nothing behind it. */
  --surface-2: #21384C;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #EEF4F8;
  --text-muted: #A9BDCF;
  --text-soft: #93A9BD;
  --link: #7CD0FF;
  --amber-soft: #FFC933;
  --amber-bg: #313E36;
  --danger: #FF8E8E;
  --danger-bg: #313245;
  --success: #5BE3A8;
  --success-bg: #14404A;
  --warn: #FFC933;
  --warn-bg: #313E36;
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 22px rgba(2, 10, 20, 0.24);
  --shadow-md: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(2, 10, 20, 0.28);
  --shadow-lg: 0 24px 64px rgba(2, 10, 20, 0.5);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-mono: var(--font-sans);
  --lsm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --lsm-soft: rgba(255, 255, 255, 0.07);
  --lsm-soft-hover: rgba(255, 255, 255, 0.12);
}

body { background: #071B2C; -webkit-font-smoothing: antialiased; }
body:not(.page-viewer) a { transition: color .15s var(--lsm-ease); }
::selection { background: rgba(255, 191, 0, 0.35); }

/* ---- top bar ----------------------------------------------------------------- */
.topbar { background: color-mix(in srgb, #071B2C 88%, transparent); -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid var(--border); box-shadow: none; }
.nav-link { border-radius: 999px; font-weight: 600; color: var(--text-muted); transition: background-color .12s var(--lsm-ease), color .12s var(--lsm-ease); }
.nav-link:hover { background: var(--lsm-soft); color: #fff; }
.nav-link.active { background: var(--amber); color: #081527; }

/* ---- type -------------------------------------------------------------------- */
body:not(.page-viewer) h1 { font-size: 2rem; line-height: 1.12; font-weight: 700; letter-spacing: -0.01em; }
body:not(.page-viewer) h2 { font-size: 1.3rem; font-weight: 700; }
body:not(.page-viewer) .page-header p.muted { font-size: 1.02rem; color: var(--text-muted); }
.breadcrumbs { font-size: 0.9rem; }

/* ---- cards, tiles and tables ---------------------------------------------------- */
body:not(.page-viewer) .card { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
body:not(.page-viewer) .card .card { box-shadow: none; background: var(--lsm-soft); border-radius: var(--radius); }
.stat-card { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.stat-label { font-size: 0.86rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
.stat-value { font-size: 2rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; }
.table thead th { font-size: 0.82rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-muted); background: transparent; border-bottom: 1px solid var(--border-strong); }
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr { transition: background-color .1s var(--lsm-ease); }
.table tbody tr:hover td { background: var(--lsm-soft); }
.empty { font-style: normal; background: var(--lsm-soft); border-radius: var(--radius); padding: 14px 16px; color: var(--text-muted); }

/* ---- buttons ------------------------------------------------------------------- */
body:not(.page-viewer) .btn { border-radius: 999px; font-weight: 700; padding-left: 18px; padding-right: 18px; transition: box-shadow .12s var(--lsm-ease), background-color .12s var(--lsm-ease), border-color .12s var(--lsm-ease); }
body:not(.page-viewer) .btn-primary:hover { background: #FFCC33; border-color: #FFCC33; box-shadow: 0 6px 16px rgba(255, 191, 0, 0.26); }
body:not(.page-viewer) .btn-primary:active { transform: none; box-shadow: none; }
body:not(.page-viewer) .btn-secondary { background: var(--lsm-soft-hover); border-color: transparent; color: #fff; font-weight: 600; }
body:not(.page-viewer) .btn-secondary:hover { background: rgba(255, 255, 255, 0.18); border-color: transparent; }
body:not(.page-viewer) .btn-ghost { background: var(--lsm-soft); border-color: transparent; font-weight: 600; }
body:not(.page-viewer) .btn-ghost:hover { background: var(--lsm-soft-hover); }
body:not(.page-viewer) .btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
body:not(.page-viewer) .btn-danger:hover { background: rgba(255, 107, 107, 0.26); color: var(--danger); }
body:not(.page-viewer) .btn-sm { padding-left: 14px; padding-right: 14px; }
body:not(.page-viewer) .btn:disabled { opacity: .45; transform: none; box-shadow: none; }

/* ---- fields -------------------------------------------------------------------- */
body:not(.page-viewer) input[type="text"], body:not(.page-viewer) input[type="email"], body:not(.page-viewer) input[type="password"],
body:not(.page-viewer) input[type="search"], body:not(.page-viewer) input[type="datetime-local"], body:not(.page-viewer) input[type="date"],
body:not(.page-viewer) input[type="number"], body:not(.page-viewer) input:not([type]), body:not(.page-viewer) textarea, body:not(.page-viewer) select {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-strong); border-radius: var(--radius); color: #fff;
  transition: border-color .12s var(--lsm-ease), box-shadow .12s var(--lsm-ease), background-color .12s var(--lsm-ease);
}
body:not(.page-viewer) input:hover, body:not(.page-viewer) textarea:hover, body:not(.page-viewer) select:hover { border-color: rgba(255, 255, 255, 0.3); }
body:not(.page-viewer) input:focus, body:not(.page-viewer) textarea:focus, body:not(.page-viewer) select:focus { outline: 0; border-color: var(--amber); box-shadow: 0 0 0 4px rgba(255, 191, 0, 0.22); }
body:not(.page-viewer) select option { background: #10293F; color: #fff; }

/* Drop-downs (Ben, 17 Nov 2026: "the drop down tabs look ugly ... any others that don't have styling").
   Desktop only: phones keep the system picker, which is the better control for a thumb. Where the browser can
   style the open list (appearance: base-select) the list is a rounded panel in the theme with a gold tick on the
   chosen row; elsewhere the closed control still gets the Portrait chevron. Sizes and padding are not touched. */
@media (min-width: 1024px) {
  @supports (appearance: base-select) {
    body select:not([multiple]):not([size]), body select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
    /* The chevron is a background on the control and the text clips at the content edge, so a control narrower
       than its chosen text keeps its chevron (18 Nov 2026; the icon used to be pushed out of view). */
    body select:not([multiple]):not([size]) { align-items: center; cursor: pointer; line-height: normal; white-space: nowrap; overflow: clip; overflow-clip-margin: content-box; padding-right: 32px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 4.3 6 8.1l3.8-3.8' fill='none' stroke='%237F93A6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 11px 11px !important; }
    body select:not([multiple]):not([size]):open { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 7.7 6 3.9l3.8 3.8' fill='none' stroke='%237F93A6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important; }
    body select:not([multiple]):not([size])::picker-icon { content: ""; flex: none; width: 0; height: calc(1lh + 2px); visibility: hidden; }
    body select:not([multiple]):not([size])::picker(select) { margin: 6px 0; padding: 6px; min-width: anchor-size(width); max-height: min(60vh, 420px); overflow-y: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 16px 40px rgba(2, 10, 20, .32); font: 500 14px/1.3 var(--font-sans); scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
    body select:not([multiple]):not([size]) option { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 12px; border-radius: 8px; color: var(--text); background: transparent; cursor: pointer; white-space: nowrap; }
    body select:not([multiple]):not([size]) option:hover, body select:not([multiple]):not([size]) option:focus-visible { background: var(--lsm-soft); color: #fff; outline: 0; }
    body select:not([multiple]):not([size]) option:checked { background: var(--lsm-soft-hover); color: #fff; font-weight: 600; }
    body select:not([multiple]):not([size]) option:disabled { color: var(--text-soft); cursor: default; background: transparent; }
    body select:not([multiple]):not([size]) option::checkmark { order: 1; margin-left: auto; padding-left: 12px; color: var(--amber); font-weight: 700; }
    body select:not([multiple]):not([size]) optgroup { padding: 6px 0 2px; font: 700 11px/1.3 var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--text-soft); }
    body select:not([multiple]):not([size]) optgroup option { font: 500 14px/1.3 var(--font-sans); letter-spacing: 0; text-transform: none; }
  }
  @supports not (appearance: base-select) {
    body select:not([multiple]):not([size]) { -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 32px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 4.3 6 8.1l3.8-3.8' fill='none' stroke='%237F93A6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 11px 11px !important; }
  }
}
::placeholder { color: var(--text-soft); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--amber); }
body:not(.page-viewer) input[type="file"] { background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-muted); }
body:not(.page-viewer) input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--lsm-soft-hover); color: #fff; font: 600 0.85rem var(--font-sans); cursor: pointer; }
.field > span { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ---- badges, pills and messages -------------------------------------------------- */
.badge, .pill { border: 0; border-radius: 999px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.badge { padding: 3px 10px; font-size: 0.78rem; }
.badge-ready, .badge-share-active { background: var(--success-bg); color: var(--success); }
.badge-processing, .badge-share-exhausted { background: var(--warn-bg); color: var(--warn); }
.badge-failed, .badge-share-revoked { background: var(--danger-bg); color: var(--danger); }
.badge-pending, .badge-muted, .badge-share-expired { background: var(--lsm-soft); color: var(--text-muted); }
.pill { background: var(--lsm-soft); color: var(--text); }
.pill.muted { color: var(--text-muted); }
.flash { border: 0; border-radius: var(--radius); font-weight: 500; }
.flash-info { background: rgba(92, 194, 255, 0.14); color: #7CD0FF; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  body:not(.page-viewer) .btn-primary:hover { transform: none; }
}

/* ---- Slim top menu (Ben, 17 Nov 2026: "the top menu items are very thick and each title should be one row
   only"). Below about 1100 wide "Survey forms" and "Audit log" broke onto two rows, so every pill grew to
   two lines high and the sign-out control was pushed off the bar. Titles never wrap now; the menu takes the
   room between the logo and the account chip and scrolls sideways inside itself when it runs out. ---------- */
.topbar-inner { gap: 16px; padding-top: 8px; padding-bottom: 8px; }
.brand { flex: 0 0 auto; }
.top-nav { flex: 1 1 auto; min-width: 0; gap: 2px; margin-left: 4px; overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.nav-link { flex: 0 0 auto; white-space: nowrap; padding: 6px 12px; font-size: 0.88rem; line-height: 1.3; }
.top-user { flex: 0 0 auto; }
/* Laptop and tablet widths: the signed-in email gives its room to the menu (the role label stays), and a
   fade on the right edge shows there is more menu to scroll to. Phones already do both (app.css, 700). */
@media (min-width: 700.02px) and (max-width: 1100px) {
  .top-user .user-chip-name { display: none; }
  .top-nav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 20px; }
}
@media (max-width: 1023.98px) {
  /* Touch widths keep a 44px target; the pill itself stays one line. */
  .top-nav .nav-link { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ---- Scroll bars as in Perspective (Ben, 17 Nov 2026; Perspective's are app/static/css/pos_scrollbars.css,
   10 Nov): thin, rounded, no arrow buttons, clear track. Landscape is navy throughout, so the thumb is amber,
   the same choice Perspective makes on its navy surfaces. The viewer side panel keeps its own narrower bar. */
@media screen {
  * { scrollbar-width: thin; scrollbar-color: rgba(255, 191, 0, .55) transparent; }
  ::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255, 191, 0, .55); border-radius: 8px; }
  ::-webkit-scrollbar-thumb:hover { background: #FFBF00; }
  ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  ::-webkit-scrollbar-corner { background: transparent; }
  .top-nav { scrollbar-width: none; }
}
