/* نظام إدارة الأسطول والمواقع الزراعية — الأنماط */
:root {
  --palm: #1E4636;      /* الأخضر الداكن: القائمة والأزرار الرئيسية */
  --palm-2: #2A5A46;
  --palm-ink: #E4EFE7;
  --leaf: #CFE3D4;
  --bg: #EEF1EE;        /* سطح رمادي مخضر هادئ */
  --panel: #FFFFFF;
  --ink: #17201B;
  --muted: #5F6B64;
  --line: #DCE2DD;
  --ok: #2F7D4F;
  --warn: #A86A12;
  --bad: #B3261E;
  --idle: #8A938D;
  --warn-bg: #FBF1DF;
  --bad-bg: #FBE7E5;
  --r: 12px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --side: 264px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); }
h1, h2 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--palm); }
.num, .plate { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.code { display: inline-block; direction: ltr; unicode-bidi: isolate; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pad { padding: 12px 16px; margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 3px solid #6FA884; outline-offset: 2px; }

/* أزرار وحقول */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--palm); border-color: var(--palm); color: #fff; }
.btn-primary:hover { background: var(--palm-2); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.wide { width: 100%; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
.field { display: grid; gap: 6px; font-weight: 500; }
input, select { font: inherit; min-height: 46px; padding: 0 12px; border: 1px solid #C8D0CA; border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 3px solid #A9CDB4; border-color: var(--palm); }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-weight: 500; }

/* الهيكل */
.layout { min-height: 100dvh; }
.sidebar { display: none; }
.main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tb-title { display: grid; min-width: 0; }
.tb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-meta { display: flex; gap: 10px; color: var(--muted); font-size: .85rem; }
.tb-actions { display: flex; gap: 8px; align-items: center; grid-row: 1; grid-column: 2; }
.btn-add span { display: none; }
.btn-add { padding: 0 12px; }
.search { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #C8D0CA; border-radius: 10px; background: #F7F9F7; }
.search input { border: 0; background: transparent; min-height: 44px; padding: 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid #A9CDB4; border-color: var(--palm); }
.badge { position: absolute; top: -6px; inset-inline-start: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--bad); color: #fff; font-size: .75rem; line-height: 20px; font-weight: 700; }

.pop-wrap { position: relative; }
.pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 40; width: min(320px, 86vw); max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px rgba(23, 32, 27, .16); }
.pop-item { display: block; padding: 12px 16px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.pop-item:hover { background: #F3F6F3; }
.alert-item b { display: block; }
.alert-item span { color: var(--muted); font-size: .88rem; }
.pop-head { padding: 12px 16px; font-weight: 700; border-bottom: 1px solid var(--line); }
.pop-foot { display: block; padding: 12px 16px; font-weight: 600; text-decoration: none; }

.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom); background: var(--palm); }
.tab { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 10px; color: #B9D2C0; text-decoration: none; font: inherit;
  font-size: .75rem; background: none; border: 0; cursor: pointer; }
.tab.active { color: #fff; box-shadow: inset 0 3px 0 var(--leaf); }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(23, 32, 27, .45); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-panel { width: 100%; max-height: 88dvh; overflow: auto; background: var(--panel); border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 0 12px; }
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.nav-link.sheet-link { min-height: 56px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.nav-link.sheet-link.active { border-color: var(--palm); background: #E6EFE8; }

.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #CFE0D4; text-decoration: none;
  font: inherit; background: none; border: 0; width: 100%; cursor: pointer; text-align: start; }

/* الصفحة */
.page { padding: 16px; max-width: 1280px; margin: 0 auto; outline: none; }
.page-head { display: grid; gap: 12px; margin-bottom: 16px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; border: 1px solid #C8D0CA; border-radius: 10px; background: #fff; overflow: hidden; }
.stepper input { border: 0; border-radius: 0; text-align: center; min-height: 44px; padding: 0 4px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step { border: 0; background: #F3F6F3; color: var(--palm); font: 700 1.3rem/1 var(--font); cursor: pointer; }
.step:active { background: #E1EAE3; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.boot { min-height: 100dvh; display: grid; place-items: center; }

.panels { display: grid; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.panel header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.link { font-weight: 600; text-decoration: none; font-size: .9rem; }
.big { display: grid; gap: 4px; margin-bottom: 14px; }
.big .num { font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--palm); }
.big small { color: var(--muted); }
.segbar { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; margin-bottom: 10px; }
.seg { min-width: 6px; }
.empty-seg { background: var(--line); }
.st-working { background: var(--ok); } .st-stopped { background: var(--idle); }
.st-under_maintenance { background: var(--warn); } .st-accident_damaged { background: var(--bad); }
.legend { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: .92rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend b { margin-inline-start: auto; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.kv li b { font-size: 1.1rem; }
.kv.three { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.kv.three li { display: grid; gap: 2px; justify-items: center; font-size: .85rem; color: var(--muted); }
.kv.three b { color: var(--ink); }
.kv .is-bad b { color: var(--bad); } .kv .is-warn b { color: var(--warn); }

/* سجل المتابعة */
.followups { margin-top: 20px; }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.count { min-width: 28px; padding: 0 8px; border-radius: 14px; background: var(--palm); color: #fff; font-weight: 700; text-align: center; font-size: .85rem; line-height: 24px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.log { width: 100%; border-collapse: collapse; }
.log thead { display: none; }
.log tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  border-inline-start: 5px solid transparent; }
.log tbody tr:last-child { border-bottom: 0; }
.log td { display: block; padding: 0; }
.log td[data-l]::before { content: none; }
.log td:not(.remain):not(.act) { grid-column: 1; }
.log td.num[data-l] { color: var(--muted); font-size: .9rem; }
.log td.nodate { display: none; }
.log td small { display: block; color: var(--muted); font-size: .82rem; }
.log .remain { grid-column: 2; grid-row: 1; font-weight: 700; text-align: end; }
.log .act { grid-column: 2; grid-row: 2 / span 3; align-self: end; }
.log tr.sev-1 { border-inline-start-color: var(--bad); }
.log tr.sev-1 .remain { color: var(--bad); }
.log tr.sev-2 { border-inline-start-color: var(--warn); }
.log tr.sev-2 .remain { color: var(--warn); }
.log tr.sev-3 { border-inline-start-color: var(--idle); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 12px; color: #fff; font-size: .82rem; font-weight: 600; }
.empty { padding: 32px 16px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.empty.soft { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); }
.empty.error h1 { color: var(--bad); }
.upcoming { display: flex; gap: 16px; align-items: flex-start; padding: 20px; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.upcoming p { margin: 0 0 6px; }
.up-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: #E6EFE8; color: var(--palm); flex: none; }

/* تسجيل الدخول */
.login { min-height: 100dvh; display: grid; }
.login-side { display: none; }
.login-card { align-self: center; justify-self: center; width: min(420px, 100%); display: grid; gap: 14px; padding: 32px 20px; }
.login-card h1 { font-size: 1.6rem; }
.login-card p { margin: 0; }
.login-brand { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 16px; background: var(--palm); color: var(--leaf); }
.brand-ic { width: 32px; height: 32px; }

.toast { position: fixed; inset-inline: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 60; padding: 14px 16px; border-radius: 12px;
  color: #fff; font-weight: 600; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { transform: none; opacity: 1; }
.toast-ok { background: var(--palm); } .toast-error { background: var(--bad); }

/* شاشات أوسع */
@media (min-width: 640px) {
  .filters { grid-template-columns: 1.4fr 1.4fr .7fr .8fr; }
  .btn-add span { display: inline; }
  .log thead { display: table-header-group; }
  .log tr { display: table-row; border-inline-start: 0; }
  .log td, .log th { display: table-cell; padding: 12px 14px; text-align: start; vertical-align: middle; }
  .log th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #F5F7F5; border-bottom: 1px solid var(--line); }
  .log td:first-child { box-shadow: inset -5px 0 0 transparent; }
  .log tr.sev-1 td:first-child { box-shadow: inset -5px 0 0 var(--bad); }
  .log tr.sev-2 td:first-child { box-shadow: inset -5px 0 0 var(--warn); }
  .log tr.sev-3 td:first-child { box-shadow: inset -5px 0 0 var(--idle); }
  .log .remain { text-align: start; }
  .log td.num[data-l] { color: var(--ink); font-size: 1rem; }
  .log td.nodate { display: table-cell; }
  .log .act { text-align: end; }
}
@media (min-width: 1000px) {
  .layout { display: grid; grid-template-columns: var(--side) 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow: auto; padding: 18px 12px; background: var(--palm); color: #fff; }
  .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: var(--leaf); }
  .brand b { display: block; color: #fff; } .brand small { color: #B9D2C0; }
  .nav { display: grid; gap: 2px; }
  .nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .nav-link.active { background: var(--palm-ink); color: var(--palm); font-weight: 600; }
  .signout { margin-top: auto; }
  .main { padding-bottom: 0; min-width: 0; }
  .tabbar, .sheet { display: none !important; }
  .topbar { grid-template-columns: auto 1fr auto; padding: 12px 24px; }
  .tb-actions { grid-row: auto; grid-column: auto; }
  .search { grid-column: auto; max-width: 520px; }
  .page { padding: 24px; }
  .page-head { grid-template-columns: auto 1fr; align-items: end; }
  .filters { justify-self: end; width: min(640px, 100%); }
  .panels { grid-template-columns: 1.15fr 1fr 1fr; }
  .toast { inset-inline: auto 24px; bottom: 24px; max-width: 420px; }
  .login { grid-template-columns: 1fr 1fr; }
  .login-side { display: block; background: var(--palm); position: relative; overflow: hidden; }
  .rows { position: absolute; inset: -20% -10%; display: grid; gap: 34px; transform: rotate(-24deg); }
  .rows span { display: block; height: 14px; border-radius: 7px; background: repeating-linear-gradient(90deg, #2F6650 0 26px, transparent 26px 40px); }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media print { .sidebar, .topbar, .tabbar { display: none !important; } body { background: #fff; } }

/* ===================== المرحلة الثالثة: الصفحات والنماذج ===================== */
.page-head.row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.page-head.row h1 { display: flex; align-items: center; gap: 10px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note { margin: -6px 0 14px; font-size: .9rem; }
.strong { font-weight: 700; }
.wide-filters { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.wide-filters .grow { grid-column: 1 / -1; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.back .ic { width: 18px; height: 18px; }

/* الشارات */
.tag { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: .8rem; font-weight: 600; background: #EEF1EE; color: var(--muted); white-space: nowrap; }
td .tag, td small { margin-inline-start: 4px; }
.t-valid, .t-not_due, .t-emp-active { background: #E3F1E8; color: var(--ok); }
.t-expiring, .t-soon, .t-emp-on_leave { background: var(--warn-bg); color: var(--warn); }
.t-expired, .t-overdue, .t-due, .t-not_authorized, .t-missing { background: var(--bad-bg); color: var(--bad); }
.t-no_date, .t-no_record, .t-no_driver, .t-emp-terminated, .t-emp-other { background: #ECEEEC; color: #59615C; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { padding: 4px 12px; border-radius: 14px; font-size: .88rem; font-weight: 600; }

/* جداول البيانات: بطاقات على الجوال وجدول على الشاشات الأوسع */
.rtable { width: 100%; border-collapse: collapse; }
.rtable thead { display: none; }
.rtable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.rtable tbody tr:last-child { border-bottom: 0; }
.rtable td { display: block; min-width: 0; overflow-wrap: anywhere; }
.rtable td[data-l]::before { content: attr(data-l); display: block; font-size: .75rem; color: var(--muted); }
.rtable td:first-child, .rtable td.act { grid-column: 1 / -1; }
.rtable td small { display: block; margin: 2px 0 0; }
.rtable td small.tag { display: inline-block; }
.rtable .act { display: flex; gap: 8px; flex-wrap: wrap; }
.sort { all: unset; cursor: pointer; font-weight: 600; }
.sort:focus-visible { outline: 3px solid #6FA884; }

/* ملف السيارة والموظف */
.vhead { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.vhead-main { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.vhead-main h1 { font-size: 1.25rem; }
.vhead-main p { margin: 2px 0 0; }
.vhead-main > .pill, .vhead-main > .tag { margin-inline-start: auto; }
.plate-big { padding: 8px 14px; border: 2px solid var(--ink); border-radius: 8px; font-weight: 700; font-size: 1.2rem; background: #fff; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #E6EFE8; color: var(--palm); font-weight: 700; font-size: 1.4rem; }
.vfacts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0 0 14px; }
.vfacts dt, .dl dt { font-size: .78rem; color: var(--muted); }
.vfacts dd, .dl dd { margin: 0; font-weight: 600; }
.vactions { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.vactions::-webkit-scrollbar { display: none; }
.vactions .btn { flex: none; }
.vactions .btn { min-height: 42px; padding: 0 12px; font-size: .9rem; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabbtn { flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel); font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer; }
.tabbtn.on { background: var(--palm); border-color: var(--palm); color: #fff; font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.on { display: block; }
.tab-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.sub { margin: 18px 0 8px; font-size: .95rem; font-weight: 600; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.dl > div { min-width: 0; overflow-wrap: anywhere; }
.panel + .panel { margin-top: 12px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.warn-box, .bad-box, .later { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin: 0 0 12px; }
.warn-box { background: var(--warn-bg); color: #7A4E0E; }
.bad-box { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.later { background: #F1F4F1; color: var(--muted); font-size: .9rem; }
.doc-cards { display: grid; gap: 10px; }
.doc-card { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-inline-start-width: 5px; border-radius: 10px; }
.doc-card > div:first-child { display: flex; justify-content: space-between; gap: 8px; }
.doc-card .btn { justify-self: start; }
.s-valid { border-inline-start-color: var(--ok); } .s-expiring { border-inline-start-color: var(--warn); }
.s-expired, .s-missing { border-inline-start-color: var(--bad); } .s-no_date { border-inline-start-color: var(--idle); }
.company.inactive, .site-list li.inactive { opacity: .65; }
.company header small { display: block; }
.site-list { list-style: none; margin: 0; padding: 0; }
.site-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.site-list li .btn { grid-row: 1 / span 2; grid-column: 2; }

/* النوافذ والنماذج */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; background: rgba(23, 32, 27, .5); }
.modal-panel { width: 100%; max-height: 94dvh; display: flex; flex-direction: column; background: var(--panel); border-radius: 18px 18px 0 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-start; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.modal-foot .btn-primary { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-sec { grid-column: 1 / -1; margin: 8px 0 -4px; font-size: .95rem; color: var(--palm); border-top: 1px solid var(--line); padding-top: 14px; }
.form-grid .form-sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.intro { margin: 0; padding: 10px 12px; background: #F1F4F1; border-radius: 10px; font-size: .9rem; color: var(--muted); }
.req { color: var(--bad); margin-inline-start: 3px; }
.help { color: var(--muted); font-weight: 400; font-size: .8rem; }
textarea { font: inherit; padding: 10px 12px; border: 1px solid #C8D0CA; border-radius: 10px; width: 100%; resize: vertical; }
textarea:focus { outline: 3px solid #A9CDB4; border-color: var(--palm); }
.check { display: flex; align-items: center; gap: 10px; min-height: 46px; font-weight: 500; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--palm); }
.date-in { display: grid; grid-template-columns: 1fr 46px; border: 1px solid #C8D0CA; border-radius: 10px; overflow: hidden; background: #fff; position: relative; }
.date-in input[type=text] { border: 0; border-radius: 0; text-align: right; }
.date-in:focus-within { outline: 3px solid #A9CDB4; border-color: var(--palm); }
.date-in input:focus { outline: none; }
.cal { border: 0; background: #F3F6F3; color: var(--palm); cursor: pointer; display: grid; place-items: center; }
.native { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; bottom: 0; left: 0; }

@media (min-width: 640px) {
  .wide-filters { grid-template-columns: 2fr repeat(4, 1fr); }
  .wide-filters .grow { grid-column: auto; }
  .rtable thead { display: table-header-group; }
  .rtable tr { display: table-row; }
  .rtable td, .rtable th { display: table-cell; padding: 11px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
  .rtable td[data-l]::before { content: none; }
  .rtable th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #F5F7F5; white-space: nowrap; }
  .rtable .act { display: table-cell; white-space: nowrap; }
  .rtable .act .btn + .btn { margin-inline-start: 6px; }
  .vfacts { grid-template-columns: repeat(4, 1fr); }
  .vactions { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .dl { grid-template-columns: repeat(3, 1fr); }
  .doc-cards { grid-template-columns: repeat(3, 1fr); }
  .modal { align-items: center; justify-content: center; padding: 24px; }
  .modal-panel { width: min(720px, 100%); border-radius: 16px; max-height: 90dvh; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .modal-foot { justify-content: flex-end; }
  .modal-foot .btn-primary { flex: none; min-width: 140px; }
}
@media print {
  .no-print, .back, .modal, .toast { display: none !important; }
  .tab-panel { display: block !important; break-inside: avoid-page; border: 0; padding: 8px 0; }
  .page { padding: 0; max-width: none; }
  .vhead { border: 0; padding: 0; }
  .rtable thead { display: table-header-group; }
  .rtable tr { display: table-row; }
  .rtable td, .rtable th { display: table-cell; padding: 4px 6px; border-bottom: 1px solid #ccc; }
  .rtable td[data-l]::before { content: none; }
}

.center { text-align: center; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
