:root {
  --bg: #f9fafb; --panel: #fff; --text: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --brand: #0a4076; --accent: #0a4076; --ok: #15803d; --okbg: #dcfce7; --warn: #c2410c; --warnbg: #ffedd5;
  --bad: #dc2626; --badbg: #fee2e2; --info: #dbeafe; --grey: #f1f5f9; --navy: #0f2140;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 Inter, system-ui, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
button { font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; padding: 7px 14px; transition: background .15s, box-shadow .15s; }
button:hover:not(:disabled) { background: #08335e; box-shadow: 0 2px 6px rgba(10,64,118,.25); }
button.secondary { background: #fff; color: var(--accent); border-width: 1.5px; }
button.secondary:hover:not(:disabled) { background: #eef4fb; }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--badbg); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,64,118,.12); }
a { color: var(--accent); }
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.side { background: #fff; box-shadow: 0 4px 10px #0000000d; padding: 21px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 2; }
.side .logo { display: block; padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.side .logo img { height: 43px; display: block; }
.side a { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; margin-bottom: 7px; border-radius: 8px; border: 1px solid transparent;
  color: #1e293b; font-weight: 500; text-decoration: none; white-space: nowrap; }
.side a i { width: 20px; text-align: center; font-size: 17px; }
.side a { transition: background .15s, color .15s; }
.side a:not(.on):not(.off):hover { background: #ee9d2b; color: #fff; border-color: #ee9d2b; }   /* като в демото: --secondary-color */
html[data-theme="dark"] .side a:not(.on):not(.off):hover { background: #fbbf24; color: #0f172a; border-color: #fbbf24; }
.side a.on { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 8px rgba(10,64,118,.25); }
.side a.off { color: #a0aec0; cursor: default; }
.side a.off:hover { background: none; }
.side a.off small { margin-left: auto; font-size: 10px; font-weight: 500; color: #a0aec0; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0 6px; }
.side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 14px 14px 6px; border-top: 1px solid var(--line); margin-top: 10px; }
.body { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 70px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.05); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; gap: 12px; position: sticky; top: 0; z-index: 1; }
.topbar .co { font-size: 15px; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .who { text-align: right; line-height: 1.25; }
.topbar .who b { display: block; font-weight: 600; color: var(--text); font-size: 13px; }
.topbar .who span { font-size: 12px; color: var(--muted); }
a.btn-out { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--brand); color: var(--brand); border-radius: 4px; padding: 7px 14px; font-weight: 500; text-decoration: none; }
a.btn-out:hover { background: #eef4fb; }
.main { padding: 21px; min-width: 0; }
.page { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 28px 16px 20px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 30px; line-height: 1.2; margin: 0; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.who { color: var(--muted); font-size: 13px; }
.banner { background: var(--warnbg); border: 1px solid #fdba74; color: #7c2d12; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { font-size: 18px; margin: 0 0 4px; color: var(--text); font-weight: 600; }
.card .meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.periods { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.period { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.period.overdue { border-color: var(--bad); background: var(--badbg); }
.period h3 { margin: 0 0 4px; font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 12px; background: var(--grey); color: var(--muted); white-space: nowrap; }
.tag.s0 { background: var(--warnbg); color: var(--warn); }
.tag.s1 { background: var(--info); color: var(--accent); }
.tag.s2 { background: var(--okbg); color: var(--ok); }
.tag.bad { background: var(--badbg); color: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 10px; text-align: left; vertical-align: top; }
tbody tr:nth-child(even) td, table tr:nth-child(even) > td { background: #f8fafc; }
th { background: #fff; color: #475569; font-size: 12px; font-weight: 600; white-space: nowrap; border-bottom: 2px solid var(--line); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll { overflow-x: auto; }
.corr { color: var(--warn); font-size: 12px; }
.muted { color: var(--muted); }
.err { background: var(--badbg); color: #991b1b; border: 1px solid #fca5a5; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.ok { background: var(--okbg); color: #166534; border: 1px solid #86efac; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
.login { max-width: 420px; margin: 10vh auto; }
.login .card { padding: 22px; }
.mail { border-left: 3px solid var(--accent); padding: 6px 10px; margin-bottom: 8px; background: #f8fafc; border-radius: 0 6px 6px 0; }
pre.mailbody { white-space: pre-wrap; font: inherit; background: #f8fafc; border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 0 6px 6px 0; margin-top: 12px; }
.mail pre { white-space: pre-wrap; margin: 4px 0 0; font: inherit; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
td.green, .green input, .green select { background: #eef8ee; }
.tabs { display: flex; gap: 4px; margin-bottom: 21px; flex-wrap: wrap; background: #e2e8f0; border-radius: 8px; padding: 6px; }
.tabs a { flex: 1; text-align: center; padding: 8px 14px; border-radius: 6px; color: #64748b; text-decoration: none; font-size: 15px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tabs a.off { color: #9aa5b1; pointer-events: none; }
.doc-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px; }
tr.row-warn td, .card.row-warn { background: #fff8e1; }
tr.row-bad td, .card.row-bad { background: var(--badbg); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.h3 { font-size: 14px; margin: 4px 0; }
table.report th, table.report td { border: 1px solid var(--line); }
table.report th { background: #f8fafc; }
tr.sub td { background: #f6f8fb; }
table.dochead td.lbl, table.report td.lbl { color: var(--muted); width: 18%; background: #f6f8fb; }
th.doctitle { text-align: center; font-size: 16px; color: var(--brand); background: #fff; padding: 10px; }
table.signs { margin-top: 14px; } table.signs td.sign { height: 46px; vertical-align: bottom; color: var(--muted); }
table.report { margin-top: 6px; }
.doc.wide table.report td, .doc.wide table.report th { padding: 3px 5px; vertical-align: top; }
@media print { .doc.wide table { font-size: 9.5px; } .doc.wide table.report tr { page-break-inside: avoid; } }
@media print { .side, .topbar, .noprint, .top, .ok, .err, .tabs, .banner { display: none !important; } .layout { display: block; } .main { padding: 0; } .page, .card { border: 0; padding: 0; } tr:nth-child(even) > td { background: none !important; } .scroll { overflow: visible; } table { font-size: 11px; } th, td { border: 1px solid #999 !important; } }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 4px; }
  .side .logo { width: 100%; margin-bottom: 6px; }
  .side a { height: 34px; margin: 0; padding: 0 10px; }
  .side a.off, .side .grp { display: none; }
  .topbar { position: static; height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .main { padding: 12px 16px 30px; }
  .page { padding: 18px 12px; }
  .top h1 { font-size: 24px; }
  .tabs a { flex: none; }
  .grid2 { grid-template-columns: 1fr; }
}

/* вход – като демото */
.lg { display: grid; grid-template-columns: 518px 1fr; min-height: 100vh; background: var(--navy); color: #e2e8f0; }
.lg-l { padding: 28px 56px 32px; display: flex; flex-direction: column; }
.lg-l .lg-logo { height: 36px; align-self: flex-start; filter: brightness(0) invert(1); }
.lg-form { margin: auto 0; }
.lg-form h1 { font-size: 30px; color: #fff; margin: 0 0 4px; }
.lg-form p { margin: 0 0 22px; color: #cbd5e1; }
.lg-form label { display: block; margin: 0 0 6px; font-size: 14px; }
.lg-form select { width: 100%; background: transparent; color: #fff; border: 1px solid #cbd5e1; padding: 9px 10px; }
.lg-form select option { color: #1e293b; }
.lg-form button { width: 100%; margin-top: 22px; padding: 9px; background: #7aa0c4; border-color: #7aa0c4; color: #0f2140; font-weight: 700; }
.lg-form button:hover { background: #9dbad6; }
.lg-form .hint { font-size: 12px; color: #94a3b8; margin-top: 14px; }
.lg-form .err { margin: 0 0 14px; }
.lg-copy { font-size: 13px; color: #cbd5e1; }
.lg-r { padding: 14px 14px 14px 0; }
.lg-img { height: 100%; border-radius: 16px; background: url(/img/port-login.jpg) center / cover; position: relative; }
.lg-cap { position: absolute; left: 22px; bottom: 22px; max-width: 450px; padding: 16px 20px; border-radius: 12px; background: rgba(15,33,64,.6); backdrop-filter: blur(8px); color: #e2e8f0; }
.lg-cap b { display: block; color: #fff; font-size: 18px; margin-bottom: 2px; }
@media (max-width: 900px) { .lg { grid-template-columns: 1fr; } .lg-r { display: none; } .lg-l { padding: 24px 16px; } }

/* склад – заетост */
.occ { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-bottom: 10px; }
.occ-card.closed { background: #f7f7f7; }
.bar { flex: 1; height: 12px; background: var(--grey); border-radius: 6px; overflow: hidden; min-width: 120px; }
.bar > div { height: 100%; }
table.report tr.grp th { background: #eef2f8; text-align: left; font-weight: 600; }
table.report tr.editor td { background: #fff8e1; } table.report tr.editing td { background: #fffdf2; }
table.report tr.warnrow td { background: #fff3f3; }
details.hist { font-size: 12px; color: var(--muted, #667); margin-top: 2px; }
details.hist summary { cursor: pointer; display: inline-block; padding: 1px 7px; border: 1px solid #ccd; border-radius: 10px; background: #f4f6fa; }
details.hist[open] summary { background: #e3e9f3; }
details.hist div { margin: 3px 0 0 4px; white-space: normal; }
.printonly { display: none; }
@media print { .printonly { display: inline; } }

/* елементи като в демото: подзаглавие, лента с бутони, таблица с филтри, диалог */
.top .subtitle { color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
a.btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; padding: 7px 14px; text-decoration: none; white-space: nowrap; }
a.btn:hover { background: #08335e; }
a.btn.secondary { background: #fff; color: var(--accent); border-width: 1.5px; }
a.btn.secondary:hover { background: #eef4fb; }
table.dt th { text-align: center; white-space: normal; border-bottom: 1px solid var(--line); padding: 12px 8px; vertical-align: middle; }
table.dt tr.filters th { padding: 10px 6px; font-weight: 400; }
table.dt tr.filters select, table.dt tr.filters input { width: 100%; min-width: 96px; font-size: 13px; padding: 6px 8px; }
table.dt tr.filters input + input { margin-top: 4px; }
table.dt td { text-align: center; vertical-align: middle; padding: 12px 8px; }
table.dt td.num, table.dt th.num { text-align: right; }
table.dt td .muted { font-size: 12px; }
table.dt td.empty { color: var(--muted); padding: 26px; background: #fff; }
table.dt tbody tr:hover td { background: #f1f5f9; }
table.dt td.acts { white-space: nowrap; }
.ibtn { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border: 1.5px solid var(--accent); border-radius: 6px; color: var(--accent); text-decoration: none; background: #fff; }
.ibtn:hover { background: #eef4fb; }
dialog.dlg { border: 0; border-radius: 8px; padding: 0; width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 10px 40px rgba(0,0,0,.25); color: var(--text); }
dialog.dlg.narrow { width: min(560px, calc(100vw - 32px)); }
dialog.dlg::backdrop { background: rgba(15,23,42,.45); }
.dlg-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; font-size: 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.dlg-h .x { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.dlg-h .x:hover { background: #f1f5f9; box-shadow: none; }
.dlg-b { padding: 18px 22px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
.fsec { margin: 0 0 20px; }
.fsec h3 { font-size: 15px; margin: 0; }
.fsec > .meta { margin: 2px 0 12px; color: var(--muted); font-size: 13px; }
.dlg .grid2 > label, label.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: #334155; }
.dlg .grid2 > label select, .dlg .grid2 > label input, label.fld select, label.fld input, label.fld textarea { width: 100%; font-weight: 400; }
.dlg .row + .row { margin-top: 6px; }
details.help { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
details.help summary { cursor: pointer; display: inline-block; }
details.help div { margin-top: 6px; max-width: 1100px; }
details.jr { margin-top: 16px; }
details.jr summary { cursor: pointer; font-weight: 600; }
details.jr table { margin-top: 8px; }
.printdoc { display: none; }
@media print { .printdoc { display: block; } }
table.dt .nw { white-space: nowrap; }
.top > .row { margin-left: auto; justify-content: flex-end; }
table.dt td, table.dt th { padding-left: 6px; padding-right: 6px; }
table.dt tr.filters select { min-width: 80px; }
table.dt tr.filters input[type=date] { min-width: 0; width: 132px; }

/* ---------- табло ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
a.kpi { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; color: var(--text); text-decoration: none; }
a.kpi[href]:hover { box-shadow: 0 2px 10px rgba(15,33,64,.08); }
a.kpi span { display: block; color: #64748b; font-size: 14px; } a.kpi b { display: block; font-size: 26px; margin: 2px 0; } a.kpi small { color: #64748b; font-size: 12px; }
a.kpi i { font-size: 26px; } .c-blue i { color: #0a4076; } .c-orange i { color: #f59e0b; } .c-yellow i { color: #eab308; } .c-green i { color: #16a34a; }
.dcard { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.dcard h3 { margin: 0 0 10px; font-size: 18px; } .dcard-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dcard-h h3 { margin: 0; }
.pmap { position: relative; width: 100%; aspect-ratio: 1800 / 908; border-radius: 8px; overflow: hidden; background: #1e293b; }
.pmap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin { position: absolute; transform: translate(-50%, -50%); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; font-weight: 500;
  padding: 5px 10px; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.35); color: #fff; background: #16a34a; cursor: pointer; transition: transform .15s; }
.pin:hover { transform: translate(-50%, -50%) scale(1.08); z-index: 2; }
.pin.st-warn, .legend .st-warn::before { background: #f59e0b; } .pin.st-off, .legend .st-off::before { background: #64748b; } .pin.st-free, .legend .st-free::before { background: #0ea5e9; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 13px; color: #64748b; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: #16a34a; vertical-align: -1px; }
.tag.st-ok { background: #dcfce7; color: #166534; } .tag.st-warn { background: #fef3c7; color: #92400e; } .tag.st-off { background: #e2e8f0; color: #475569; } .tag.st-free { background: #e0f2fe; color: #075985; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } .dgrid .dcard { margin-bottom: 0; }
.ev { padding: 8px 0; border-bottom: 1px solid #f1f5f9; } .ev b { display: block; font-weight: 500; } .ev span { display: block; font-size: 13px; color: #475569; } .ev small { color: #94a3b8; font-size: 12px; }
.sys { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; } .sys small { display: block; color: #64748b; font-size: 12px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } .dgrid { grid-template-columns: 1fr; } .pin span { display: none; } }
@media (max-width: 600px) { .kpis { grid-template-columns: 1fr; } }
label.fld input[type=checkbox], label.fld input[type=radio] { width: auto; margin-right: 6px; }
button.ibtn { padding: 0; cursor: pointer; } td.acts { white-space: nowrap; }
.signs .sname { font-weight: 600; margin-bottom: 14px; }
/* ОРИГИНАЛ / КОПИЕ № n – в горния десен ъгъл на документа */
.copymark { margin-top: 4px; font-size: 12px; color: var(--muted); }
.copymark b { color: var(--brand); letter-spacing: .5px; }
.copymark.draft b { color: #b42318; }
@media print { .copymark { font-size: 14px; color: #000; } .copymark b { border: 1.5px solid #000; padding: 2px 8px; color: #000; } }
.warnbox { background: #fff7e0; border: 1px solid #f0c36d; color: #7a4d00; border-radius: 6px; padding: 8px 12px; margin: 6px 0; }
/* оперативен отчет – закъснял период */
table.dt tr.overdue td { background: var(--badbg); }
.doc .h3 { margin: 16px 0 6px; }
@media print { table.dt tr.filters { display: none; } }
/* опробване – само номерата, като в демото */
.plates { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 16px; }
button.plate { display: inline-flex; align-items: stretch; padding: 0; background: #fff; color: #111; border: 2px solid #1f2937; border-radius: 6px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 4px rgba(15,33,64,.12); }
button.plate:hover { box-shadow: 0 3px 12px rgba(15,33,64,.25); transform: translateY(-1px); }
button.plate .eu { background: #003399; color: #fc0; font-weight: 700; font-size: 12px; padding: 0 7px; display: flex; align-items: flex-end; padding-bottom: 6px; }
button.plate b { font-size: 22px; letter-spacing: 2px; padding: 8px 16px; font-family: "Arial Narrow", Arial, sans-serif; }
.empty-box { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; margin-bottom: 16px; }
button.plate.draft { border-color: #eab308; box-shadow: 0 0 0 2px #fde68a; }
dialog.dlg.wide { width: min(860px, 96vw); }
/* досиета – като „Досиета на кораби“ в демото: списък вляво, избраното вдясно */
.md2 { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 16px; align-items: start; }
.mlist input.mq { width: 100%; margin-bottom: 10px; }
.mlist { max-height: 75vh; overflow: auto; }
.mgrp { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 12px 0 6px; }
button.mcard { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; text-align: left; background: #fff; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
button.mcard b { font-size: 15px; } button.mcard small { color: var(--muted); grid-column: 1 / -1; }
button.mcard:hover { box-shadow: 0 2px 10px rgba(15,33,64,.12); } button.mcard.on { border-color: #0a4076; box-shadow: 0 0 0 2px #bcd3ee; }
button.mcard.warn { border-left: 4px solid var(--bad); }
.mdet { min-height: 360px; } .mempty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 320px; color: var(--muted); } .mempty i { font-size: 40px; }
@media (max-width: 900px) { .md2 { grid-template-columns: 1fr; } }
.mcard.mplate { align-items: center; } .plate-s { display: inline-flex; align-items: stretch; border: 2px solid #1f2937; border-radius: 5px; overflow: hidden; justify-self: start; background: #fff; }
.plate-s .eu { background: #003399; color: #fc0; font-weight: 700; font-size: 10px; padding: 0 5px; display: flex; align-items: flex-end; padding-bottom: 3px; }
.plate-s b { font-size: 17px; letter-spacing: 1.5px; padding: 4px 10px; font-family: "Arial Narrow", Arial, sans-serif; }
/* печат: всички документи на хоризонтален лист A4 – редовете са по-събрани (решение на ЛЦВ, 04.11.2026) */
@page { size: A4 landscape; margin: 10mm; }
@media print { table.report th, table.report td { padding: 3px 6px !important; } h3.h3 { margin: 8px 0 4px; } }
button.mcard .tag { white-space: nowrap; align-self: start; justify-self: end; }
/* втори ред раздели (напр. кантарите) – по-малки, под основните */
.tabs.tabs2 { margin-top: -6px; background: transparent; border: 0; padding: 0; gap: 8px; justify-content: flex-start; }
.tabs.tabs2 a { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 16px; }
.tabs .cnt { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #e2e8f0; font-size: 12px; text-align: center; margin-left: 4px; }
.tabs a.on .cnt { background: #0a4076; color: #fff; }
/* печат на всички документи (одобрено от ЛЦВ 04.11.2026): шапката без клетки, заглавието в светлосиньо (ЕБ – светлозелено, ТЗ – светлооранжево),
   целият текст черен, по-събрани редове; ОРИГИНАЛ / КОПИЕ – в рамка */
@media print {
  .page, .page * { color: #000 !important; }
  table.dochead tr:first-child > td { border: 0 !important; padding: 0 0 6px !important; background: none !important; }
  th.doctitle { background: #dbeafe !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; padding: 4px !important; font-size: 15px; }
  .doc.eb th.doctitle { background: #dcfce7 !important; } .doc.tz th.doctitle { background: #ffedd5 !important; }
  table.report th, table.report td, .doc table.dt th, .doc table.dt td { padding: 1px 6px !important; line-height: 1.25; }
  .doc table.dt td.empty { padding: 4px !important; }
  td.lbl { background: none !important; }
  .copymark { margin-top: 4px; }
  h3.h3 { margin: 6px 0 3px; font-size: 13px; }
}
}
/* заглавието на документа – цветен фон и черен текст и на екрана (като при печат): светлосиньо, ЕБ – светлозелено, ТЗ – светлооранжево */
th.doctitle { background: #dbeafe; color: #000; }
.doc.eb th.doctitle { background: #dcfce7; } .doc.tz th.doctitle { background: #ffedd5; }
/* текстът в документите – черен и на екрана (без връзките и предупрежденията) */
.doc td, .doc th, .doc .meta, .doc h3, .doc .sname, .doc table.signs td.sign, .doc .copymark, .doc .copymark b, .doc td.lbl { color: #000; }
/* протокол – заглавен ред на раздел (претоварване, магазинаж…) и отметка в прозорец */
table.report th.sect { background: #f1f5f9; text-align: left; }
label.chk { display: flex; gap: 8px; align-items: center; margin: 8px 0; }

/* Помощ */
ol.hsteps { margin: 8px 0 16px; padding-left: 22px; } ol.hsteps li { margin: 7px 0; line-height: 1.5; }
.hnote { background: #eef6ff; border-left: 3px solid #3b82f6; padding: 8px 12px; border-radius: 6px; margin: 8px 0 12px; color: #1e3a5f; }
.mdet h3 { margin: 14px 0 4px; font-size: 15px; } .hrole select { margin-left: 8px; min-width: 260px; }
.hpub { max-width: 1200px; margin: 0 auto; padding: 20px 16px; } a.lg-help { display: block; margin-top: 14px; color: var(--blue, #2563eb); }

/* ---------- Тъмна тема (светлата е по подразбиране; превключва се с бутона в горната лента; печатът е винаги светъл) ---------- */
@media screen {
html[data-theme="dark"] {
  --bg: #0b1220; --panel: #111a2b; --text: #e2e8f0; --muted: #94a3b8; --line: #263247;
  --brand: #2f6fb3; --accent: #6aa5e6; --ok: #4ade80; --okbg: #12301f; --warn: #fdba74; --warnbg: #3a2414;
  --bad: #f87171; --badbg: #3b1515; --info: #16294a; --grey: #1c2638; --navy: #070d18;
  color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .side, html[data-theme="dark"] .topbar, html[data-theme="dark"] .page, html[data-theme="dark"] th, html[data-theme="dark"] th.doctitle:not(.x),
html[data-theme="dark"] .dlg-h, html[data-theme="dark"] .dlg-f, html[data-theme="dark"] dialog.dlg, html[data-theme="dark"] a.kpi, html[data-theme="dark"] .dcard,
html[data-theme="dark"] button.mcard, html[data-theme="dark"] table.dt td.empty { background: var(--panel); color: var(--text); }
html[data-theme="dark"] .side a { color: var(--text); } html[data-theme="dark"] .side a.on { color: #fff; }
html[data-theme="dark"] .side a:hover, html[data-theme="dark"] table.dt tbody tr:hover td, html[data-theme="dark"] .dlg-h .x:hover { background: var(--grey); }
html[data-theme="dark"] .side a.off, html[data-theme="dark"] .side a.off small, html[data-theme="dark"] .tabs a.off { color: #5b6b82; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0d1626; color: var(--text); border-color: #334155; }
html[data-theme="dark"] button { color: #0b1220; } html[data-theme="dark"] button:hover:not(:disabled), html[data-theme="dark"] a.btn:hover { background: #8dbcf0; }
html[data-theme="dark"] a.btn { color: #0b1220; }
html[data-theme="dark"] button.secondary, html[data-theme="dark"] button.danger, html[data-theme="dark"] a.btn.secondary, html[data-theme="dark"] .ibtn { background: transparent; }
html[data-theme="dark"] button.secondary, html[data-theme="dark"] a.btn.secondary { color: var(--accent); } html[data-theme="dark"] button.danger { color: var(--bad); }
html[data-theme="dark"] button.secondary:hover:not(:disabled), html[data-theme="dark"] a.btn.secondary:hover, html[data-theme="dark"] .ibtn:hover, html[data-theme="dark"] a.btn-out:hover,
html[data-theme="dark"] button.danger:hover:not(:disabled) { background: var(--grey); }
html[data-theme="dark"] a.btn-out { border-color: var(--accent); color: var(--accent); }
html[data-theme="dark"] tbody tr:nth-child(even) td, html[data-theme="dark"] table tr:nth-child(even) > td, html[data-theme="dark"] table.report th, html[data-theme="dark"] tr.sub td,
html[data-theme="dark"] table.dochead td.lbl, html[data-theme="dark"] table.report td.lbl, html[data-theme="dark"] .mail, html[data-theme="dark"] pre.mailbody,
html[data-theme="dark"] table.report th.sect, html[data-theme="dark"] table.report tr.grp th, html[data-theme="dark"] details.hist summary, html[data-theme="dark"] .occ-card.closed { background: #0f1a2c; }
html[data-theme="dark"] th { color: var(--muted); }
html[data-theme="dark"] .tabs, html[data-theme="dark"] .tabs .cnt { background: #1a2436; } html[data-theme="dark"] .tabs a { color: var(--muted); }
html[data-theme="dark"] .tabs a.on { background: var(--panel); color: var(--text); } html[data-theme="dark"] .tabs a.on .cnt { background: var(--brand); }
html[data-theme="dark"] tr.row-warn td, html[data-theme="dark"] .card.row-warn, html[data-theme="dark"] table.report tr.editor td, html[data-theme="dark"] table.report tr.editing td { background: #2c2410; }
html[data-theme="dark"] table.report tr.warnrow td { background: #2e1616; } html[data-theme="dark"] td.green, html[data-theme="dark"] .green input, html[data-theme="dark"] .green select { background: #13301c; }
html[data-theme="dark"] .err { color: #fecaca; border-color: #7f1d1d; } html[data-theme="dark"] .ok { color: #bbf7d0; border-color: #166534; }
html[data-theme="dark"] .banner, html[data-theme="dark"] .warnbox { background: var(--warnbg); color: #fed7aa; border-color: #9a3412; }
html[data-theme="dark"] .hnote { background: #13243f; color: #c7dcf5; }
html[data-theme="dark"] .dlg .grid2 > label, html[data-theme="dark"] label.fld { color: #cbd5e1; }
html[data-theme="dark"] a.kpi, html[data-theme="dark"] .dcard { border-color: var(--line); } html[data-theme="dark"] a.kpi span, html[data-theme="dark"] a.kpi small { color: var(--muted); }
html[data-theme="dark"] .c-blue i { color: var(--accent); }
html[data-theme="dark"] .ev, html[data-theme="dark"] .sys { border-color: var(--line); } html[data-theme="dark"] .ev span { color: #cbd5e1; }
html[data-theme="dark"] .plate-s, html[data-theme="dark"] .plate-s b, html[data-theme="dark"] button.plate, html[data-theme="dark"] button.plate b { color: #111; }   /* номерът – черно на бяла табела и в тъмната тема */
html[data-theme="dark"] button.plate, html[data-theme="dark"] button.plate:hover:not(:disabled) { background: #fff; }
html[data-theme="dark"] button.mcard.on { border-color: var(--accent); box-shadow: 0 0 0 2px #23466f; }
html[data-theme="dark"] .tag.st-ok { background: #12301f; color: #86efac; } html[data-theme="dark"] .tag.st-warn { background: #3a2a0c; color: #fcd34d; }
html[data-theme="dark"] .tag.st-off { background: #1c2638; color: #94a3b8; } html[data-theme="dark"] .tag.st-free { background: #0c2a3d; color: #7dd3fc; }
/* документите на екрана – текстът светъл; цветните заглавия (ТЗ, ЕБ, КБ) остават светли с черен текст */
html[data-theme="dark"] .doc td, html[data-theme="dark"] .doc th:not(.doctitle), html[data-theme="dark"] .doc .meta, html[data-theme="dark"] .doc h3, html[data-theme="dark"] .doc .sname,
html[data-theme="dark"] .doc table.signs td.sign, html[data-theme="dark"] .doc .copymark, html[data-theme="dark"] .doc .copymark b, html[data-theme="dark"] .doc td.lbl { color: var(--text); }
html[data-theme="dark"] th.doctitle { background: #dbeafe; color: #000; }
html[data-theme="dark"] .doc.eb th.doctitle { background: #dcfce7; } html[data-theme="dark"] .doc.tz th.doctitle { background: #ffedd5; }
}
.theme-btn { background: transparent; color: var(--accent); border: 2px solid var(--accent); border-radius: 4px; padding: 7px 11px; }
.theme-btn:hover:not(:disabled) { background: var(--grey) !important; box-shadow: none; }
html[data-theme="dark"] .theme-btn, html[data-theme="dark"] .theme-btn:hover:not(:disabled), html[data-theme="dark"] .theme-btn:focus { background: transparent !important; color: #facc15 !important; border-color: #facc15 !important; box-shadow: none !important; }
html[data-theme="dark"] .theme-btn i { color: #facc15 !important; font-size: 18px; text-shadow: 0 0 8px rgba(250,204,21,.6); }   /* в тъмната тема – жълто слънце за връщане към светлата */
html[data-theme="dark"] .theme-btn:hover:not(:disabled) { background: rgba(250,204,21,.12) !important; }

/* статусите в справките – цветни и при печат */
@media print { .page .tag, .page .tag * { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid #999; }
  .page .tag.s0 { background: #ffedd5 !important; } .page .tag.s1 { background: #dbeafe !important; } .page .tag.s2 { background: #dcfce7 !important; } .page .tag.bad { background: #fee2e2 !important; } }
.tag.sw { background: #fef9c3; color: #854d0e; } .tag.sdel { background: #e5e7eb; color: #4b5563; text-decoration: line-through; }
html[data-theme="dark"] .tag.sw { background: #3a3410; color: #fde047; } html[data-theme="dark"] .tag.sdel { background: #1f2937; color: #9ca3af; }
@media print { .page .tag.sw { background: #fef9c3 !important; } .page .tag.sdel { background: #e5e7eb !important; } }

.pgbreak { height: 0; } @media print { .pgbreak { page-break-before: always; break-before: page; } }   /* хартиеното досие на кораба – всеки документ на нова страница */

/* раздел „само преглед“ (Администрация → Роли и права): без бутони за запис и без прозорци за въвеждане – остават печат, избор от списъка, затваряне */
.layout.ro .body .main button:not(.mcard):not(.prn):not(.theme-btn):not([data-close]):not(.x), .layout.ro .body dialog { display: none !important; }

/* Справки – печат само на справката: копие в #printarea направо в body, всичко друго скрито */
#printarea { display: none; }
@media print { body.printrep > *:not(#printarea) { display: none !important; } body.printrep #printarea { display: block; } #printarea .printonly { display: block; } #printarea div[style*=overflow] { overflow: visible !important; } #printarea table { width: 100%; } }
