/* ============================================================================
   Asset Lion - styling modelled on the Asset Tiger look & feel
   Palette: black top bar, white sidebar with yellow active highlight,
   green primary actions, coloured status pills, light-grey app background.
   ============================================================================ */
:root {
  --al-black: #1c1c1c;
  --al-yellow: #f5c518;
  --al-yellow-soft: #fdf3cf;
  --al-green: #1f9d55;
  --al-green-dark: #178045;
  --al-orange: #e8622c;
  --al-blue: #4a89dc;
  --al-bg: #eef1f4;
  --al-border: #e2e6ea;
  --al-text: #333;
  --al-muted: #7a8290;
  --al-link: #2f6fb0;
  --al-sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--al-text);
  background: var(--al-bg);
}
a { color: var(--al-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Top bar ---------------- */
.topbar {
  height: 48px; background: #fff; border-bottom: 1px solid var(--al-border);
  display: flex; align-items: center; position: fixed; top: 0; left: 0; right: 0; z-index: 30;
}
.topbar .brand {
  width: var(--al-sidebar-w); height: 100%; display: flex; align-items: center;
  gap: 8px; padding-left: 16px; background: var(--al-black); color: #fff;
  font-weight: 800; letter-spacing: .5px; font-size: 18px;
}
.topbar .brand .lion { color: var(--al-yellow); }
.topbar .top-menu { display: flex; gap: 22px; padding-left: 22px; }
.topbar .top-menu a { color: #555; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.topbar .top-right { margin-left: auto; display: flex; align-items: center; gap: 18px; padding-right: 18px; }
.topbar .top-right .who { font-weight: 700; color: #333; }
.topbar form.inline { margin: 0; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: fixed; top: 48px; bottom: 0; left: 0; width: var(--al-sidebar-w);
  background: #fff; border-right: 1px solid var(--al-border); overflow-y: auto; z-index: 20;
}
.sidebar .company {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--al-border);
}
.sidebar .company .logo {
  width: 40px; height: 40px; border-radius: 50%; background: #0a8; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  background: linear-gradient(135deg,#12b886,#0b7285);
}
.sidebar .company .cname { font-size: 12px; font-weight: 700; color: #444; line-height: 1.2; }
.sidebar nav { padding: 6px 0; }
.sidebar nav a.item, .sidebar nav .group > a {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; color: #444;
  font-weight: 600; border-left: 3px solid transparent;
}
.sidebar nav a.item:hover, .sidebar nav .group > a:hover { background: #f6f7f9; text-decoration: none; }
.sidebar nav a.item.active, .sidebar nav .group.active > a {
  background: var(--al-yellow); color: #222; border-left-color: var(--al-orange);
}
.sidebar nav .ico { width: 18px; text-align: center; color: var(--al-orange); }
.sidebar nav a.active .ico { color: #7a5a00; }
.sidebar nav .sub { display: none; padding: 2px 0 6px; background: #fafbfc; }
.sidebar nav .group.open .sub { display: block; }
.sidebar nav .sub a { display: block; padding: 7px 18px 7px 48px; color: #555; font-weight: 500; font-size: 13px; }
.sidebar nav .sub a:hover { background: #f0f2f5; text-decoration: none; }
.sidebar nav .sub a.active { color: var(--al-orange); font-weight: 700; }
.badge {
  margin-left: auto; background: #e03131; color: #fff; border-radius: 11px; font-size: 11px;
  padding: 1px 8px; font-weight: 700;
}
.badge.blue { background: var(--al-blue); }
.badge.grey { background: #adb5bd; }
.badge.purple { background: #9c36b5; }

/* ---------------- Main ---------------- */
.main { margin-left: var(--al-sidebar-w); margin-top: 48px; padding: 0 0 40px; }
.page-head {
  background: #f3f5f7; border-bottom: 1px solid var(--al-border); padding: 16px 26px;
  display: flex; align-items: center; gap: 10px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; color: #3a3f45; }
.page-head .sub { color: var(--al-muted); font-size: 13px; }
.page-head .ico { color: var(--al-orange); font-size: 18px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.container { padding: 22px 26px; }

/* ---------------- Cards / KPI ---------------- */
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: #fff; border: 1px solid var(--al-border); border-radius: 6px; padding: 16px;
  display: flex; align-items: center; gap: 14px; min-height: 78px;
}
.kpi .glyph {
  width: 46px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; flex: none;
}
.kpi .glyph.b1 { background: #4a89dc; } .kpi .glyph.b2 { background: #e9573f; }
.kpi .glyph.b3 { background: #37bc9b; } .kpi .glyph.b4 { background: #967adc; }
.kpi .meta { text-align: right; margin-left: auto; }
.kpi .meta .label { color: var(--al-muted); font-size: 12px; }
.kpi .meta .num { font-size: 26px; font-weight: 700; color: #333; line-height: 1.1; }
.kpi .meta .sub { color: var(--al-muted); font-size: 12px; }

.panel { background: #fff; border: 1px solid var(--al-border); border-radius: 6px; margin-bottom: 20px; }
.panel .panel-head { padding: 12px 16px; border-bottom: 1px solid var(--al-border); font-weight: 600; }
.panel .panel-body { padding: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px){ .two-col { grid-template-columns: 1fr; } .kpi-row { grid-template-columns: repeat(2,1fr);} }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--al-border); padding: 0 16px; background: #fff; flex-wrap: wrap; }
.tabs a { padding: 12px 14px; color: #555; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a:hover { text-decoration: none; color: #222; }
.tabs a.active { color: #222; border-bottom-color: var(--al-yellow); }

/* ---------------- Tables ---------------- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--al-border); text-align: left; vertical-align: top; }
table.grid th { background: #faf7ec; color: #6b6b6b; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
table.grid tbody tr:hover { background: #f7fafc; }
table.grid.detail th { width: 210px; background: #fbfbfc; text-transform: none; font-size: 13px; color: #555; }

/* ---------------- Status pills ---------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 3px; font-size: 12px; font-weight: 600; }
.st-available  { background: #e4f5ea; color: #1f7a45; }
.st-checkedout { background: #e1f0fb; color: #2f6fb0; }
.st-reserved   { background: #efe6fb; color: #7048b8; }
.st-repair     { background: #fff3e0; color: #c76a12; }
.st-broken     { background: #fde3e3; color: #c92a2a; }
.st-lost       { background: #f1f3f5; color: #495057; }
.st-disposed   { background: #eceff1; color: #78909c; }
.st-default    { background: #eef1f4; color: #555; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 4px;
  border: 1px solid var(--al-border); background: #fff; color: #333; font-weight: 600; cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: #f4f6f8; text-decoration: none; }
.btn.primary { background: var(--al-green); border-color: var(--al-green); color: #fff; }
.btn.primary:hover { background: var(--al-green-dark); }
.btn.yellow { background: var(--al-yellow); border-color: #e5b800; color: #3a2f00; }
.btn.danger { color: #c92a2a; border-color: #f0c2c2; }
.btn.danger:hover { background: #fff0f0; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Forms ---------------- */
.form-section { background: #fff; border: 1px solid var(--al-border); border-radius: 6px; margin-bottom: 18px; }
.form-section h3 { margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--al-border); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 30px; padding: 18px; }
.form-grid.one { grid-template-columns: 1fr; }
.field { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.field label { text-align: right; color: #555; font-weight: 600; font-size: 13px; }
.field label .req { color: #e03131; }
.field .control { display: flex; gap: 8px; align-items: center; }
.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=email], .field input[type=password], .field select, .field textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cdd3da; border-radius: 4px; font-size: 14px; font-family: inherit;
}
.field textarea { min-height: 70px; resize: vertical; }
.field .prefix { padding: 9px 10px; background: #f1f3f5; border: 1px solid #cdd3da; border-right: 0; border-radius: 4px 0 0 4px; }
.field .prefix + input { border-radius: 0 4px 4px 0; }
.form-actions { padding: 16px 18px; border-top: 1px solid var(--al-border); display: flex; gap: 10px; }
@media (max-width: 900px){ .form-grid { grid-template-columns: 1fr; } .field { grid-template-columns: 1fr; } .field label { text-align: left; } }

/* ---------------- Asset view header ---------------- */
.asset-hero { background: #fff; border: 1px solid var(--al-border); border-radius: 6px; padding: 18px; margin-bottom: 6px; }
.asset-hero .hero-top { display: flex; align-items: center; margin-bottom: 14px; }
.asset-hero .hero-top h2 { margin: 0; font-size: 16px; }
.asset-hero .hero-top .actions { margin-left: auto; display: flex; gap: 8px; position: relative; }
.asset-hero .hero-grid { display: grid; grid-template-columns: 230px 1fr 1fr; gap: 20px; }
.asset-hero .photo { width: 220px; height: 165px; border: 1px solid var(--al-border); border-radius: 4px; object-fit: cover; background: #f3f5f7; }
.asset-hero .photo.empty { display: flex; align-items: center; justify-content: center; color: #c0c6cc; }
@media (max-width: 1000px){ .asset-hero .hero-grid { grid-template-columns: 1fr; } }

/* dropdown menu (More Actions) */
.menu { position: relative; }
.menu-list {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); background: #fff;
  border: 1px solid var(--al-border); border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12);
  min-width: 190px; z-index: 40; padding: 6px 0;
}
.menu.open .menu-list { display: block; }
.menu-list a { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: #444; font-weight: 500; }
.menu-list a:hover { background: #f4f6f8; text-decoration: none; }
.menu-list .sep { height: 1px; background: var(--al-border); margin: 6px 0; }
.menu-list .ico { color: var(--al-orange); width: 16px; text-align: center; }

/* photo gallery */
.gallery { display: flex; flex-wrap: wrap; gap: 14px; }
.gallery .ph { border: 1px solid var(--al-border); border-radius: 4px; padding: 8px; width: 190px; position: relative; }
.gallery .ph img { width: 100%; height: 130px; object-fit: cover; border-radius: 3px; }
.gallery .ph .tag { position: absolute; top: 4px; left: 4px; background: var(--al-green); color: #fff; border-radius: 3px; font-size: 11px; padding: 1px 6px; }
.gallery .ph .row { display: flex; gap: 6px; margin-top: 8px; }

/* flash */
.flash { padding: 11px 16px; border-radius: 5px; margin: 16px 26px 0; font-weight: 600; }
.flash.success { background: #e6f5ec; color: #1f7a45; border: 1px solid #b7e2c6; }
.flash.error { background: #fdecec; color: #c92a2a; border: 1px solid #f2c2c2; }

/* pagination + toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--al-border); border-bottom: 0; border-radius: 6px 6px 0 0; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid #cdd3da; border-radius: 4px; }
.pager { display: flex; gap: 6px; align-items: center; padding: 12px 16px; background: #fff; border: 1px solid var(--al-border); border-top: 0; border-radius: 0 0 6px 6px; }
.pager a, .pager span { padding: 5px 11px; border: 1px solid var(--al-border); border-radius: 4px; color: #444; }
.pager .cur { background: var(--al-yellow); border-color: #e5b800; color: #3a2f00; font-weight: 700; }
.muted { color: var(--al-muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#1c1c1c,#2c2c2c); padding: 20px; }
.auth-card { background: #fff; border-radius: 10px; width: 100%; max-width: 400px; padding: 32px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.auth-card .brand { text-align: center; font-weight: 800; font-size: 26px; letter-spacing: .5px; margin-bottom: 4px; }
.auth-card .brand .lion { color: var(--al-orange); }
.auth-card .org { text-align: center; color: var(--al-muted); margin-bottom: 22px; font-size: 13px; }
.auth-card label { display: block; font-weight: 600; margin: 12px 0 5px; font-size: 13px; }
.auth-card input { width: 100%; padding: 11px 12px; border: 1px solid #cdd3da; border-radius: 5px; font-size: 15px; }
.auth-card .btn.primary { width: 100%; justify-content: center; margin-top: 18px; padding: 11px; font-size: 15px; }
.auth-card .hint { color: var(--al-muted); font-size: 12px; margin-top: 14px; text-align: center; }
.auth-card .qr { display: block; margin: 14px auto; width: 200px; height: 200px; }
.auth-card .secret { text-align: center; font-family: monospace; background: #f4f6f8; padding: 8px; border-radius: 5px; word-break: break-all; font-size: 13px; }
.flash-auth { padding: 10px 12px; border-radius: 5px; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.flash-auth.error { background: #fdecec; color: #c92a2a; }
.flash-auth.success { background: #e6f5ec; color: #1f7a45; }

/* simple bar chart */
.barchart { display: flex; align-items: flex-end; gap: 10px; height: 240px; padding: 10px 4px 0; }
.barchart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.barchart .bar .col { width: 60%; background: #a9cdf0; border-radius: 3px 3px 0 0; min-height: 2px; }
.barchart .bar .cap { font-size: 10px; color: var(--al-muted); margin-top: 6px; text-align: center; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 90px; }

/* ---------------------------------------------------------------------------
   Utility classes (migrated from inline style attributes so the CSP can drop
   style-src 'unsafe-inline'). Keep declarations here, not inline in markup.
   --------------------------------------------------------------------------- */
.mt-0{margin-top:0}
.mt-16{margin-top:16px}
.mt-22{margin-top:22px}
.mb-0{margin-bottom:0}
.m-0{margin:0}
.ml-auto{margin-left:auto}
.ml-8{margin-left:8px}
.sec-h{margin:18px 0 8px}
.sec-h-first{margin:0 0 8px}
.self-center{align-self:center}
.d-inline{display:inline}
.hidden{display:none}
.col-span{grid-column:1 / -1}
.gtc-1{grid-template-columns:1fr}
.w-auto{width:auto}
.w-36{width:36px}
.w-52{width:52px}
.w-120{width:120px}
.w-100{width:100%}
.minw-220{min-width:220px}
.minw-240{min-width:240px}
.minw-260{min-width:260px}
.minw-280{min-width:280px}
.minw-300{min-width:300px}
.maxw-520{max-width:520px}
.mh-110{min-height:110px}
.fw-500{font-weight:500}
.fs-10{font-size:10px}
.ta-left{text-align:left}
.ta-center{text-align:center}
.jc-center{justify-content:center}
.inp{padding:8px 10px;border:1px solid #cdd3da;border-radius:4px}
.inp-sm{padding:4px;border:1px solid #cdd3da;border-radius:4px}
.form-row{display:flex;gap:10px;margin-bottom:16px}
.wrap{flex-wrap:wrap}
.flex-wrap-10{display:flex;gap:10px;flex-wrap:wrap}
.flex-wrap-center{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.flex-g4{display:flex;gap:4px}
.hdr-flex{display:flex;align-items:center;margin-bottom:12px}
.flex-lbl{display:flex;align-items:center;gap:8px;font-weight:500;margin-top:12px}
.notes-box{white-space:pre-wrap;background:#fafbfc;border:1px solid var(--al-border);border-radius:5px;padding:12px}
.upload-box{background:#fafbfc;border:1px solid var(--al-border);border-radius:5px;padding:12px;margin-bottom:16px}
.plain-link{color:inherit;text-decoration:none}
.panel-attached{border-top:0;border-radius:0 0 6px 6px}
.big-icon{font-size:48px;margin:10px 0;color:#e8622c}
.thumb{width:40px;height:40px;object-fit:cover;border-radius:4px;border:1px solid var(--al-border);display:block}
.thumb-empty{width:40px;height:40px;border-radius:4px;border:1px solid var(--al-border);background:#f2f4f6;display:block}

.jc-between{justify-content:space-between}
