/* Equipment register – plain CSS, no framework. */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --line: #e2e5ea;
  --accent: #1f4e8c;
  --accent-text: #ffffff;
  --warn-bg: #fff4e0;
  --warn: #9a5b00;
  --error-bg: #fdecec;
  --error: #b42318;
  --ok-bg: #e9f7ef;
  --ok: #18794e;
  --radius: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h2.inline { display: inline; }
code { background: #eef0f3; padding: 0 .25em; border-radius: 3px; }

.offline-banner { background: #f5a524; color: #1d2330; text-align: center; font-weight: 600; padding: .3rem; font-size: .85rem; }
.offline-banner a { color: #1d2330; }
.test-banner { background: #b42318; color: #fff; text-align: center; font-weight: 600; padding: .3rem; font-size: .85rem; }
header.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; background: #1d2330; color: #fff; padding: .6rem 1rem; }
header.top a { color: #dfe6f3; text-decoration: none; }
header.top .brand { font-weight: 700; color: #fff; }
header.top nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; flex: 1; }
header.top nav a.on, header.top nav a:hover { color: #fff; text-decoration: underline; }
header.top .me { font-size: .9rem; }
header.top .me .muted { color: #9aa4b5; }
header.top .me button.link { color: #dfe6f3; }
.badge { background: #f5a524; color: #1d2330; border-radius: 9px; padding: 0 .45em; font-size: .8em; font-weight: 700; }

main { max-width: 1250px; margin: 0 auto; padding: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.narrow { max-width: 440px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.grid2 > .panel { margin-bottom: 0; }
.grid2 + * { margin-top: 1rem; }
@media (max-width: 800px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { margin: 0; font-size: .9rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.15rem; margin: .2rem 0 .6rem; }
.nowrap { white-space: nowrap; }

/* forms */
label { display: block; margin: 0 0 .7rem; font-weight: 500; font-size: .92rem; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .45rem .55rem; border: 1px solid #c9ced6; border-radius: 6px; font: inherit; background: #fff; color: var(--text); }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
label.check input { width: auto; margin: 0; display: inline; }
button, .button { display: inline-block; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: #e7eaf0; color: var(--text); }
button.danger { background: var(--error); }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; text-decoration: underline; }
.danger-text { color: var(--error) !important; }
form.inline { display: inline; }
.form-grid fieldset { border: 0; border-top: 1px solid var(--line); margin: 0 0 .5rem; padding: .8rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.form-grid fieldset:first-of-type { border-top: 0; padding-top: 0; }
.form-grid legend { font-weight: 700; padding: 0; margin-bottom: .5rem; float: left; width: 100%; grid-column: 1 / -1; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .review-box { background: var(--warn-bg); border-radius: 6px; padding: .8rem; }
.form-actions { display: flex; gap: 1rem; align-items: center; padding-top: .5rem; }
@media (max-width: 800px) { .form-grid fieldset { grid-template-columns: 1fr; } }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.filters input[type=search] { width: 260px; margin: 0; }
.filters select { width: auto; margin: 0; }
.filters label.check { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.list th, table.list td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); background: #fafbfc; }
table.list th a { color: inherit; text-decoration: none; }
table.list tr.review td { background: #fffaf0; }
table.list tr.inactive td { color: var(--muted); }
table.compact th, table.compact td { padding: .3rem .45rem; font-size: .9rem; }
.num { text-align: right !important; white-space: nowrap; }
.thumbcell { width: 56px; }

/* bits */
.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .8rem; background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--error-bg); color: var(--error); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.pill { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 9px; background: #e7eaf0; color: var(--muted); margin-left: .3rem; vertical-align: middle; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.tag { font-family: ui-monospace, Menlo, monospace; background: #eef0f3; padding: .1rem .4rem; border-radius: 4px; margin-right: .4rem; }
.status { font-size: .85rem; padding: .1rem .45rem; border-radius: 9px; background: #eef0f3; white-space: nowrap; }
.s-in_use { background: var(--ok-bg); color: var(--ok); }
.s-faulty, .s-missing { background: var(--error-bg); color: var(--error); }
.s-to_sell, .s-unknown { background: var(--warn-bg); color: var(--warn); }
.s-sold, .s-written_off { background: #eceef1; color: var(--muted); }
.ok { color: var(--ok); font-weight: 700; }
.bad { color: var(--error); font-weight: 700; }

dl.details { display: grid; grid-template-columns: 11rem 1fr; gap: .35rem 1rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) { dl.details { grid-template-columns: 1fr; } dl.details dd { margin-bottom: .4rem; } }

img.thumb { width: 160px; height: 160px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
img.thumb-sm { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.gallery { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: .8rem; }
.gallery figure { margin: 0; }
.gallery figcaption { display: flex; gap: .6rem; justify-content: space-between; padding-top: .25rem; }
.upload { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.upload input[type=file] { width: auto; margin: 0; border: 0; padding: 0; }
details summary { cursor: pointer; }
details.move { margin: .5rem 0 1rem; padding: .6rem .8rem; background: #f7f8fa; border-radius: 6px; }
details.move form { margin-top: .6rem; }
ul.files, ul.plain { list-style: none; padding: 0; margin: 0 0 .8rem; }
ul.files li, ul.plain li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.fileicon { display: inline-block; width: 48px; height: 48px; line-height: 48px; text-align: center; background: #b42318; color: #fff; font-weight: 700; border-radius: 4px; font-size: .8rem; }
ul.activity { padding-left: 1rem; }
.linkbox { border-color: var(--accent); }
.copyrow { display: flex; gap: .5rem; }
.copyrow input { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
pre.log { background: #1d2330; color: #dfe6f3; padding: .8rem; border-radius: 6px; overflow-x: auto; font-size: .8rem; max-height: 420px; }

/* password Show / Hide */
.pw-wrap { position: relative; display: block; margin-top: .25rem; }
.pw-wrap input { margin-top: 0; padding-right: 4.2rem; }
.pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); background: #e7eaf0; color: var(--text); font-size: .8rem; font-weight: 600; padding: .25rem .6rem; }

/* phones – kept last so it overrides the rules above */
@media (max-width: 700px) {
  header.top { flex-direction: column; align-items: flex-start; }
  header.top nav { flex: none; width: 100%; }
  main { padding: .75rem; }
  .filters input[type=search], .filters select { width: 100%; }
}

/* System page switches */
.switch-row { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: flex-start; justify-content: space-between; padding: .7rem 0; border-top: 1px solid var(--line); }
.switch-row:first-of-type { border-top: 0; }
.switch-row > div { flex: 1 1 280px; }
.switch-row p { margin: .3rem 0 0; }
.switch-form { flex: 1 1 280px; max-width: 420px; }
.switch-form textarea { width: 100%; }

/* Admin dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.stat { display: flex; flex-direction: column; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--text); }
.stat:hover { border-color: var(--accent); }
.stat-n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-l { font-size: .85rem; color: var(--muted); }
.stat.has { background: var(--warn-bg); border-color: #f1d9a8; }
.stat.has .stat-n { color: var(--warn); }
.stat.zero .stat-n { color: var(--muted); }
td.barcell, th.barcell { width: 35%; }
.bar { display: block; height: .7rem; margin-top: .3rem; background: var(--accent); border-radius: 3px; min-width: 2px; }
[hidden] { display: none !important; }
