:root {
  --ground: #F3F1EC; --ink: #1A1D21; --muted: #4A5059; --faint: #8A8F96; --line: #D6D2CA; --soft: #ECE9E3;
  --slate: #24323F; --teal: #0E6A6A; --teal-soft: #DDEDEB; --blue: #1A5FD6; --blue-soft: #E8F0FD;
  --extreme: #5F1414; --severe: #B23A0A; --high-bg: #FDE7C7; --high-fg: #6B3500; --high-bd: #E59A4B;
  --req: #9A3412; --white: #FFFFFF;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 28px; }
.top { background: var(--ink); color: var(--white); }
.top-inner { padding-top: 16px; padding-bottom: 16px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.brand { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #C9CDD3; }
h1 { margin: 2px 0; font-size: 24px; }
.sub { font-size: 14px; color: #E3E5E8; }
.who { display: flex; gap: 10px; align-items: center; font-size: 14px; color: #E3E5E8; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; }
.ghost-light { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #5B636D; background: transparent; color: var(--white); font-weight: 600; }
.primary { min-height: 44px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--slate); color: var(--white); font-weight: 700; }
.secondary { min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--slate); background: var(--white); color: var(--slate); font-weight: 600; }
.teal { min-height: 40px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--teal); color: var(--white); font-weight: 600; }
.plain { min-height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--faint); background: var(--white); color: var(--ink); font-weight: 600; }
button:disabled { background: #A9AEB5 !important; border-color: #A9AEB5 !important; color: var(--white) !important; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #3FA7A0; outline-offset: 2px; }

main.wrap { padding-top: 22px; padding-bottom: 40px; }
.banner { background: #FFF1E6; border: 1px solid var(--high-bd); color: #7C2D12; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.signin { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 28px; max-width: 520px; }
.signin h2 { margin: 0 0 6px; }
.signin p { margin: 0 0 16px; color: var(--muted); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 2px solid #C7C2B8; background: var(--white); color: var(--ink); font-weight: 600; }
.tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.tabs.small button { border-radius: 8px; border-width: 1px; min-height: 36px; font-size: 14px; }
.tabs.small button[aria-pressed="true"] { background: var(--slate); border-color: var(--slate); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.section-label { margin: 22px 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
button.tile { font: inherit; text-align: left; cursor: pointer; }
button.tile:hover { box-shadow: 0 0 0 2px rgba(36, 50, 63, .25); }
button.tile[aria-pressed="true"] { outline: 4px solid var(--slate); outline-offset: 2px; }
.table-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.small-btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
.tile { background: var(--white); border: 2px solid var(--line); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile .label { font-size: 14px; font-weight: 700; }
.tile .value { font: 700 32px/1.1 ui-monospace, Menlo, Consolas, monospace; }
.tile .note { font-size: 13px; }

.layout { display: flex; flex-wrap: wrap; gap: 22px; align-items: flex-start; margin-top: 22px; }
.main-col { flex: 999 1 720px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel.attention { border: 2px solid var(--severe); }
.panel-head { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.panel-head.column { flex-direction: column; align-items: stretch; }
.panel-title { font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.muted-light { color: #C9CDD3; }

.row-btn { width: 100%; border: 0; border-top: 1px solid var(--soft); background: var(--white); color: var(--ink); text-align: left; padding: 10px 18px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.row-btn.overdue { background: var(--blue-soft); }
.row-btn.selected { background: #E4DFD5; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; border: 2px solid transparent; white-space: nowrap; }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.p-Extreme { background: var(--extreme); color: #fff; border-color: var(--extreme); }
.p-Severe { background: var(--severe); color: #fff; border-color: var(--severe); }
.p-High { background: var(--high-bg); color: var(--high-fg); border-color: var(--high-bd); }
.p-Regular { background: var(--soft); color: #33383F; border-color: #B9B4AA; }
.p-None { background: #fff; color: var(--req); border-color: var(--req); }
.s-Received { background: var(--soft); color: var(--ink); border-color: var(--faint); }
.s-Under-review { background: var(--teal-soft); color: #0B4F4F; border-color: var(--teal); }
.s-In-progress { background: var(--teal); color: #fff; border-color: var(--teal); }
.s-Completed { background: #fff; color: #33383F; border-color: var(--faint); }
.f-overdue { background: var(--blue); color: #fff; border-color: var(--blue); }
.f-firstresp { background: #FFF1E6; color: #7C2D12; border-color: var(--high-bd); }
.f-stalled { background: var(--ground); color: var(--muted); border-color: #C7C2B8; }
.f-category { background: #FFF8E6; color: #6B4A00; border-color: #D9B34A; }
.f-confidential { background: #F1ECF7; color: #4B2A73; border-color: #9C84C2; }
.att-main { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.att-id { font-size: 13px; font-weight: 600; color: var(--muted); }
.att-title { font-weight: 600; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 16px 18px; color: var(--muted); }

.table-scroll { overflow-x: auto; }
.grid-table { min-width: 940px; }
.grid-row { display: grid; grid-template-columns: 138px 100px minmax(160px, 1fr) 112px 48px 74px 100px 122px; gap: 10px; padding: 10px 16px; align-items: center; }
.grid-row.head { background: #F7F5F1; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
button.grid-row { width: 100%; border: 0; border-top: 1px solid var(--soft); background: var(--white); text-align: left; color: var(--ink); font-size: 14px; }
button.grid-row.overdue { background: var(--blue-soft); }
button.grid-row.selected { background: #E4DFD5; }
.cell-stack { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.tiny { font-size: 11px; color: var(--muted); }
.overdue-text { color: var(--blue); font-weight: 700; }

.detail { flex: 1 1 400px; min-width: 0; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.detail h2 { margin: 0; font-size: 20px; line-height: 1.25; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.step-bar { height: 6px; border-radius: 3px; background: var(--line); }
.step-bar.on { background: var(--slate); }
.step-label { font-size: 12px; margin-top: 4px; color: var(--muted); }
.step-label.current { font-weight: 700; color: var(--ink); }
.box { background: #F7F5F1; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.box-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.box-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 700; }
.pre { white-space: pre-wrap; }
.editor { border: 2px solid var(--slate); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--white); }
.editor label { font-size: 13px; font-weight: 600; }
.editor input, .editor select, .editor textarea, .note-box textarea {
  width: 100%; min-height: 40px; border: 1px solid var(--faint); border-radius: 8px; padding: 6px 10px; font: inherit; background: var(--white);
}
.editor textarea, .note-box textarea { min-height: 64px; resize: vertical; }
.req { color: var(--req); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photos button { padding: 0; border: 1px solid #C7C2B8; border-radius: 8px; overflow: hidden; background: var(--soft); aspect-ratio: 4 / 3; cursor: zoom-in; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.log { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.log-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; }
.log-when { color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.warn { background: #FFF1E6; border: 1px solid var(--high-bd); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: #7C2D12; font-weight: 600; }

.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(15, 17, 20, .9); display: flex; align-items: center; justify-content: center; padding: 20px; }
.viewer[hidden] { display: none; }
.viewer-inner { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 10px; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #fff; font-weight: 700; }
.viewer img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 8px; background: #000; }
[hidden] { display: none !important; }
