/* Lynton DMS – one stylesheet for the whole system.
   Colours: Lynton navy and yellow. Fonts: Barlow (served from our own server). */

@font-face { font-family: "Barlow"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --navy: #1d2340;
  --navy-2: #2c3560;
  --navy-line: #4a5280;
  --yellow: #f5bc15;
  --yellow-soft: #fff7e0;
  --ink: #1d2340;
  --muted: #545b6e;
  --line: #dfe2e8;
  --line-soft: #eceef2;
  --bg: #eef0f4;
  --card: #ffffff;
  --green: #14532d; --green-bg: #d6ecdc;
  --red: #a3201a; --red-bg: #fde4e1;
  --amber: #6b4e00; --amber-bg: #fdf0c6;
  --blue: #173f73; --blue-bg: #e2ecf9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 35, 64, .06);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Barlow Condensed", "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: #000; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
h1 { font-family: var(--font-head); font-size: 34px; font-weight: 700; letter-spacing: .005em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
code { font-size: .9em; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; }
.icon { vertical-align: -4px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--yellow); color: var(--navy); padding: 10px 16px; z-index: 10; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.inline { display: inline; }

/* ---------- Top of every page ---------- */
.env-label { background: repeating-linear-gradient(135deg, #f5bc15 0 14px, #ffd65a 14px 28px); color: var(--navy); text-align: center; font-weight: 700; font-size: 13px; padding: 4px 8px; letter-spacing: .03em; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand img { display: block; height: 44px; width: auto; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who-link { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px; border-radius: 10px; min-height: 44px; }
.who-link:hover { background: var(--line-soft); }
.who-text { display: flex; flex-direction: column; line-height: 1.15; }
.who-text small { color: var(--muted); font-size: 13px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: var(--yellow); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--navy); cursor: pointer; padding: 0; }
.btn-icon:hover { background: var(--line-soft); }
.nav-toggle { display: none; }
.mainnav { background: var(--navy); }
.mainnav-inner { max-width: 1400px; margin: 0 auto; padding: 0 8px; display: flex; flex-wrap: wrap; }
.mainnav a { color: #fff; text-decoration: none; padding: 13px 14px 10px; font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; }
.mainnav a:hover { border-bottom-color: rgba(245, 188, 21, .6); color: #fff; }
.mainnav a.active { border-bottom-color: var(--yellow); }
.notice-bar { background: var(--amber-bg); color: var(--amber); text-align: center; padding: 10px 16px; font-weight: 600; border-bottom: 1px solid #f0d27a; }
.notice-bar a { color: var(--amber); }

.page { max-width: 1400px; margin: 0 auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 20px; }
.page > * { margin-top: 0; margin-bottom: 0; }
.narrow { max-width: 480px; margin: 0 auto; padding: 32px 16px 48px; }
.plain-logo { text-align: center; margin-bottom: 20px; }
.plain-logo img { width: 280px; height: auto; }
.narrow-card { max-width: 560px; }
.foot { max-width: 1400px; margin: 0 auto; padding: 8px 24px 28px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pagehead h1 { margin: 0; }
.pagehead .sub { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { margin: 8px 0 -6px; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Cards, grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card.flush { padding: 0; overflow: hidden; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; align-items: start; }
.card .grid2 { gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0 16px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 15px; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid #c9cdd6; background: #fff; color: var(--navy); text-decoration: none; cursor: pointer; line-height: 1.1; }
.btn:hover { background: var(--line-soft); color: var(--navy); }
.btn-primary { background: var(--yellow); border-color: var(--yellow); color: var(--navy); font-weight: 700; }
.btn-primary:hover { background: #e6ad06; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #82170f; color: #fff; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-lg { min-height: 50px; font-size: 17px; padding: 12px 22px; }
.btn-block { width: 100%; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(238, 240, 244, .95); padding: 12px 0; z-index: 2; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: 15px; }
.req { color: var(--red); }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #b9bfcb; border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%;
}
textarea { min-height: 0; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input:disabled, select:disabled, textarea:disabled { background: var(--line-soft); color: var(--muted); }
input.num { width: 90px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.field-error { color: var(--red); font-weight: 600; font-size: 14px; margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--navy); }
.check label { font-weight: 500; }
.check small { display: block; color: var(--muted); font-size: 14px; }
.pw { position: relative; }
.pw input { padding-right: 52px; }
.pw .pw-toggle { position: absolute; right: 2px; top: 1px; border: 0; background: transparent; }
.filters { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; padding-bottom: 4px; }
.filters .field { min-width: 160px; }
.filters .grow, .add-row .grow, .list-row .grow { flex: 1 1 240px; }
.add-row { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; padding-bottom: 4px; }
fieldset.perm-group { border: 0; border-top: 1px solid var(--line-soft); padding: 12px 0 4px; margin: 0; }
fieldset.perm-group legend { font-weight: 700; padding: 0 8px 0 0; }
details summary { cursor: pointer; font-weight: 600; padding: 8px 0; min-height: 44px; display: flex; align-items: center; }

/* ---------- Messages ---------- */
.flash { border-radius: 12px; padding: 12px 16px; font-weight: 500; border: 1px solid transparent; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.flash-success { background: var(--green-bg); color: var(--green); border-color: #a9d3b6; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #f2b8b1; }
.flash-error a { color: var(--red); }
.flash-info { background: var(--blue-bg); color: var(--blue); border-color: #b5cbe9; }
.flash-warn { background: var(--amber-bg); color: var(--amber); border-color: #f0d27a; margin-bottom: 12px; }
.temp-pw { margin-top: 14px; background: var(--yellow-soft); border: 1px solid #f0d27a; border-radius: 12px; padding: 14px 16px; }
.big-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 26px; font-weight: 700; letter-spacing: .04em; margin: 0; }

/* ---------- Tables and lists ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover td { background: #fbf7e8; }
.table.compact td { padding: 8px 12px; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--line-soft); color: var(--ink); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.history { list-style: none; padding: 0; margin: 0 0 10px; }
.history li { padding: 8px 0; border-top: 1px solid var(--line-soft); }
.history li:first-child { border-top: 0; }
.order-list { list-style: none; padding: 0; margin: 0; }
.order-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.order-list li:first-child { border-top: 0; }
.row-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.list-row { padding-top: 12px; padding-bottom: 6px; }
.list-row-main { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; }
.list-row-main .check, .list-row-main > .muted { margin-bottom: 22px; }
.list-row-main .btn { margin-bottom: 14px; }
.list-row.is-off { opacity: .75; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tiles-lg { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-decoration: none; font-weight: 600; justify-content: center; }
.tile span { font-weight: 400; color: var(--muted); font-size: 14px; }
.tile:hover { border-color: var(--yellow); background: var(--yellow-soft); }
.stats { display: flex; flex-wrap: wrap; gap: 24px; margin-bottom: 12px; }
.stat { display: block; font-family: var(--font-head); font-size: 38px; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: 14px; }

/* ---------- Home page ---------- */
.banner { position: relative; overflow: hidden; background: var(--navy); color: #fff; border-radius: 16px; padding: 26px 28px; min-height: 128px; display: flex; align-items: center; }
.banner-text { position: relative; z-index: 1; }
.banner h1 { margin: 2px 0 0; font-size: 40px; color: #fff; }
.banner-date { margin: 0; color: var(--yellow); font-weight: 600; }
.home-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: -6px; }
.home-tools p { margin: 0; }
.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 20px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
.panel-wide { grid-column: 1 / -1; }
.panel h2 { display: flex; align-items: center; gap: 8px; }
.panel .lock { color: var(--muted); display: inline-flex; }

/* Seasonal designs: shapes drift down and sway inside the banner only. */
.sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fall { position: absolute; top: -48px; display: block; animation-name: fall; animation-timing-function: linear; animation-iteration-count: infinite; }
.sway { display: block; animation: sway 3.2s ease-in-out infinite alternate; }
.fall svg { display: block; width: 100%; height: auto; }
@keyframes fall { from { transform: translateY(0) rotate(0deg); } to { transform: translateY(260px) rotate(320deg); } }
@keyframes sway { from { transform: translateX(-14px); } to { transform: translateX(14px); } }
.fall-1  { left: 3%;  width: 24px; animation-duration: 9s;    animation-delay: 0s; }
.fall-2  { left: 10%; width: 18px; animation-duration: 11s;   animation-delay: -4s; }
.fall-3  { left: 17%; width: 22px; animation-duration: 10s;   animation-delay: -7s; }
.fall-4  { left: 25%; width: 16px; animation-duration: 12s;   animation-delay: -2s; }
.fall-5  { left: 32%; width: 20px; animation-duration: 9.5s;  animation-delay: -5.5s; }
.fall-6  { left: 40%; width: 24px; animation-duration: 11.5s; animation-delay: -8s; }
.fall-7  { left: 47%; width: 18px; animation-duration: 10.5s; animation-delay: -1s; }
.fall-8  { left: 55%; width: 22px; animation-duration: 12.5s; animation-delay: -6s; }
.fall-9  { left: 62%; width: 16px; animation-duration: 9s;    animation-delay: -3s; }
.fall-10 { left: 70%; width: 24px; animation-duration: 11s;   animation-delay: -9s; }
.fall-11 { left: 77%; width: 18px; animation-duration: 10s;   animation-delay: -4.5s; }
.fall-12 { left: 84%; width: 22px; animation-duration: 12s;   animation-delay: -7.5s; }
.fall-13 { left: 90%; width: 16px; animation-duration: 9.5s;  animation-delay: -2.5s; }
.fall-14 { left: 96%; width: 20px; animation-duration: 11.5s; animation-delay: -10s; }
.fall-2 .sway, .fall-5 .sway, .fall-9 .sway, .fall-12 .sway { animation-duration: 2.6s; animation-direction: alternate-reverse; }
.fall-3 .sway, .fall-7 .sway, .fall-11 .sway { animation-duration: 3.8s; }
.sky-halloween .fall svg { width: 140%; }
.sky-winter .fall, .sky-christmas .fall { animation-duration: 13s; }
@media (prefers-reduced-motion: reduce) {
  .fall, .sway { animation: none; }
  .fall { top: auto; bottom: 8px; opacity: .6; }
  .fall:nth-child(odd) { display: none; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .top-inner { padding: 8px 12px; gap: 8px; }
  .brand img { height: 34px; }
  .who-text { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--navy); margin-left: auto; }
  .who { margin-left: 0; }
  .mainnav { display: none; }
  .mainnav.open { display: block; }
  .mainnav-inner { flex-direction: column; padding: 4px 0 8px; }
  .mainnav a { border-bottom: 0; border-left: 4px solid transparent; padding: 12px 16px; }
  .mainnav a.active { border-left-color: var(--yellow); }
  .page { padding: 14px 16px 32px; gap: 16px; }
  h1 { font-size: 30px; }
  .banner { padding: 20px; min-height: 110px; }
  .banner h1 { font-size: 32px; }
  .card, .panel { padding: 16px; }
  .filters .field { flex: 1 1 100%; }
  .order-list li { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}

/* ---------- What each role can do ---------- */
.perm-columns { columns: 300px; column-gap: 20px; }
.perm-area { break-inside: avoid; margin: 0 0 20px; display: block; width: 100%; }
.perm-area legend { float: left; width: 100%; font-weight: 700; font-size: 17px; padding: 0 0 6px; margin-bottom: 4px; border-bottom: 2px solid var(--yellow); }
.perm-area .check { clear: both; }
.link-btn { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 14px; color: var(--navy); text-decoration: underline; cursor: pointer; min-height: 32px; }
.role-picker .field { min-width: 280px; }
tr.is-off td { color: var(--muted); }
.card h3 { margin-top: 4px; }

/* ---------- Records (customers, units, parts, suppliers) ---------- */
.record-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.record-head h1 { margin: 0; }
.record-head .sub { margin: 4px 0 0; color: var(--muted); }
.record-code { margin: 0 0 2px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--yellow); }
.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 16px; }
.table.rates input.money { width: 96px; min-height: 40px; padding: 6px 8px; text-align: right; }
.table.rates th[scope=row] { white-space: nowrap; }
.num-col { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fgas { margin-top: 8px; padding: 12px 14px; background: var(--blue-bg); color: var(--blue); border-radius: 10px; }
.find-form { display: flex; gap: 10px; align-items: center; }
.find-form input { flex: 1; }
.note-form { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.note-form textarea { flex: 1; }
.indent { margin-left: 32px; }
.table-title { padding: 14px 18px 4px; margin: 0; }
.discount-add, .role-ticks { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.role-ticks { border-left: 0; border-right: 0; border-bottom: 0; padding-left: 0; padding-right: 0; }
.role-ticks legend { font-weight: 600; }
select[form], input[form] { min-height: 40px; padding: 6px 8px; }
@media (max-width: 760px) {
  .find-form, .note-form { flex-direction: column; align-items: stretch; }
  .indent { margin-left: 0; }
}
.table tbody th { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); white-space: normal; font-weight: 600; vertical-align: middle; }
@media (max-width: 760px) { .table tbody th[scope=row] { width: 38%; } }
