:root {
  --navy: #0b1f3a; --navy-2: #16345f; --yellow: #f5c518; --yellow-ink: #3a2d00;
  --l1: #1b8a3a; --l1-bg: #e5f6ea; --l2: #c27803; --l2-bg: #fff4dc; --l3: #c62828; --l3-bg: #fdecea;
  --red: #c62828; --red-bg: #fdecea; --ink: #152033; --muted: #5b6b80; --line: #d7dee8; --bg: #eef2f6; --card: #fff;
  --shadow: 0 8px 24px rgba(11,31,58,.08); --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; line-height: 1.45; min-height: 100vh; }
a { color: #154b9a; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, h4 { margin: 0 0 .4rem; line-height: 1.25; }
h4 { font-size: 13px; color: var(--muted); margin-top: 12px; }
.test-banner { background: repeating-linear-gradient(45deg, #f5c518, #f5c518 12px, #ffd84d 12px, #ffd84d 24px); color: #3a2d00; text-align: center; font-weight: 800; font-size: 12px; letter-spacing: .03em; padding: 4px 8px; position: sticky; top: 0; z-index: 2100; }
.app-header { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 12px 16px 10px; position: sticky; top: 24px; z-index: 2000; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.app-header .brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header .titles { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.app-header .titles small { display: block; color: #c9d6ea; font-size: 12px; }
.app-header h1 { font-size: 17px; font-weight: 700; margin: 0; }
.logo { background: var(--yellow); color: var(--navy); font-weight: 900; border-radius: 8px; padding: 6px 7px; font-size: 13px; letter-spacing: .03em; }
.hdr-right { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; font-size: 20px; text-decoration: none; padding: 4px 6px; }
.bell .count { position: absolute; top: -4px; right: -6px; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 1px 6px; }
.lang-toggle { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.lang-toggle button { background: transparent; color: #d5e0f2; border: 0; padding: 4px 10px; cursor: pointer; font-size: 12px; font-weight: 700; }
.lang-toggle button.on { background: var(--yellow); color: var(--navy); }
.lang-toggle.light { border-color: var(--line); }
.lang-toggle.light button { color: var(--navy); }
nav.tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; -webkit-overflow-scrolling: touch; }
nav.tabs a, nav.tabs button.linkish { color: #d5e0f2; text-decoration: none; background: transparent; border: 0; padding: 7px 12px; border-radius: 999px; white-space: nowrap; font-size: 14px; cursor: pointer; }
nav.tabs a.active, nav.tabs a:hover { background: rgba(245,197,24,.18); color: var(--yellow); }
.logout { color: #ffd0d0 !important; margin-left: auto; }
main { padding: 16px; max-width: 1240px; margin: 0 auto; }
.page-title { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-title p { margin: 0; color: var(--muted); font-size: 14px; }
.page-title h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid { display: grid; gap: 12px; align-content: start; }
.kpis { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 800px) { .kpis { grid-template-columns: repeat(3, 1fr); } .split { grid-template-columns: 1.3fr 1fr; } .two { grid-template-columns: 1fr 1fr; } .three { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border: 1px solid #edf1f6; }
.card h3 { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.section { margin-top: 14px; }
.kpi { text-decoration: none; color: inherit; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.kpi.alarm { border-left: 5px solid var(--red); } .kpi.alarm .value { color: var(--red); }
.kpi.warn { border-left: 5px solid var(--l2); } .kpi.warn .value { color: var(--l2); }
.kpi.okk .value { color: var(--l1); }
.banner { background: #fff6d6; border: 1px solid #efd56a; color: var(--yellow-ink); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.banner.danger { background: var(--red-bg); border-color: #f3b4b0; color: #7f1d1d; }
.banner.ok { background: var(--l1-bg); border-color: #b7e3c3; color: #14532d; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
tr.row { cursor: pointer; } tr.row:hover td { background: #f7fafc; }
table.live tr.lvrow1 td:first-child { border-left: 5px solid var(--l1); }
table.live tr.lvrow2 td:first-child { border-left: 5px solid var(--l2); }
table.live tr.lvrow3 td:first-child { border-left: 5px solid var(--l3); }
tr.flagged td { background: #fff7f7; }
tr.inactive td { opacity: .6; }
.lv { display: inline-block; min-width: 30px; text-align: center; padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 12px; color: #fff; }
.lv1 { background: var(--l1); } .lv2 { background: var(--l2); } .lv3 { background: var(--l3); }
.big-level { font-size: 20px; font-weight: 800; padding: 10px 12px; border-radius: 10px; margin: 6px 0 10px; }
.big-level.lv1 { background: var(--l1-bg); color: var(--l1); } .big-level.lv2 { background: var(--l2-bg); color: #8a5300; } .big-level.lv3 { background: var(--l3-bg); color: var(--l3); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; background: #e8eef6; color: #274066; }
.st-draft { background: #eef1f5; color: #475569; } .st-msra { background: #ede9fe; color: #5b21b6; } .st-level_set { background: #e0f2fe; color: #075985; }
.st-in_approval { background: #fef3c7; color: #92400e; } .st-approved { background: #dcfce7; color: #166534; } .st-in_progress { background: #dbeafe; color: #1e40af; }
.st-closed { background: #e5e7eb; color: #4b5563; } .st-stopped { background: var(--red); color: #fff; } .st-rejected { background: #fee2e2; color: #991b1b; }
.badge.em { background: #7f1d1d; color: #fff; } .badge.lib { background: #ecfeff; color: #155e75; }
.lib-proposed { background: #fef3c7; color: #92400e; } .lib-accepted { background: #dcfce7; color: #166534; } .lib-rejected { background: #fee2e2; color: #991b1b; } .lib-returned { background: #ede9fe; color: #5b21b6; } .lib-superseded { background: #e5e7eb; color: #4b5563; }
.flag { display: inline-block; color: var(--red); background: var(--red-bg); border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 700; margin: 2px 2px 0 0; }
.red { color: var(--red); font-weight: 700; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--navy); color: #fff; font-weight: 650; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #e6edf6; color: var(--navy); } .btn.yellow { background: var(--yellow); color: var(--yellow-ink); }
.btn.danger { background: var(--red); color: #fff; } .btn.success { background: var(--l1); } .btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn.sm { padding: 4px 8px; font-size: 12px; border-radius: 8px; } .btn.big { font-size: 18px; padding: 14px 22px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; } .btn-row:empty { display: none; }
.btn.block { width: 100%; }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
label { display: block; font-size: 13px; color: var(--muted); font-weight: 650; margin-bottom: 4px; }
label.chk { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); font-weight: 500; font-size: 14px; padding: 6px 0; }
label.chk input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
label.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=file], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; }
textarea { min-height: 84px; resize: vertical; }
.help { color: var(--muted); font-size: 12px; margin: 4px 0; } .error { color: var(--red); font-size: 14px; margin: 6px 0; }
.small { font-size: 12px; } .muted { color: var(--muted); } .right { text-align: right; } .mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.indent { margin-left: 26px; }
.trig { border-bottom: 1px dashed #edf1f6; } .trig3 input { accent-color: var(--l3); } .trig2 input { accent-color: var(--l2); } .trig:has(input:checked) { background: #fff7f0; font-weight: 650; }
.lvh3 { color: var(--l3); } .lvh2 { color: #8a5300; }
.em-toggle { background: #fff1f1; border-radius: 10px; padding: 8px 10px !important; }
table.haz input, table.haz select { padding: 6px 8px; } table.haz td { padding: 5px 4px; }
.score { padding: 2px 8px; border-radius: 6px; } .score.s1 { background: var(--l1-bg); color: var(--l1); } .score.s2 { background: var(--l2-bg); color: #8a5300; } .score.s3 { background: var(--l3-bg); color: var(--l3); }
.sticky { position: sticky; top: 140px; align-self: start; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.meta dt { color: var(--muted); font-size: 12px; padding-top: 2px; } .meta dd { margin: 0; font-weight: 600; }
.tight { margin: 4px 0; padding-left: 18px; } .tight li { margin: 3px 0; }
.empty { color: var(--muted); padding: 20px 8px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input, .toolbar select { min-width: 130px; flex: 1; width: auto; }
.filters { margin-bottom: 12px; padding: 10px 12px; }
.history { list-style: none; padding: 0; margin: 0; } .history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history time { color: var(--muted); font-size: 12px; display: block; } .history.audit { max-height: 420px; overflow: auto; }
.chain { list-style: none; padding: 0; margin: 0; }
.chain .step { display: flex; gap: 10px; padding: 8px 0; position: relative; }
.chain .step:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 40px; bottom: -6px; width: 2px; background: var(--line); }
.chain .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #eef1f5; color: var(--muted); flex: none; }
.chain .approved .dot { background: var(--l1); color: #fff; } .chain .current .dot { background: var(--yellow); color: var(--navy); box-shadow: 0 0 0 4px rgba(245,197,24,.3); } .chain .rejected .dot { background: var(--red); color: #fff; }
.plist { list-style: none; padding: 0; margin: 0; } .plist li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.pdot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef1f5; flex: none; font-weight: 800; } .plist li.ok .pdot { background: var(--l1); color: #fff; }
.docs { list-style: none; padding: 0; margin: 0 0 10px; } .docs li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.upload { border-top: 1px dashed var(--line); padding-top: 10px; }
.actions-card { margin-bottom: 12px; border-left: 5px solid var(--yellow); }
.seg { display: inline-flex; background: #e6edf6; border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--navy); font-weight: 650; text-decoration: none; font-size: 14px; }
.seg .on { background: var(--navy); color: #fff; }
.bars .bar-row { display: grid; grid-template-columns: 140px 1fr 34px; gap: 8px; align-items: center; font-size: 13px; margin: 5px 0; }
.bars .bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .bars .bt { background: #eef1f5; border-radius: 6px; height: 14px; overflow: hidden; }
.bars i { display: block; height: 100%; background: var(--navy-2); border-radius: 6px; } .bars i.lv1 { background: var(--l1); } .bars i.lv2 { background: var(--l2); } .bars i.lv3 { background: var(--l3); } .bars i.st-stopped { background: var(--red); }
.bars b { text-align: right; }
.notifs { list-style: none; padding: 0; margin: 0; } .notifs li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.notifs li.unread { background: #fffbea; font-weight: 650; } .notifs li.nk-stopped a, .notifs li.nk-escalation a, .notifs li.nk-emergency_late a { color: var(--red); }
.notifs time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.modal-back { position: fixed; inset: 0; background: rgba(11,31,58,.45); display: grid; place-items: center; z-index: 3000; padding: 16px; }
.modal { width: min(480px, 100%); max-height: 90vh; overflow: auto; } .modal .mf { margin: 10px 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 4000; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--red); }
.login-wrap { min-height: calc(100vh - 24px); display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 20% -10%, #1d4e89, var(--navy)); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 26px 22px; box-shadow: var(--shadow); }
.login-card .mark { width: 52px; height: 52px; border-radius: 12px; background: var(--navy); color: var(--yellow); display: grid; place-items: center; font-weight: 900; font-size: 17px; margin-bottom: 12px; }
.login-card h1 { font-size: 22px; } .login-card p.lead { color: var(--muted); margin: 0 0 16px; }
/* org chart */
.orgchart { display: flex; flex-direction: column; align-items: center; gap: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 12px; }
.org-viewers { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.onode { width: min(360px, 100%); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; display: grid; gap: 4px; }
.onode small { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.onode.viewer { width: auto; min-width: 200px; background: #f5f8fc; border-style: dashed; }
.role-site_manager { border-color: #7c3aed; } .role-manager { border-color: #1e40af; } .role-hse { border-color: var(--l1); } .role-engineer { border-color: var(--l2); } .role-supervisor { border-color: var(--navy); }
.olink { color: var(--line); font-size: 20px; line-height: 1; }
/* mobile cards */
.cards.mob { display: none; } .icard { display: block; background: #fff; border-radius: 12px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); color: inherit; text-decoration: none; border-left: 6px solid var(--line); }
.icard.lvcard1 { border-left-color: var(--l1); } .icard.lvcard2 { border-left-color: var(--l2); } .icard.lvcard3 { border-left-color: var(--l3); } .icard.flagged { background: #fff7f7; }
.icard-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .icard-desc { margin: 6px 0 4px; }
@media (max-width: 760px) {
  .desk { display: none; } .cards.mob { display: block; }
  .app-header h1 { font-size: 15px; } .app-header .titles small { display: none; }
  .toolbar input, .toolbar select { min-width: 46%; }
  .sticky { position: static; }
  .bars .bar-row { grid-template-columns: 100px 1fr 30px; }
}
.onode .toolbar select { min-width: 0; width: 100%; } .onode .toolbar { width: 100%; }
