/* KSA Brand Theme — shared Fieldline workspace, R06 */
:root {
  color-scheme: dark;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  color: #f4f3f0;
  background: #0c0d0e;
  font-synthesis: none;
  line-height: 1.55;
  --ksa-canvas: #0c0d0e;
  --ksa-text: #f4f3f0;
  --ksa-muted: #b8b4ad;
  --ksa-accent: #e10600;
  --ksa-border: #2d3033;
  --ksa-paper: #fff;
  --muted: var(--ksa-muted);
  --line: #3c4044;
  --accent: var(--ksa-accent);
  --dark: var(--ksa-text);
  --surface: #17191b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 80% 0, #24201d 0, transparent 48%), var(--ksa-canvas); }
#fieldline { max-width: 1480px; margin: 0 auto; padding: 0 clamp(1rem, 3.6vw, 3.5rem) 4rem; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.045em; }
h2 { font-size: 1.18rem; font-weight: 680; letter-spacing: -.018em; }
h3 { font-size: 1rem; }
p + p { margin-top: .65rem; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid #555a60; border-radius: .5rem; }
button, input, select { min-height: 2.8rem; }
button { cursor: pointer; padding: .6rem .95rem; color: var(--ksa-text); background: #24272a; font-weight: 600; font-size: .88rem; line-height: 1.3; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { background: #34383c; border-color: #8c9095; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #ffaaa0; outline-offset: 3px; }
input, select, textarea { min-width: 0; width: 100%; color: var(--ksa-text); background: #101214; padding: .65rem .75rem; font-size: .94rem; }
input::placeholder, textarea::placeholder { color: #a6a4a0; opacity: 1; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; min-height: 0; flex: none; accent-color: var(--accent); }
input[type="date"], input[type="time"], .metric strong { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; line-height: 1.55; }
a { color: #f4f3f0; text-underline-offset: .2em; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: #bc100b; border-color: #bc100b; }
.skip-link { position: fixed; left: 1rem; top: -6rem; z-index: 100; padding: .7rem 1rem; background: #fff; color: #111; border-radius: .4rem; }
.skip-link:focus { top: 1rem; }
.masthead, .toolbar, .day-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.masthead { padding: 1.1rem 0; min-height: 90px; }
.brand-lockup { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.ksa-mark { display: grid; place-items: center; flex: none; width: 54px; height: 48px; border: 1px solid var(--ksa-border); border-radius: .6rem; background: #141617; }
.ksa-mark img { display: block; width: 42px; height: 36px; object-fit: contain; }
.brand-copy strong, .brand-copy span { display: block; }
.brand-copy strong { font-size: .91rem; font-weight: 680; letter-spacing: -.015em; }
.brand-copy span { font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem; }
.member-copy { text-align: right; }
.member { font-size: .84rem; max-width: 24rem; overflow-wrap: anywhere; }
.member-role { color: var(--muted); font-size: .73rem; margin-top: .12rem; }
.member-actions button { min-height: 2.45rem; padding: .45rem .8rem; font-size: .8rem; }
.shared-label { border-right: 1px solid var(--line); padding-right: 1rem; color: #d6d2cb; font-size: .75rem; }
.shared-label::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin: 0 .5rem .1rem 0; background: #b8b4ad; }
.command-hero { position: relative; isolation: isolate; overflow: hidden; border: 1px solid #3b3b38; border-radius: 1rem; min-height: 292px; padding: clamp(1.6rem, 3.3vw, 3rem); display: flex; align-items: center; background: linear-gradient(90deg, #0c0d0ef5 0%, #0c0d0ed9 29%, #0c0d0e40 69%, #0c0d0e12), linear-gradient(0deg, #0c0d0e80, transparent 75%), url("fieldline-site-dawn.png") center 53% / cover, #17191b; }
.hero-copy { max-width: 38rem; }
.command-hero .hero-actions { position: absolute; right: 2rem; bottom: 2.5rem; }
.eyebrow { color: #d1ccc4; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; margin-bottom: .8rem; }
.hero-eyebrow { display: flex; align-items: center; gap: .65rem; }
.hero-eyebrow::before { content: ""; width: 26px; height: 3px; background: var(--accent); flex: none; }
.command-hero h1 { font-size: clamp(2.4rem, 4.1vw, 3.6rem); line-height: 1.04; letter-spacing: -.055em; font-weight: 720; }
.command-hero h1 span { display: block; }
.hero-description { max-width: 48ch; margin-top: .85rem; color: #dedbd5; font-size: .95rem; line-height: 1.6; }
.hero-actions { display: flex; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.hero-actions button { padding-inline: 1.15rem; }
.hero-caption { position: absolute; bottom: .7rem; right: 1rem; padding: .25rem .5rem; border-radius: .25rem; background: #0c0d0ede; color: #d0ccc4; font-size: .65rem; line-height: 1.4; }
.tabs { display: flex; gap: .35rem; overflow-x: auto; padding: 1.2rem 0 .9rem; border-bottom: 1px solid var(--ksa-border); margin-bottom: 1.25rem; }
.tabs button { position: relative; display: flex; align-items: center; justify-content: center; gap: .5rem; flex: 1 0 auto; min-height: 3rem; background: transparent; border-color: transparent; font-size: .87rem; white-space: nowrap; }
.tabs button:hover:not(:disabled) { background: #202325; border-color: #45494d; }
.tabs button[aria-current] { background: #292321; color: #fff; border-color: #74534e; }
.tabs button[aria-current]::after { content: ""; height: 2px; background: var(--accent); position: absolute; left: 1rem; right: 1rem; bottom: 0; }
.nav-number { font-size: .67rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.toolbar { margin: 0 0 1.5rem; padding: .15rem 0; }
.toolbar-actions, .date-control, .row-actions, .form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.date-control { padding: .3rem; border: 1px solid var(--line); border-radius: .7rem; background: #17191b; }
.date-control input { width: auto; min-width: 9.5rem; border-color: transparent; background: transparent; }
.date-control button { min-width: 2.6rem; border-color: transparent; background: transparent; }
.date-control button:hover:not(:disabled) { background: #303438; }
.toolbar-actions button { min-height: 2.7rem; background: #17191b; }
.content { display: grid; gap: 1.3rem; min-width: 0; }
.content > * { min-width: 0; }
.day-heading { padding: .1rem 0; }
.day-heading h2 { font-size: 1.35rem; }
.day-heading p { color: var(--muted); font-size: .83rem; }
.hint { color: var(--muted); margin-top: .55rem; font-size: .85rem; line-height: 1.65; max-width: 100ch; }
.empty { color: var(--muted); padding: 1.25rem 0 .4rem; font-size: .92rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric, .panel, .entry-screen { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; }
.metric { position: relative; padding: 1.2rem 1.3rem; overflow: hidden; background: linear-gradient(145deg, #242628, #17191b 75%); }
.metric::before { content: ""; position: absolute; top: 1.2rem; right: 1.25rem; width: 6px; height: 6px; background: #807b74; border-radius: 50%; }
.metric:first-child { border-color: #78514b; }
.metric:first-child::before { background: #ff665e; }
.metric strong { display: block; font-size: 2.4rem; font-weight: 650; line-height: 1.15; letter-spacing: -.045em; }
.metric span { display: block; margin-top: .55rem; color: #c4c0b8; font-size: .8rem; line-height: 1.4; }
.panel { padding: clamp(1rem, 2.25vw, 1.6rem); min-width: 0; }
.panel > h2 { padding-bottom: .15rem; }
.notice { margin: 0 0 1rem; padding: .85rem 1rem; border: 1px solid #6d7785; border-radius: .6rem; background: #202a34; color: #e9eff9; font-size: .92rem; overflow-wrap: anywhere; }
.notice[data-kind="error"], .auth-message[role="alert"], .auth-message[data-kind="error"] { color: #ffe0d9; border-color: #a7665c; background: #3c2421; }
.notice[data-kind="success"] { color: #d8f4e5; border-color: #5c9479; background: #1e3329; }
.entry-screen { max-width: 37rem; margin: clamp(2rem, 12vh, 9rem) auto; padding: clamp(1.5rem, 4vw, 2.5rem); }
.entry-screen p[role="status"] { margin: 1rem 0; color: var(--muted); }
.entry-screen a { display: inline-block; margin: .75rem 0 0 .75rem; }
.table-wrap { width: 100%; overflow: auto; overscroll-behavior-x: contain; margin-top: 1.1rem; border: 1px solid #3c4044; border-radius: .55rem; scrollbar-color: #666b70 #1a1d20; }
table { width: 100%; min-width: 650px; border-collapse: collapse; font-size: .86rem; text-align: left; }
th, td { min-width: 6.5rem; padding: .85rem .9rem; border-bottom: 1px solid #363a3e; vertical-align: top; line-height: 1.55; }
th { background: #24282b; color: #d7d3cd; font-size: .75rem; font-weight: 650; }
td { color: #ece9e3; overflow-wrap: anywhere; }
td:first-child { font-weight: 550; min-width: 9rem; }
tbody tr:nth-child(even) { background: #1c1f21; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #262a2d; }
.row-actions { flex-wrap: nowrap; }
.row-actions button { min-height: 2.2rem; padding: .35rem .65rem; font-size: .77rem; white-space: nowrap; }
.entry-form { margin-top: 1rem; }
.form-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1.1rem; align-items: start; }
.field { display: grid; gap: .4rem; align-content: start; min-width: 0; }
.field > span { color: #e4e0d9; font-weight: 600; font-size: .82rem; line-height: 1.5; }
.wide { grid-column: 1 / -1; }
fieldset { border: 1px solid #4a4f54; border-radius: .6rem; min-width: 0; padding: .9rem 1rem 1rem; }
legend { color: #e4e0d9; font-weight: 600; padding-inline: .35rem; font-size: .9rem; }
.filters { display: flex; flex-wrap: wrap; gap: .85rem; margin-bottom: .85rem; }
.filters .field { flex: 1 1 12rem; }
.form-actions { margin-top: 1.2rem; }
.worker-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: .55rem; max-height: 21rem; overflow-y: auto; margin-top: .85rem; padding: .15rem; }
.worker-option { display: grid; grid-template-columns: 1.2rem 1fr; gap: .15rem .6rem; align-items: center; padding: .65rem .7rem; border: 1px solid #4a4f54; border-radius: .5rem; cursor: pointer; background: #111315; }
.worker-option:hover { border-color: #8e928f; background: #25292b; }
.worker-option:has(input:checked) { border-color: #ffaaa0; background: #342321; }
.worker-option input { grid-row: 1 / 3; margin: 0; }
.worker-option span, .worker-option small { overflow-wrap: anywhere; }
.worker-option span { font-size: .88rem; }
.worker-option small { color: var(--muted); grid-column: 2; font-size: .76rem; }
.check-label { display: flex; align-items: center; gap: .65rem; min-height: 2.8rem; font-size: .88rem; }
#fieldline-editor, .booking-workspace { scroll-margin: 1.5rem; }
.cross-verification { margin-top: 1.2rem; }
.cross-verification .panel { background: #121416; border-color: #4b5055; }
.verification-facts { margin-top: .95rem; padding: .8rem .95rem; background: #272522; border-left: 3px solid #b8b4ad; color: #f4e9cf; font-size: .86rem; font-weight: 600; line-height: 1.6; }
.review-history { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .85rem; }
.review-history summary { font-weight: 600; font-size: .9rem; cursor: pointer; }
.credential-panel { border-color: #6a9c80; background: #192820; }
.access-code { display: block; margin-top: 1rem; padding: 1rem; border: 1px solid #6a9c80; border-radius: .5rem; background: #0e1913; color: #e2f9eb; font-size: 1.05rem; overflow-wrap: anywhere; user-select: all; }
.fieldline-unavailable { max-width: 40rem; margin: 15vh auto; padding: 2rem; }
.fieldline-unavailable p { margin-top: 1rem; }
.workspace-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--ksa-border); margin-top: 2rem; padding-top: 1rem; color: #aaa69f; font-size: .75rem; }
.fieldline-auth { position: relative; isolation: isolate; min-height: 100vh; min-height: 100svh; padding: clamp(1rem, 4vw, 4rem); display: grid; place-items: center; background: #0c0d0e; }
.fieldline-auth::before { content: ""; position: fixed; z-index: -1; inset: 0; background: linear-gradient(90deg, #0c0d0ed9 0%, #0c0d0e70 50%, #0c0d0ee0 100%), linear-gradient(0deg, #0c0d0e, transparent 70%), url("fieldline-site-dawn.png") center / cover; }
.auth-shell { width: min(1200px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 27rem); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.auth-intro { align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 2.5rem; min-height: 35rem; padding: 1rem 0 2rem; position: relative; }
.auth-intro .brand-lockup { margin-bottom: auto; }
.auth-intro .hero-copy { margin-bottom: auto; }
.auth-intro h2 { font-size: clamp(2.8rem, 5.5vw, 5rem); line-height: 1.03; letter-spacing: -.055em; font-weight: 720; }
.auth-intro h2 span { display: block; }
.auth-intro .hero-description { font-size: 1rem; max-width: 33ch; }
.auth-intro .hero-caption { right: auto; left: 0; bottom: 0; }
.auth-card { width: 100%; padding: clamp(1.4rem, 3vw, 2.1rem); background: #17191bf5; border: 1px solid #515153; border-radius: 1rem; box-shadow: 0 24px 70px #0005; }
.auth-card h1 { font-size: 1.8rem; letter-spacing: -.035em; line-height: 1.15; }
.auth-card > .eyebrow { color: #c4beb5; margin-bottom: .75rem; font-size: .68rem; }
.auth-card p { margin-top: .85rem; font-size: .86rem; line-height: 1.65; color: #c7c2bb; }
.auth-card h1 + p { margin-top: .65rem; }
.auth-card p[role="alert"] { color: #ffe0d9; }
.auth-form { display: grid; gap: 1.1rem; margin-top: 1.6rem; }
.auth-form label { display: grid; gap: .4rem; font-size: .86rem; font-weight: 600; }
.auth-form input { font-weight: 400; min-height: 3rem; }
.auth-form .primary { margin-top: .25rem; min-height: 3rem; }
.auth-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .6rem; }
.auth-actions button { flex: 1 1 auto; }
.auth-message { margin-top: 1rem; padding: .8rem .95rem; border: 1px solid #6d7785; border-radius: .5rem; background: #202a34; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .shared-label { display: none; }
  .auth-shell { gap: 2.5rem; grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); }
  .auth-intro h2 { font-size: 3rem; }
  .command-hero { min-height: 270px; background-position: center, center, 62% center; }
}
@media (max-width: 680px) {
  #fieldline { padding-inline: 1rem; }
  .masthead { gap: .8rem; padding-block: .9rem; }
  .brand-copy strong { font-size: .78rem; }
  .brand-copy span { font-size: .7rem; }
  .ksa-mark { width: 44px; height: 42px; }
  .ksa-mark img { width: 34px; height: 30px; }
  .member-actions { margin-left: auto; gap: .5rem; }
  .member { max-width: 11rem; font-size: .72rem; }
  .member-role { font-size: .67rem; }
  .member-actions button { min-height: 2.5rem; font-size: .73rem; }
  .command-hero { min-height: 280px; padding: 1.5rem 1.2rem 2.6rem; background-position: center, center, 62% center; }
  .command-hero h1 { font-size: clamp(2.25rem, 10vw, 3rem); }
  .command-hero .hero-actions { position: static; }
  .hero-description { max-width: 28ch; font-size: .86rem; }
  .hero-caption { left: 1rem; right: auto; font-size: .6rem; }
  .tabs { padding-top: 1rem; padding-bottom: .75rem; gap: .25rem; }
  .tabs button { flex: 0 0 auto; padding: .6rem .85rem; font-size: .8rem; min-height: 2.85rem; }
  .nav-number { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; gap: .85rem; margin-bottom: 1.2rem; }
  .date-control { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 2.4rem auto; gap: .2rem; }
  .date-control input { min-width: 0; width: 100%; padding-inline: .3rem; }
  .date-control button { min-width: 0; padding-inline: .4rem; }
  .toolbar-actions { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .4rem; }
  .toolbar-actions button:first-child { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .metric { padding: 1rem; }
  .metric strong { font-size: 2rem; }
  .metric span { font-size: .74rem; }
  .metric::before { top: 1rem; right: 1rem; }
  .day-heading { gap: .35rem; }
  .day-heading p { font-size: .74rem; }
  .form-fields { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .form-actions > button { flex: 1 1 auto; min-height: 2.85rem; }
  .content { gap: 1rem; }
  .hint { font-size: .81rem; }
  .panel { padding: 1.1rem; }
  .auth-shell { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; max-width: 29rem; }
  .auth-intro { min-height: 0; padding: 0; gap: 1.5rem; }
  .auth-intro h2 { font-size: 2.4rem; }
  .auth-intro .hero-description { font-size: .87rem; margin-top: .6rem; }
  .auth-intro .hero-caption { position: static; align-self: flex-start; font-size: .62rem; }
  .auth-intro .hero-copy { margin: 0; }
  .auth-intro .eyebrow { margin-bottom: .7rem; }
  .fieldline-auth { padding: 1.5rem 1rem 2rem; }
  .auth-card { padding: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  html:not([data-fieldline-print="ready"]) #fieldline { display: none; }
  :root { color-scheme: light; color: #111; background: #fff; --muted: #444; --line: #aaa; --dark: #111; --ksa-text: #111; }
  body, #fieldline { background: #fff; color: #111; }
  #fieldline { max-width: none; margin: 0; padding: 0; }
  .no-print, .skip-link, .command-hero, .workspace-footer, .fieldline-auth, .credential-panel, table:has(td .row-actions) th:last-child, table:has(td .row-actions) td:last-child { display: none !important; }
  .masthead { min-height: 0; padding: 0 0 1rem; }
  .brand-copy strong, .brand-copy span { color: #111; }
  .ksa-mark { background: #fff; border: 0; }
  .panel, .metric, .cross-verification .panel { background: #fff; border-color: #aaa; box-shadow: none; }
  .metric::before { display: none; }
  .metric, tr { break-inside: avoid; }
  .metric span, .hint, .day-heading p, th, td, .verification-facts { color: #111; }
  .table-wrap { overflow: visible; border: 0; }
  table { min-width: 0; font-size: .7rem; }
  th, td { min-width: 0; padding: .3rem .4rem; }
  td:first-child { min-width: 0; }
  th, tbody tr:nth-child(even), .verification-facts { background: #fff; }
}

/* Project demand and named subcontractor controls */
.required-work-editor { margin-top: .3rem; }
.work-items { display: grid; gap: .8rem; margin: 1rem 0; min-width: 0; }
.work-item-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(7rem, 1fr) minmax(5.5rem, .7fr) auto; align-items: end; gap: .7rem; padding: .9rem; border: 1px solid var(--line); border-radius: .5rem; background: #111315; min-width: 0; }
.work-item-row .field { min-width: 0; }
.work-item-remove { min-height: 2.8rem; font-size: .76rem; }
.work-add { margin-top: .2rem; }
.required-work-list { display: grid; gap: .7rem; min-width: 12rem; }
.required-work-list p { margin: 0; }
.required-work-list strong, .required-work-list span { display: block; }
.required-work-list strong { font-weight: 550; }
.required-work-list span { color: #c4c0b8; margin-top: .15rem; font-variant-numeric: tabular-nums; }
input[readonly] { color: #c6c1b8; background: #202326; }
@media (max-width: 850px) {
  .work-item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .work-item-row .field:first-child { grid-column: 1 / -1; }
  .work-item-remove { grid-column: 1 / -1; }
}
@media print {
  .work-item-row, input[readonly] { background: white; color: #111; }
  .required-work-list span { color: #333; }
}
