/* Saif Plus Warehouse — design system
   Brand from the Saif Plus logo: deep blue + sky blue on dark navy. */

:root {
  --brand: #1f5fa8;
  --brand-deep: #164a85;
  --brand-sky: #4fa8e8;
  --navy-900: #0b1f35;
  --navy-800: #10294a;
  --navy-700: #16345c;
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #f7fafd;
  --line: #dde7f1;
  --text: #14263c;
  --text-2: #51677f;
  --text-3: #7f93a8;
  --ok: #178a50;
  --ok-bg: #e2f5ea;
  --warn: #a8650b;
  --warn-bg: #fdf0da;
  --danger: #c0392b;
  --danger-bg: #fdeae7;
  --info: #1f5fa8;
  --info-bg: #e4eefb;
  --violet: #6d4fc4;
  --violet-bg: #eee9fb;
  --teal: #0e7c86;
  --teal-bg: #dff4f6;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(16, 42, 74, .06), 0 2px 8px rgba(16, 42, 74, .06);
  --shadow-2: 0 4px 10px rgba(16, 42, 74, .08), 0 12px 32px rgba(16, 42, 74, .12);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", "Segoe UI Arabic", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.boot { padding: 40px; color: var(--text-3); text-align: center; }

/* ---------- layout shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background: linear-gradient(178deg, var(--navy-800) 0%, var(--navy-900) 100%);
  color: #cfe0f2;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .logo svg { flex-shrink: 0; }
.sidebar .logo .name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -.01em; line-height: 1.2; }
.sidebar .logo .sub { font-size: 11px; color: #8fb2d8; }

.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6d8db1; padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: #c4d8ee; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(79, 168, 232, .12); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(79,168,232,.28), rgba(79,168,232,.10)); color: #fff; box-shadow: inset 2px 0 0 var(--brand-sky); }
[dir="rtl"] .nav a.active { box-shadow: inset -2px 0 0 var(--brand-sky); }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav .badge-n {
  margin-inline-start: auto; background: var(--brand-sky); color: #06233f;
  border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px;
}

.sidebar .foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .foot .who { color: #fff; font-weight: 600; }
.sidebar .foot .role { color: #8fb2d8; font-size: 11px; text-transform: capitalize; }
.sidebar .foot .links { margin-top: 8px; display: flex; gap: 12px; }
.sidebar .foot a { color: #9fc3e8; font-size: 12px; cursor: pointer; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }

.content { padding: 22px 26px 60px; max-width: 1180px; width: 100%; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 8px 14px; font-weight: 600; font-size: 13.5px;
  cursor: pointer; background: var(--surface); color: var(--text);
  border-color: var(--line);
  transition: transform .08s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-1); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand-sky); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%); color: #fff; border-color: var(--brand-deep); box-shadow: 0 2px 6px rgba(31,95,168,.35); }
.btn.primary:hover { background: linear-gradient(180deg, #2769b5 0%, var(--brand) 100%); }
.btn.danger { background: var(--danger); color: #fff; border-color: #a93226; }
.btn.ok { background: var(--ok); color: #fff; border-color: #116b3d; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--info-bg); box-shadow: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

/* ---------- cards / stats ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .hint { font-weight: 400; font-size: 12px; color: var(--text-3); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-1); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--brand)); }
.stat .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 2px; }
.stat .value small { font-size: 13px; color: var(--text-3); font-weight: 500; }
.stat.clickable { cursor: pointer; transition: box-shadow .15s; }
.stat.clickable:hover { box-shadow: var(--shadow-2); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: start; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid #ecf2f8; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.rowlink { cursor: pointer; transition: background .12s; }
table.data tr.rowlink:hover { background: #f2f8fe; }
table.data .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.empty { padding: 34px; text-align: center; color: var(--text-3); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 99px; padding: 2px 10px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.gray { background: #eef1f5; color: #5a6b7d; }
.badge.blue { background: var(--info-bg); color: var(--info); }
.badge.sky { background: #e3f2fd; color: #1272b6; }
.badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.amber { background: var(--warn-bg); color: var(--warn); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: #fff; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand-sky); box-shadow: 0 0 0 3px rgba(79,168,232,.18);
}
.field textarea { resize: vertical; min-height: 64px; }
.field .help { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.lines-editor { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lines-editor table { width: 100%; border-collapse: collapse; }
.lines-editor th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); background: var(--surface-2); padding: 7px 8px; text-align: start; }
.lines-editor td { padding: 5px 5px; border-top: 1px solid #eef3f8; vertical-align: top; }
.lines-editor input, .lines-editor select { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 7px; font-size: 13px; }
.lines-editor input:hover, .lines-editor select:hover { border-color: var(--line); }
.lines-editor input:focus, .lines-editor select:focus { outline: none; border-color: var(--brand-sky); background: #fff; box-shadow: 0 0 0 2px rgba(79,168,232,.15); }
.lines-editor .rm { color: var(--danger); background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; }
.lines-editor .rm:hover { background: var(--danger-bg); }

.form-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }

/* ---------- filter bar ---------- */

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters .field { min-width: 140px; }
.filters .field input, .filters .field select { padding: 7px 9px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------- detail page ---------- */

.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head .ref { font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.detail-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; }
.kv .item .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv .item .v { font-size: 14px; font-weight: 500; margin-top: 1px; word-break: break-word; }
.kv .item .v.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* timeline */
.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -17px; top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-sky); box-shadow: 0 0 0 3px #dcecfa; }
.tl-item .tl-when { font-size: 11px; color: var(--text-3); }
.tl-item .tl-text { font-size: 13px; margin-top: 1px; }
.tl-item .tl-who { font-weight: 600; }

/* attachments */
.attach-list { display: flex; flex-wrap: wrap; gap: 10px; }
.attach {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  background: var(--surface-2); max-width: 100%;
}
.attach img.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 7px; }
.attach .icon { width: 40px; height: 40px; border-radius: 7px; background: var(--info-bg); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.attach .meta { min-width: 0; }
.attach .fname { font-size: 12.5px; font-weight: 600; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .fsub { font-size: 11px; color: var(--text-3); }
.attach .acts { display: flex; gap: 2px; }
.attach .acts button, .attach .acts a { background: none; border: none; cursor: pointer; color: var(--brand); padding: 4px; border-radius: 6px; display: flex; }
.attach .acts button:hover, .attach .acts a:hover { background: var(--info-bg); }

/* comments */
.comment { border-inline-start: 3px solid var(--brand-sky); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.comment .c-head { font-size: 11.5px; color: var(--text-3); }
.comment .c-head b { color: var(--text-2); }
.comment .c-text { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(79,168,232,.35), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(31,95,168,.45), transparent 55%),
    linear-gradient(160deg, var(--navy-800), var(--navy-900));
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,.98); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(4, 16, 32, .5);
  padding: 30px 28px;
}
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.login-card .brand .t { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.login-card .brand .s { font-size: 12.5px; color: var(--text-2); }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; padding: 10px; font-size: 14.5px; margin-top: 6px; }
.login-card .lang-row { text-align: center; margin-top: 16px; }
.login-err { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; font-weight: 600; }

/* ---------- modal ---------- */

.modal-back {
  position: fixed; inset: 0; background: rgba(9, 24, 43, .55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-2);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  padding: 20px 22px;
}
.modal.wide { max-width: 760px; }
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.01em; }
.modal .m-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal .field { margin-bottom: 11px; }

/* ---------- server-unreachable overlay ---------- */

#server-down {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(9, 24, 43, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#server-down .sd-card {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-2);
  padding: 26px 28px; max-width: 440px; text-align: center;
}
#server-down .sd-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
#server-down .sd-text { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; line-height: 1.6; }
#server-down .sd-code {
  display: block; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; font-family: ui-monospace, Menlo, monospace;
  font-size: 12.5px; margin-bottom: 16px; direction: ltr;
}

/* ---------- toasts ---------- */

#toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-800); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-2);
  max-width: 360px; animation: toast-in .25s ease;
  border-inline-start: 4px solid var(--brand-sky);
}
.toast.err { border-inline-start-color: #ff7b6b; }
.toast.ok { border-inline-start-color: #4ade80; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- misc ---------- */

.notice { border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--info-bg); color: var(--info); }
.notice.danger { background: var(--danger-bg); color: var(--danger); }

.pill-tabs { display: inline-flex; background: #e8eef5; border-radius: 10px; padding: 3px; gap: 2px; }
.pill-tabs button {
  border: none; background: transparent; padding: 6px 14px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text-2);
  transition: background .15s, color .15s;
}
.pill-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-1); }

.report-section h3 { font-size: 14.5px; font-weight: 700; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.report-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.report-head .rh-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.report-head .rh-range { color: var(--text-2); font-size: 13px; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-inline-start: auto; }

/* mobile */
/* ---------- v1.8: home screen (module tiles) ---------- */
.home-hello { margin: 2px 2px 16px; }
.home-hello h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -.01em; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mod-tile {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 40, 80, .06); position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.mod-tile::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--accent); }
.mod-tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px rgba(15, 40, 80, .12); }
.mod-tile .mt-top { display: flex; align-items: center; gap: 12px; }
.mod-tile .mt-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent);
}
.mod-tile .mt-icon svg { width: 24px; height: 24px; }
.mod-tile .mt-title { font-weight: 700; font-size: 16px; line-height: 1.25; }
.mod-tile .mt-level { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.mod-tile .mt-desc { font-size: 12.5px; color: var(--text-2, #5b6b80); line-height: 1.5; }
.mod-tile .mt-facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.mod-tile .mt-fact { flex: 1 1 0; min-width: 76px; padding: 7px 9px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; }
.mod-tile .mt-fact b { font-size: 18px; line-height: 1.1; }
.mod-tile .mt-fact span { font-size: 11px; color: var(--text-2, #5b6b80); }
.mod-tile .mt-fact.warn b { color: var(--warn); }
.mod-tile .mt-fact.danger b { color: var(--danger); }

/* ---------- v1.8: sidebar inside a module ---------- */
.nav .section.mod-head { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 700; padding: 16px 10px 2px; }
.nav .section.mod-head svg { width: 18px; height: 18px; color: var(--accent); }
.nav .mod-level { font-size: 11px; color: #8fb2d8; padding: 0 10px 8px; }

/* ---------- v1.8: users screen (department + access matrix) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; gap: 5px; align-items: center; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); white-space: nowrap; }
.chip b { font-weight: 600; }
.inactive-row { opacity: .55; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin: 4px 0 12px; border-radius: 10px; background: var(--violet-bg); font-size: 13px; cursor: pointer; }
.check-row input { margin-top: 3px; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.matrix-title { font-weight: 700; font-size: 13px; margin: 4px 0 6px; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.matrix td:first-child { border-inline-start: 3px solid var(--accent); padding-inline-start: 10px; }
.matrix td:last-child { width: 44%; }
.matrix select { width: 100%; }
.mx-mod { display: flex; align-items: center; gap: 7px; }
.mx-mod svg { width: 16px; height: 16px; color: var(--accent); }
#f-access.disabled { opacity: .4; pointer-events: none; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; padding: 6px; }
  .nav .section { display: none; }
  .nav .section.mod-head { display: flex; width: 100%; padding: 6px 10px 2px; }
  .nav .mod-level { display: none; }
  .mod-grid { grid-template-columns: 1fr; }
  .nav a { padding: 7px 10px; }
  .sidebar .foot { display: flex; align-items: center; gap: 12px; }
  .sidebar .foot .links { margin-top: 0; margin-inline-start: auto; }
  .content { padding: 14px 14px 40px; }
  .topbar { padding: 10px 14px; }
}

/* print — reports and detail pages come out clean */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .filters, .form-actions, .btn, #toasts, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card, .table-wrap { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
