/* wrkflow.pro — dark UI, tuned to the hero image (deep navy night, amber sunset) */

:root {
  --bg:        #0a0f1a;
  --bg-raise:  #111827;
  --bg-card:   #141c2b;
  --border:    #24304a;
  --border-lt: #2f3d5c;
  --text:      #e8edf7;
  --text-dim:  #93a1bd;
  --text-mute: #64748b;
  --accent:    #6366f1;
  --accent-lt: #818cf8;
  --focus:     rgba(99, 102, 241, .22);
  --amber:     #f59e0b;
  --danger:    #ef4444;
  --ok:        #22c55e;
  --radius:    14px;
  --shadow:    0 18px 40px rgba(0, 0, 0, .45);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-lt); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.02em; }

.wrap { width: min(1140px, 92vw); margin-inline: auto; }

/* --- Brand ------------------------------------------------------------- */
.brand { font-size: 1.35rem; font-weight: 700; letter-spacing: -.03em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent-lt); }

/* --- Top bar ----------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 15, 26, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap { display: flex; align-items: center; gap: 1.25rem; height: 66px; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.topbar nav a { color: var(--text-dim); font-size: .93rem; }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.whoami { color: var(--text-mute); font-size: .87rem; }

@media (max-width: 560px) {
  .topbar .wrap { gap: .6rem; }
  .topbar nav { gap: .75rem; }
  .topbar nav a { font-size: .86rem; }
  .whoami { display: none; }          /* name is redundant next to Sign out */
  .brand { font-size: 1.15rem; }
}

/* --- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .68rem 1.25rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; transition: .15s ease;
}
.btn:hover { background: var(--accent-lt); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border-lt); color: var(--text); }
.btn-ghost:hover { background: var(--bg-raise); border-color: var(--accent); }
.btn-danger { background: transparent; border-color: #5b2626; color: #fca5a5; }
.btn-danger:hover { background: #3b1717; }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }

/* --- Hero -------------------------------------------------------------- */
/* The photograph already carries the wordmark on the laptop screen, so the
   overlay copy is pinned to the left over the sky and kept clear of centre. */
.hero {
  position: relative; min-height: min(86vh, 760px); display: grid; align-items: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 18% 82%, rgba(245, 158, 11, .22), transparent 62%),
    radial-gradient(900px 520px at 82% 22%, rgba(99, 102, 241, .20), transparent 60%),
    linear-gradient(180deg, #0d1424 0%, #0a0f1a 100%);
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 40%; opacity: .92;
}
/* Sits over the still image, which stays as the fallback underneath */
.hero-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 40%;
  pointer-events: none;
}

/* The clip runs sunrise-to-night, so the left scrim has to hold up against the
   brightest moment of the cycle, not the average. Heavier than the still-image
   version deliberately. */
.hero.has-video::after {
  background:
    linear-gradient(90deg, rgba(6, 10, 18, .94) 0%, rgba(6, 10, 18, .86) 30%, rgba(6, 10, 18, .45) 55%, rgba(6, 10, 18, .12) 72%, transparent 86%),
    linear-gradient(180deg, rgba(6, 10, 18, .62) 0%, transparent 30%, transparent 68%, var(--bg) 100%);
}

/* Data-hungry and badly cropped on phones — still image only */
@media (max-width: 720px) {
  .hero-video { display: none; }
}

/* Respect an explicit request for less motion */
@media (prefers-reduced-motion: reduce) {
  .hero-video { display: none; }
}

/* Scrim: darkens the left third for legible text, fades the bottom into the page */
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(6, 10, 18, .90) 0%, rgba(6, 10, 18, .72) 34%, rgba(6, 10, 18, .10) 62%, transparent 78%),
    linear-gradient(180deg, rgba(6, 10, 18, .55) 0%, transparent 28%, transparent 72%, var(--bg) 100%);
}
.hero-inner { position: relative; z-index: 2; padding: 4rem 0; }
.hero-copy { max-width: min(33rem, 46%); }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); margin-bottom: .6rem; text-wrap: balance; }
.hero .tagline { font-size: clamp(1rem, 1.6vw, 1.18rem); color: var(--text-dim); margin-bottom: 2rem; }
.hero-cta { display: flex; gap: .85rem; flex-wrap: wrap; }

/* Narrow screens: the laptop dominates the crop, so go back to a flat scrim */
@media (max-width: 720px) {
  .hero { min-height: 74vh; }
  .hero-img { opacity: .42; object-position: center 45%; }
  .hero::after {
    background: linear-gradient(180deg, rgba(6, 10, 18, .6) 0%, rgba(6, 10, 18, .35) 45%, var(--bg) 100%);
  }
  .hero-copy { max-width: none; }
}

.eyebrow {
  display: inline-block; margin-bottom: 1.1rem; padding: .3rem .85rem;
  border: 1px solid var(--border-lt); border-radius: 999px;
  font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--amber);
}

/* --- Sections ---------------------------------------------------------- */
.section { padding: 4.5rem 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 3rem; }
.section-head p { color: var(--text-dim); }

.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.6rem;
}
.card h3 { font-size: 1.12rem; }
.card p { color: var(--text-dim); margin: 0; font-size: .95rem; }
.card .glyph { font-size: 1.6rem; display: block; margin-bottom: .75rem; }

/* --- Site picker grid -------------------------------------------------- */
.site-tile {
  position: relative; display: block; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem;
  color: var(--text); transition: .18s ease;
}
.site-tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--tile-accent, var(--accent));
}
.site-tile:hover {
  text-decoration: none; transform: translateY(-3px);
  border-color: var(--border-lt); box-shadow: var(--shadow);
}
.site-tile .glyph { font-size: 2rem; display: block; margin-bottom: .9rem; }
.site-tile h3 { margin-bottom: .3rem; font-size: 1.2rem; }
.site-tile p { color: var(--text-dim); font-size: .92rem; margin: 0; }
.site-tile .enter { margin-top: 1.1rem; font-size: .87rem; font-weight: 600; color: var(--tile-accent, var(--accent-lt)); }
/* A dark brand colour (DSV navy) is unreadable as text on the dark card, so
   lighten whatever the tile's accent is. Falls back to the line above. */
@supports (color: color-mix(in srgb, red 50%, white)) {
  .site-tile .enter { color: color-mix(in srgb, var(--tile-accent, var(--accent-lt)) 55%, #cfe0ff); }
}

/* --- Auth page --------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-visual {
  position: relative; overflow: hidden; display: grid; align-items: end;
  background:
    radial-gradient(900px 500px at 25% 85%, rgba(245, 158, 11, .28), transparent 60%),
    linear-gradient(160deg, #0e1626, #0a0f1a);
}
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 45%; opacity: .9; }
.auth-visual::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 10, 18, .30) 0%, transparent 34%, rgba(6, 10, 18, .55) 74%, rgba(6, 10, 18, .80) 100%);
}
.auth-visual .blurb { position: relative; z-index: 2; padding: 3rem; }
.auth-visual .blurb h2 { font-size: 1.9rem; }
.auth-visual .blurb p { color: var(--text-dim); max-width: 42ch; margin: 0; }

.auth-panel { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-box { width: min(400px, 100%); }
.auth-box h1 { font-size: 1.75rem; margin-bottom: .25rem; }
.auth-box .sub { color: var(--text-dim); margin-bottom: 2rem; font-size: .95rem; }

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

/* --- Forms ------------------------------------------------------------- */
.field { margin-bottom: 1.15rem; }
.field label { display: block; margin-bottom: .4rem; font-size: .88rem; font-weight: 600; color: var(--text-dim); }
.field input[type=text], .field input[type=email], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: .72rem .9rem; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--bg-raise);
  border: 1px solid var(--border-lt); border-radius: 10px; outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus);
}
.field .hint { font-size: .8rem; color: var(--text-mute); margin-top: .35rem; }

.check { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .85rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-raise); cursor: pointer; }
.check:hover { border-color: var(--border-lt); }
.check input { margin-top: .3rem; accent-color: var(--accent); width: 16px; height: 16px; }
.check strong { display: block; font-size: .95rem; font-weight: 600; }
.check span { font-size: .84rem; color: var(--text-mute); }

/* --- Alerts ------------------------------------------------------------ */
.alert { padding: .8rem 1rem; border-radius: 10px; font-size: .92rem; margin-bottom: 1.25rem; border: 1px solid; }
.alert-error { background: #2a1212; border-color: #5b2626; color: #fca5a5; }
.alert-ok    { background: #10241a; border-color: #1f4d35; color: #86efac; }
.alert-info  { background: #111a2e; border-color: #26375c; color: #bfdbfe; }

/* --- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-raise); color: var(--text-dim); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(99, 102, 241, .05); }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.pill-ok    { background: rgba(34, 197, 94, .14);  color: #86efac; }
.pill-off   { background: rgba(239, 68, 68, .14);  color: #fca5a5; }
.pill-admin { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.pill-mute  { background: rgba(148, 163, 184, .14); color: var(--text-dim); }

/* --- Page header ------------------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.page-head h1 { margin: 0; font-size: 1.75rem; }
.page-head .spacer { margin-left: auto; }
.page-head p { width: 100%; margin: .2rem 0 0; color: var(--text-dim); }

.page { padding: 2.5rem 0 4rem; }

.empty { text-align: center; padding: 3.5rem 1rem; border: 1px dashed var(--border-lt); border-radius: var(--radius); color: var(--text-dim); }

/* Small form furniture, so pages stop hand-rolling it inline. Tokens only —
   anything hardcoded here has to be unpicked again for the light theme. */
.form-lead  { margin: 0 0 1.25rem; font-size: .9rem; color: var(--text-dim); }
.field-hint { margin: .4rem 0 0; font-size: .8rem; color: var(--text-mute); }
.form-foot  { margin: 1.4rem 0 0; text-align: center; font-size: .9rem; color: var(--text-dim); }

/* --- DSV brand scope ----------------------------------------------------
   Applied to the ULD Build workspace only. Redefining the tokens on a wrapper
   re-colours every descendant — buttons, labels, borders, focus rings — without
   touching the rest of wrkflow.pro. --accent-lt is a lightened DSV blue, since
   #0b2967 on the near-black page background is too dark to read as text.       */
.brand-dsv {
  --accent:    #0b2967;
  --accent-lt: #5b8def;
  --focus:     rgba(91, 141, 239, .28);
}
.brand-dsv .btn { background: var(--accent); border-color: #163a86; }
.brand-dsv .btn:hover { background: #163a86; }
.brand-dsv .btn-ghost { background: transparent; border-color: var(--border-lt); }
.brand-dsv .btn-ghost:hover { background: var(--bg-raise); border-color: var(--accent-lt); }

/* --- PMC Build workspace ------------------------------------------------ */
.uld-card { margin-bottom: 1.25rem; padding: 1.4rem 1.5rem; }
.uld-legend {
  margin: 0 0 1.1rem; font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent-lt);
}
.uld-card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.uld-card-head .uld-legend { margin: 0; }
.uld-card-head .btn { margin-left: auto; }

.uld-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .75rem; }
.uld-row .field { margin: 0; }
.uld-row > input {
  width: 100%; padding: .72rem .9rem; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--bg-raise);
  border: 1px solid var(--border-lt); border-radius: 10px; outline: none;
}
.uld-row > input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

.hawb {
  border: 1px solid var(--border); border-left: 3px solid var(--accent-lt);
  border-radius: 10px; padding: .9rem 1rem; margin-bottom: .75rem;
  background: rgba(99, 102, 241, .05);
}
.hawb-head { display: flex; align-items: center; margin-bottom: .6rem; }
.hawb-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); }
.hawb-remove {
  margin-left: auto; width: 26px; height: 26px; line-height: 1; font-size: 1.1rem;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--text-mute);
  border: 1px solid var(--border-lt); border-radius: 7px;
}
.hawb-remove:hover { color: #fca5a5; border-color: #5b2626; background: #2a1212; }

.uld-totals {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: .88rem; color: var(--text-dim);
}
.uld-totals strong { font-size: 1.15rem; color: var(--text); font-variant-numeric: tabular-nums; }

.uld-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.uld-hint { margin-top: .9rem; font-size: .85rem; color: var(--text-mute); }

.uld-detail { margin: .5rem 0 0; font-size: .9rem; color: var(--text-dim); }
.uld-detail td, .uld-detail th { white-space: normal; }

/* --- Castle Inn preview list -------------------------------------------- */
.pbz-item-list { display: flex; flex-direction: column; gap: .75rem; }
.pbz-item-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  transition: .15s ease;
}
.pbz-item-row:hover { border-color: var(--accent-lt); transform: translateY(-1px); }
.pbz-item-top { display: flex; align-items: center; gap: 1rem; }
.pbz-castleinn-num {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  background: #7C8A6B; color: #1a2113;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .95rem;
}
.pbz-item-main { flex: 1; min-width: 0; }
.pbz-c-name { font-weight: 600; color: var(--text); }

/* A HAWB split across several ULDs is normal, so this informs rather than
   warns — amber, not red, and it never blocks submission. */
.uld-row > input.is-dup,
input.is-dup { border-color: var(--amber); }
.uld-dup { color: var(--amber); }

/* The ULD block: number, type and subtype sit on one row, but the subtype
   labels are long, so give it more room than the HAWB rows get. */
.uld-row-unit { grid-template-columns: 1fr 1fr 1.4fr; }
.uld-row-unit select,
.uld-row-unit input {
  width: 100%; padding: .72rem .9rem; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--bg-raise);
  border: 1px solid var(--border-lt); border-radius: 10px; outline: none;
}
.uld-row-unit select:focus,
.uld-row-unit input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }

@media (max-width: 720px) {
  .uld-row, .uld-row-unit { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .uld-row { grid-template-columns: 1fr; }
  .uld-actions .btn { flex: 1 1 100%; }
}

/* --- Footer ------------------------------------------------------------ */
.footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--text-mute); font-size: .87rem; }
.footer .wrap { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer .spacer { margin-left: auto; }
