[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: #f3f5f9; color: #1f2937; font-size: 15px; }
a { color: #2563eb; text-decoration: none; }
.container { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; background: #1e3a8a; color: #fff; padding: 12px 24px; }
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.topbar a { color: #dbeafe; padding: 6px 12px; border-radius: 6px; }
.topbar a:hover, .topbar a.active { background: rgba(255,255,255,.15); color: #fff; }
.topbar .who { opacity: .8; margin: 0 8px; }
.card { background: #fff; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card h1, .card h2 { margin-top: 0; }
.auth { max-width: 400px; margin: 60px auto; }
label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; margin-top: 4px; }
label.inline input, .filters input, .filters select { width: auto; margin-top: 0; }
input:focus, select:focus { outline: 2px solid #93c5fd; border-color: #2563eb; }
.btn { display: inline-block; background: #2563eb; color: #fff; border: 0; padding: 9px 16px; border-radius: 6px; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { background: #1d4ed8; }
.btn.ghost { background: #eef2ff; color: #1e40af; }
.btn.danger { background: #dc2626; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.muted { color: #6b7280; }
.center { text-align: center; }
.red { color: #dc2626; font-weight: 600; }
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { padding: 10px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: middle; }
th { background: #f8fafc; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: #475569; }
table.rows td { border: 0; padding: 4px 6px 4px 0; }
table.rows input { margin: 0; }
tr.overdue { background: #fff7ed; }
.actions form, form.inline { display: inline-flex; gap: 4px; align-items: center; }
.actions { white-space: nowrap; }
input.tiny { width: 150px; padding: 5px 8px; margin: 0; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.borrowed { background: #dbeafe; color: #1e40af; }
.badge.returned { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 10px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); color: inherit; }
.stat b { display: block; font-size: 28px; color: #1e3a8a; }
.stat.warn b { color: #dc2626; }
.stat span { color: #6b7280; font-size: 14px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.highlight { background: #eff6ff; border-left: 4px solid #2563eb; padding: 12px 16px; border-radius: 6px; margin: 12px 0; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; padding: 0; }
  .container { margin: 0; max-width: none; }
}

/* v2 additions */
h3.sub { font-size: 15px; margin: 18px 0 8px; color: #1e3a8a; }
.small { font-size: 13px; }
.green { color: #15803d; font-weight: 600; }
.row-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.row-line input { margin: 0; }
select:disabled { background: #f1f5f9; color: #94a3b8; }
textarea { resize: vertical; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; background: #f0fdf4; padding: 10px 12px; border-radius: 6px; }
label.check input { width: auto; margin: 3px 0 0; }
.badge.return-requested { background: #ede9fe; color: #5b21b6; }
.badge.transferred { background: #e0f2fe; color: #075985; }
tr.inactive td { opacity: .55; }
dialog { border: 0; border-radius: 12px; padding: 24px; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog h3 { margin-top: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* v3 additions */
.btn.warn { background: #f59e0b; color: #fff; }
.btn.warn:hover { background: #d97706; }
.card.attention { border-left: 4px solid #f59e0b; }
.transfer-box { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; margin-top: 12px; }
.accept-form label { margin-bottom: 8px; }
@media (max-width: 760px) { .transfer-box { grid-template-columns: 1fr; } }

/* v4: calendar & notifications */
.cal-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 960px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav h2 { margin: 0 6px; min-width: 170px; text-align: center; }
.cal { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; margin-top: 12px; }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { background: #f8fafc; padding: 8px; font-size: 12px; font-weight: 700; color: #475569; text-align: center; text-transform: uppercase; }
.cal-day { position: relative; min-height: 96px; border-top: 1px solid #e5e7eb; border-left: 1px solid #e5e7eb; padding: 4px 5px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-day:nth-child(7n+1) { border-left: 0; }
.cal-day.empty { background: #fafafa; }
.cal-day.past { background: #fbfbfc; }
.cal-day.past .chip, .cal-day.past .avail-txt { opacity: .6; }
.cal-day .num { font-size: 12px; font-weight: 700; color: #64748b; }
.cal-day.today .num { background: #2563eb; color: #fff; border-radius: 999px; width: 22px; height: 22px; display: inline-grid; place-items: center; }
.cal-day.selected { outline: 2px solid #2563eb; outline-offset: -2px; z-index: 1; }
.cal-link { position: absolute; inset: 0; z-index: 2; }
.cal-day:has(.cal-link):hover { background: #eff6ff; cursor: pointer; }
.chip { display: block; font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.legend .chip { display: inline-block; }
.chip.pick { background: #dbeafe; color: #1e40af; }
.chip.pending { background: #fef3c7; color: #92400e; }
.chip.due { background: #ede9fe; color: #5b21b6; }
.chip.late { background: #fee2e2; color: #991b1b; }
.chip.done { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
.more { font-size: 11px; color: #64748b; }
.cal-day.avail-full { background: #f0fdf4; } .chip.avail-full { background: #dcfce7; color: #166534; }
.cal-day.avail-some { background: #fffbeb; } .chip.avail-some { background: #fef3c7; color: #92400e; }
.cal-day.avail-none { background: #fef2f2; } .chip.avail-none { background: #fee2e2; color: #991b1b; }
.avail-txt { font-size: 12px; font-weight: 600; margin-top: auto; }
.cal-day.avail-full .avail-txt { color: #166534; } .cal-day.avail-some .avail-txt { color: #92400e; } .cal-day.avail-none .avail-txt { color: #991b1b; }
.ev { border-left: 3px solid #2563eb; padding: 6px 10px; margin-bottom: 8px; background: #f8fafc; border-radius: 4px; }
.bell { position: relative; font-size: 17px; }
.bell-count { position: absolute; top: -2px; right: 0; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.notif { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 6px; margin-bottom: 6px; color: inherit; background: #f8fafc; border-left: 4px solid #94a3b8; }
.notif small { color: #6b7280; white-space: nowrap; }
.notif.info { border-color: #2563eb; } .notif.warn { border-color: #f59e0b; background: #fffbeb; } .notif.danger { border-color: #dc2626; background: #fef2f2; }
.notif.unread { border-color: #2563eb; background: #eff6ff; font-weight: 600; } .notif.read { opacity: .75; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #1e3a8a; color: #fff; padding: 12px 18px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 50; }
.toast a { color: #bfdbfe; font-weight: 700; margin-left: 6px; }
@media (max-width: 640px) { .cal-day { min-height: 64px; } .chip { font-size: 10px; padding: 1px 3px; } }

/* v5: bulk actions */
th.cb, td.cb { width: 34px; text-align: center; }
td.cb input, th.cb input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #1e3a8a; color: #fff; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.bulk-bar .btn.ghost { background: rgba(255,255,255,.15); color: #fff; }
.linklike { background: none; border: 0; color: #2563eb; font: inherit; cursor: pointer; padding: 0; text-decoration: underline dotted; }
.dlg-list { margin: 8px 0 14px; padding-left: 20px; max-height: 180px; overflow: auto; }
.ret-items, #damageRows { max-height: 260px; overflow: auto; margin-bottom: 12px; }
.ret-item { border: 1px solid #e5e7eb; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; }
.ret-item label.inline { align-items: flex-start; }
.ret-item label.inline input { width: auto; margin-top: 3px; }
.ret-item .dmg { margin-top: 6px; }
.grid2.top { margin-top: 0; align-items: start; }

/* v6 */
.bulk-bar .btn.ghost-light { background: #fff; color: #1e3a8a; }
.dmg-rows { max-height: 260px; overflow: auto; margin-bottom: 12px; }
.day-items { list-style: none; padding: 0; margin: 8px 0 14px; }
.day-items li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; margin-bottom: 4px; background: #f0fdf4; }
.day-items li.some { background: #fffbeb; } .day-items li.none { background: #fef2f2; color: #991b1b; }
.day-items li b.n { white-space: nowrap; }
.cal-day .avail-sub { font-size: 11px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* v7: grouped nav + repair module */
.menu { position: relative; }
.menu > button { background: none; border: 0; color: #dbeafe; font: inherit; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.menu.active > button, .menu:hover > button, .menu:focus-within > button { background: rgba(255,255,255,.15); color: #fff; }
.menu .sub { display: none; position: absolute; top: 100%; left: 0; min-width: 190px; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; z-index: 60; }
.menu:hover .sub, .menu:focus-within .sub { display: block; }
.menu .sub a { display: block; color: #1f2937; padding: 8px 12px; }
.menu .sub a:hover, .menu .sub a.active { background: #eff6ff; color: #1e40af; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.grid2.tight { gap: 10px; margin-top: 0; }
.tracker { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.tracker .step { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; font-weight: 600; }
.tracker .step.done { background: #dcfce7; color: #166534; }
.tracker .step.current { background: #2563eb; color: #fff; }
.tracker .step.cancelled { background: #fee2e2; color: #991b1b; }
.repair-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid #dbeafe; }
.timeline li { position: relative; padding: 4px 0 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 8px; width: 13px; height: 13px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; }
.badge.pending-delivery { background: #fef3c7; color: #92400e; }
.badge.received { background: #e0f2fe; color: #075985; }
.badge.in-repair { background: #ede9fe; color: #5b21b6; }
.badge.repaired { background: #dbeafe; color: #1e40af; }
.badge.out-for-delivery { background: #ffedd5; color: #9a3412; }
.badge.completed { background: #dcfce7; color: #166534; }
.badge.cancelled { background: #f1f5f9; color: #64748b; }
@media (max-width: 760px) { .menu .sub { position: static; box-shadow: none; } }

/* ===== v8: maroon & black sidebar ===== */
:root { --maroon: #800020; --maroon-dark: #5c0017; --maroon-light: #a3123a; --black: #0e0e10; --side-w: 260px; }
body.with-sidebar .container { margin-left: calc(var(--side-w) + 24px); margin-right: 24px; max-width: none; }
@media (min-width: 1500px) { body.with-sidebar .container { max-width: 1200px; margin-left: calc(var(--side-w) + (100vw - var(--side-w) - 1200px) / 2); } }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 80; display: flex; flex-direction: column; overflow-y: auto;
  background: linear-gradient(180deg, var(--maroon) 0%, var(--maroon-dark) 22%, #1a0a0d 55%, var(--black) 100%); color: #fff;
  box-shadow: 2px 0 18px rgba(0,0,0,.25); }
.sidebar a { color: #fff; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.side-brand .logo { width: 42px; height: 42px; border-radius: 10px; background: #fff; color: var(--maroon); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
.side-brand b { display: block; font-size: 16px; letter-spacing: .2px; }
.side-brand small { color: rgba(255,255,255,.7); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; margin: 0 12px 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.08); }
.side-user:hover, .side-user.active { background: rgba(0,0,0,.4); }
.side-user .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--maroon); font-weight: 800; display: grid; place-items: center; }
.side-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.side-user small { color: rgba(255,255,255,.7); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 20px; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.55); padding: 14px 10px 6px; }
.side-link, .side-group > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: #fff; font-weight: 500; cursor: pointer; position: relative; }
.side-link:hover, .side-group > summary:hover { background: rgba(255,255,255,.08); }
.side-link.active { background: var(--maroon); box-shadow: inset 3px 0 0 #fff; font-weight: 700; }
.side-link .ic, .side-group .ic { width: 20px; text-align: center; flex: none; }
.side-group > summary { list-style: none; font-weight: 700; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary .chev { margin-left: auto; transition: transform .2s; font-size: 12px; opacity: .8; }
.side-group[open] > summary .chev { transform: rotate(180deg); }
.side-group.current > summary { background: rgba(0,0,0,.3); }
.side-sub { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px 18px; padding-left: 10px; border-left: 2px solid rgba(255,255,255,.18); }
.side-sub .side-link { padding: 8px 12px; font-size: 14px; }
.side-link .bell-count { position: static; margin-left: auto; background: #fff; color: var(--maroon); }
.side-link.logout { margin-top: 8px; color: rgba(255,255,255,.85); }
.side-link.logout:hover { background: rgba(163,18,58,.45); }
.mobilebar, .side-backdrop { display: none; }
@media (max-width: 900px) {
  body.with-sidebar .container { margin: 16px auto; padding: 0 16px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; }
  .mobilebar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 60; padding: 10px 16px; color: #fff;
    background: linear-gradient(90deg, var(--maroon), var(--black)); }
  .mobilebar .hamburger { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
  .mobilebar .brand-sm { font-weight: 700; flex: 1; }
  .mobilebar .bell { color: #fff; }
}
@media print { .sidebar, .mobilebar { display: none !important; } body.with-sidebar .container { margin: 0; } }

/* v9: inventory tags & tabs */
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.tag-projects { background: #e0e7ff; color: #3730a3; }
.tag-robots { background: #cffafe; color: #155e75; }
.tag-parts-components { background: #fef3c7; color: #92400e; }
.tag-others { background: #f1f5f9; color: #475569; }
.tag-return { background: #fde2e7; color: #800020; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb; }
.tabs a { padding: 6px 12px; border-radius: 999px; background: #f1f5f9; color: #334155; font-weight: 600; font-size: 14px; }
.tabs a small { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 6px; margin-left: 2px; }
.tabs a.active { background: var(--maroon, #800020); color: #fff; }
.tabs a.warn:not(.active) { background: #fee2e2; color: #991b1b; }
.tab-sep { font-size: 12px; color: #64748b; margin-left: 8px; }
.side-mini { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.5); padding: 6px 12px 2px; }

/* v10: pager */
.pager { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 12px; }
.pager a, .pager span { min-width: 34px; text-align: center; padding: 6px 10px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.pager a { background: #f1f5f9; color: #334155; }
.pager a:hover { background: #e2e8f0; }
.pager .cur { background: var(--maroon, #800020); color: #fff; }
.pager .off { color: #cbd5e1; }
.pager .gap { color: #94a3b8; }
.inv-table td:nth-child(4) { min-width: 210px; line-height: 1.5; }
.inv-table td.actions { white-space: normal; }
.inv-table td.actions:last-child { min-width: 150px; }
.inv-table .act-wrap { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.inv-table td.actions form { display: inline-flex; flex-wrap: wrap; gap: 4px; }
