:root {
  --green: #6aa84f;
  --green-dark: #4b7a37;
  --green-light: #e6f4dc;
  --gray: #6b7280;
  --gray-light: #9ca3af;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e4e6eb;
  --border-strong: #d1d5db;
  --text: #172b4d;
  --text-mute: #5e6c84;
  --danger: #de350b;
  --warn: #ff8b00;
  --info: #0052cc;
  --sidebar-bg: #172b4d;
  --sidebar-bg-2: #1d3557;
  --sidebar-text: #dfe1e6;
  --sidebar-mute: #8993a4;
  --sidebar-hover: #253858;
  --sidebar-active: #0052cc;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; height:100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { color: var(--text); margin: 0 0 16px; font-size: 22px; font-weight:600; }
h2 { font-size: 16px; font-weight: 600; color:var(--text); margin: 0 0 10px; }
h3 { font-size: 14px; font-weight: 600; color:var(--text); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .5px; color:var(--text-mute); }

/* -------- App layout: fixed sidebar + offset main -------- */
body.app { min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: fixed; left:0; top:0; bottom:0; width:230px;
  z-index: 10;
}
body.app .main { margin-left: 230px; }
.side-brand { display:flex; align-items:center; gap:10px; padding:16px 18px; border-bottom:1px solid rgba(255,255,255,.08); }
.side-logo { height:38px; width:auto; background:#fff; padding:4px; border-radius:6px; }
.side-app { font-size:16px; font-weight:700; color:#fff; line-height:1; }
.side-tag { font-size:10px; color:var(--sidebar-mute); text-transform:uppercase; letter-spacing:.5px; margin-top:3px; }

.side-nav { flex:1; padding:12px 8px; overflow-y:auto; }
.side-section { font-size:10px; color:var(--sidebar-mute); text-transform:uppercase; letter-spacing:1px; padding:14px 10px 6px; font-weight:700; }
.side-nav a {
  display:flex; align-items:center; gap:10px;
  padding: 9px 12px; margin:1px 0; border-radius:6px;
  color: var(--sidebar-text); font-size:13.5px; font-weight:500;
}
.side-nav a:hover { background: var(--sidebar-hover); color:#fff; text-decoration:none; }
.side-nav a.accent { background: var(--green); color:#fff; margin-top:4px; }
.side-nav a.accent:hover { background: var(--green-dark); }
.side-nav .ic { width:18px; display:inline-block; text-align:center; opacity:.85; font-size:14px; }

.side-user { display:flex; flex-direction:column; gap:10px; padding:12px 14px; border-top:1px solid rgba(255,255,255,.08); }
.side-user-top { display:flex; align-items:flex-start; gap:10px; width:100%; }
.side-user-logout { width:100%; }
.side-user-logout .logout-btn { width:100%; padding:7px 12px; }
.avatar { width:34px; height:34px; border-radius:50%; background:var(--green); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:600; }
.side-user-info { flex:1; min-width:0; }
.side-user-name { color:#fff; font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.side-user-role { font-size:11px; color:var(--sidebar-mute); line-height:1.3; word-wrap:break-word; }
.side-user-dept { font-size:10.5px; color:var(--sidebar-mute); line-height:1.3; margin-top:1px; opacity:.8; word-wrap:break-word; }
.icon-btn { background:transparent; color:var(--sidebar-text); border:1px solid rgba(255,255,255,.15); border-radius:5px; padding:4px 9px; cursor:pointer; font-size:15px; }
.icon-btn:hover { background:var(--sidebar-hover); color:#fff; }
.logout-btn { background:transparent; color:var(--sidebar-text); border:1px solid rgba(255,255,255,.2); border-radius:5px; padding:5px 12px; cursor:pointer; font-size:12px; font-weight:600; letter-spacing:.3px; }
.logout-btn:hover { background:#de350b; border-color:#de350b; color:#fff; }

.main { padding: 22px 28px 40px; min-width: 0; }
.public-main { padding: 0; }

/* -------- Flash -------- */
.flash { padding:10px 14px; border-radius:6px; margin-bottom:16px; font-size:13px; }
.flash.success { background:#e3fcef; color:#006644; border:1px solid #abf5d1; }
.flash.error   { background:#ffebe6; color:#bf2600; border:1px solid #ffbdad; }

/* -------- Forms -------- */
.form-card { background:var(--card); border:1px solid var(--border); border-radius:8px; padding:20px 24px; margin-bottom:20px; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.form-card label, .grid-form label { display:block; margin-bottom:12px; font-weight:500; font-size:12.5px; color:var(--text-mute); }
input, select, textarea {
  width:100%; padding:8px 10px; font:inherit; font-size:13px;
  border:1px solid var(--border-strong); border-radius:5px; background:#fafbfc; margin-top:4px;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { background:#fff; border-color: var(--info); outline: 2px solid rgba(0,82,204,.15); }
textarea { resize:vertical; font-family: inherit; }
button, .btn {
  display:inline-block; padding:7px 14px; border-radius:5px; border:1px solid var(--border-strong);
  background:#f4f5f7; cursor:pointer; font:inherit; font-size:13px; color:var(--text); font-weight:500;
}
button:hover, .btn:hover { background:#ebecf0; text-decoration:none; }
button.primary, .btn.primary { background:var(--info); color:#fff; border-color:var(--info); }
button.primary:hover, .btn.primary:hover { background:#0747a6; border-color:#0747a6; color:#fff; }
button.danger, .btn.danger { color:#fff; background:var(--danger); border-color:var(--danger); }
button.danger:hover, .btn.danger:hover { background:#bf2600; }
.btn.small { padding:4px 9px; font-size:12px; }
.wide { width:100%; }
.row { display:flex; gap:10px; align-items:center; margin-top:10px; flex-wrap:wrap; }
.inline { display:inline; }
.link { background:none; border:none; color:var(--info); cursor:pointer; font: inherit; padding:0; }

/* -------- Cards / Stats -------- */
.cards { margin-bottom: 20px; }
.stat-row { display:grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap:14px; }
.stat { background:#fff; border:1px solid var(--border); border-radius:8px; padding:16px; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.stat .n { font-size:28px; font-weight:700; line-height:1; margin-bottom:4px; }
.stat > div:nth-child(2) { font-size:12px; color:var(--text-mute); text-transform:uppercase; letter-spacing:.5px; font-weight:600; }
.stat.open .n { color:var(--info); }
.stat.prog .n { color:var(--warn); }
.stat.done .n { color:var(--green-dark); }
.stat.info .n { color:var(--info); }
.stat.danger .n { color:var(--danger); }
.stat-link { display:inline-block; font-size:11px; margin-top:8px; color:var(--info); font-weight:600; text-transform:uppercase; }

/* -------- Tables -------- */
.grid { width:100%; border-collapse:collapse; background:#fff; border:1px solid var(--border); border-radius:6px; overflow:hidden; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.grid th, .grid td { padding:9px 12px; border-bottom:1px solid var(--border); text-align:left; font-size:13px; vertical-align:top; }
.grid th { background:#fafbfc; color:var(--text-mute); font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.4px; }
.grid tr:last-child td { border-bottom:none; }
.grid tr:hover td { background: #fafbfc; }
.grid td.wrap { max-width:360px; white-space:pre-wrap; }
.empty { text-align:center; color:var(--gray); padding:30px; font-size:13px; }
.nowrap { white-space:nowrap; }
.mono { font-family: Consolas, Menlo, monospace; font-size:12px; }
.small-text { font-size:12px; }
.muted { color:var(--gray); font-size:12px; font-weight:normal; }

/* -------- Priority / Status badges -------- */
.pri { padding:2px 8px; border-radius:3px; font-size:11px; font-weight:700; color:#fff; text-transform:uppercase; letter-spacing:.3px; display:inline-block; }
.p-low { background:#8ab96b; }
.p-medium { background:#ffab00; color:#222; }
.p-high { background:#ff5630; }
.p-critical { background:#de350b; }

.st { padding:2px 8px; border-radius:3px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.3px; display:inline-block; }
.s-open { background:#deebff; color:#0747a6; }
.s-inprogress { background:#fff0b3; color:#974f0c; }
.s-pendinguser { background:#fff0b3; color:#7a5c0b; }
.s-pendingvendor { background:#eae6ff; color:#403294; }
.s-resolved { background:#e3fcef; color:#006644; }
.s-closed { background:#dfe1e6; color:#42526e; }
.s-completed { background:#e3fcef; color:#006644; }
.s-active { background:#e3fcef; color:#006644; }
.s-assigned { background:#e3fcef; color:#006644; }
.s-inrepair { background:#fff0b3; color:#974f0c; }
.s-instorage { background:#deebff; color:#0747a6; }
.s-idle { background:#fffae6; color:#7a5c0b; }
.s-moved { background:#eae6ff; color:#403294; }
.s-lost { background:#ffebe6; color:#bf2600; }
.s-scrapped { background:#ffebe6; color:#bf2600; }
.s-disposed { background:#ebecf0; color:#42526e; }
.s-retired { background:#ebecf0; color:#42526e; }

.c-emailaccess { background:#eae6ff; color:#403294; }
.c-useraccess { background:#ffebe6; color:#bf2600; }
.c-license { background:#deebff; color:#0747a6; }
.c-assetmanagement { background:#e3fcef; color:#006644; }
.c-generalsupport { background:#fff0b3; color:#974f0c; }

/* -------- Filters bar -------- */
.filters { display:flex; gap:10px; margin-bottom:14px; align-items:center; flex-wrap:wrap; background:#fff; padding:12px 14px; border:1px solid var(--border); border-radius:6px; }
.filters select, .filters input { width:auto; min-width:150px; margin-top:0; }

.list-head { display:grid; grid-template-columns: 1fr auto; gap:12px 16px; margin:18px 0 10px; align-items:center; }
.list-head h3 { margin:0; text-transform:none; letter-spacing:0; font-size:15px; color:var(--text); }
.list-head .search-form { grid-column: 1 / 2; display:flex; gap:8px; align-items:center; }
.list-head .search-form input { min-width:260px; margin-top:0; flex:1; max-width:400px; }
.list-head .actions-bar { grid-column: 1 / -1; display:flex; gap:8px; align-items:center; flex-wrap:wrap; padding:10px 12px; background:#fff; border:1px solid var(--border); border-radius:6px; }
.list-head .actions-bar form { display:flex; gap:6px; align-items:center; margin:0; }
.list-head .actions-bar input[type=file] { width:220px; margin-top:0; padding:5px 8px; font-size:12px; }
.list-head .actions-bar .spacer { flex:1; }
.list-head .actions-bar .label { font-size:11px; color:var(--text-mute); text-transform:uppercase; letter-spacing:.4px; font-weight:600; margin-right:4px; }

.grid-form { display:grid; grid-template-columns:repeat(4,1fr); gap:10px 18px; }
.grid-form .full { grid-column:1 / -1; }
@media (max-width: 900px) { .grid-form { grid-template-columns:repeat(2,1fr); } }

/* Inline expandable forms inside table rows */
.inline-form { background:#fff; border:1px solid var(--border); border-radius:8px; padding:16px; margin:4px; }
.inline-form .inline-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px 18px; }
.inline-form .full { grid-column:1 / -1; }
.inline-form label { display:block; font-weight:500; font-size:12.5px; color:var(--text-mute); margin:0; }
.inline-form input, .inline-form select, .inline-form textarea { width:100%; min-height:34px; margin-top:4px; }
.inline-form h4 { margin:0 0 12px; font-size:14px; color:var(--text); }
.inline-form .inline-actions { margin-top:12px; display:flex; gap:8px; }

/* -------- Ticket detail -------- */
.back { display:inline-block; margin-bottom:6px; color:var(--text-mute); font-size:12px; }
.detail-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; background:#fff; padding:16px; border:1px solid var(--border); border-radius:8px; margin-bottom:16px; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.detail-grid > div { font-size:13px; color:var(--text-mute); }
.detail-grid > div b { color:var(--text-mute); font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.3px; display:block; margin-bottom:4px; }
.desc { background:#fff; border:1px solid var(--border); border-radius:8px; padding:16px; white-space:pre-wrap; margin-bottom:20px; box-shadow: 0 1px 2px rgba(9,30,66,.05); line-height:1.5; }

/* -------- Attachments -------- */
.attach-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; margin-bottom:20px; }
.attach-item { display:block; background:#fff; border:1px solid var(--border); border-radius:6px; padding:6px; text-align:center; text-decoration:none; color:#444; overflow:hidden; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.attach-item img { width:100%; height:140px; object-fit:cover; border-radius:4px; display:block; background:#f4f5f7; }
.attach-item .attach-name { font-size:11px; color:var(--gray); margin-top:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.attach-item:hover { border-color:var(--info); text-decoration:none; }

/* -------- Row states -------- */
.warn-row td { background:#fffae6 !important; }

/* -------- Kanban board -------- */
.kanban { display:grid; grid-template-columns: repeat(3, 1fr); gap:14px; margin-top:12px; }
.kanban-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .kanban-4 { grid-template-columns: repeat(2, 1fr); } }
.kanban-col { background:#f4f5f7; border:1px solid var(--border); border-radius:8px; padding:12px; min-height:300px; }
.kanban-col h3 { margin:0 0 10px; font-size:12px; text-transform:uppercase; letter-spacing:.5px; display:flex; align-items:center; justify-content:space-between; }
.kanban-col h3 .count { background:#dfe1e6; color:#42526e; padding:1px 8px; border-radius:10px; font-size:11px; font-weight:700; }
.kanban-card { background:#fff; border-radius:6px; padding:10px 12px; margin-bottom:8px; box-shadow: 0 1px 2px rgba(9,30,66,.1); display:block; color:var(--text); border-left: 3px solid var(--info); }
.kanban-card:hover { text-decoration:none; box-shadow: 0 3px 6px rgba(9,30,66,.15); }
.kanban-card .kc-title { font-size:13px; font-weight:600; margin-bottom:4px; color:var(--text); }
.kanban-card .kc-meta { font-size:11px; color:var(--text-mute); display:flex; justify-content:space-between; align-items:center; margin-top:6px; }
.kanban-card.p-critical { border-left-color:#de350b; }
.kanban-card.p-high { border-left-color:#ff5630; }
.kanban-card.p-medium { border-left-color:#ffab00; }
.kanban-card.p-low { border-left-color:#8ab96b; }
@media (max-width: 1000px) { .kanban { grid-template-columns: 1fr; } }

/* -------- Recent list (dashboard) -------- */
.recent-list { background:#fff; border:1px solid var(--border); border-radius:8px; overflow:hidden; box-shadow: 0 1px 2px rgba(9,30,66,.05); }
.recent-item { display:grid; grid-template-columns: 70px 1fr 90px 100px 140px; gap:10px; padding:10px 14px; border-bottom:1px solid var(--border); align-items:center; font-size:13px; }
.recent-item:last-child { border-bottom:none; }
.recent-item:hover { background:#fafbfc; }
.recent-id { color:var(--text-mute); font-weight:600; font-size:12px; }
.recent-title { color:var(--text); font-weight:500; }
.recent-title a { color:var(--text); }
.recent-meta { font-size:11px; color:var(--text-mute); }

/* -------- Login -------- */
.login-body { background:linear-gradient(135deg,#172b4d,#2d4a7a); min-height:100vh; display:flex; align-items:center; justify-content:center; margin:0; }
.login-card { background:#fff; padding:40px 36px; border-radius:10px; box-shadow:0 20px 40px rgba(0,0,0,.2); width:380px; text-align:center; }
.login-logo { height:70px; margin-bottom:12px; }
.login-card h1 { color:var(--text); margin:4px 0 2px; font-size:24px; }
.login-card .sub { color:var(--text-mute); font-size:13px; margin-bottom:22px; }
.login-card label { text-align:left; display:block; margin-bottom:14px; font-size:12px; font-weight:600; color:var(--text-mute); text-transform:uppercase; letter-spacing:.3px; }
.hint { color:var(--gray); font-size:12px; margin-top:16px; }

/* -------- Horizontal bar (department chart) -------- */
.bar { height:14px; background:#ebecf0; border-radius:7px; overflow:hidden; }
.bar-fill { height:100%; background: linear-gradient(90deg, var(--info), var(--green)); }

.row-fields { display:grid; grid-template-columns: 1fr 1fr; gap:12px 18px; }
@media (max-width: 700px) { .row-fields { grid-template-columns: 1fr; } }

.cat { padding:2px 8px; border-radius:3px; font-size:11px; font-weight:600; background:#ebecf0; color:#42526e; display:inline-block; }
.c-hardware { background:#deebff; color:#0747a6; }
.c-software { background:#e3fcef; color:#006644; }
.c-network { background:#fff0b3; color:#974f0c; }
.c-access { background:#ffebe6; color:#bf2600; }
.c-email { background:#eae6ff; color:#403294; }
.c-other { background:#ebecf0; color:#42526e; }

/* Reports charts */
.charts-grid { display:grid; grid-template-columns: 2fr 1fr; gap:14px; margin:14px 0 20px; }
.chart-card { background:#fff; border:1px solid var(--border); border-radius:8px; padding:14px; box-shadow:0 1px 2px rgba(9,30,66,.05); display:flex; flex-direction:column; }
.chart-card h3 { margin:0 0 8px; font-size:13px; text-transform:none; letter-spacing:0; color:var(--text); font-weight:600; }
.chart-card .chart-box { position:relative; height:220px; }
.chart-card canvas { width:100% !important; height:100% !important; }
.line-card .chart-box { height:200px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } .chart-card .chart-box { height:200px; } }
.line-card { grid-column:1 / -1; }

.reopen-notice { background:#fff0ea; border:1px solid #ffbdad; color:#bf2600; padding:12px 14px; border-radius:6px; margin:16px 0; font-size:13px; }

/* License expiry alert cards */
.expiry-alerts { display:flex; flex-direction:column; gap:10px; }
.expiry-empty { background:#e3fcef; border:1px solid #abf5d1; color:#006644; padding:20px; text-align:center; border-radius:10px; }
.expiry-card {
  display:grid; grid-template-columns: 90px 1fr; gap:14px;
  background:#fff; border:1px solid var(--border); border-left-width:5px;
  border-radius:10px; padding:14px 16px;
  text-decoration:none; color:var(--text);
  box-shadow:0 2px 6px rgba(9,30,66,.08);
  transition: transform .15s, box-shadow .15s;
}
.expiry-card:hover { transform:translateY(-1px); box-shadow:0 4px 12px rgba(9,30,66,.14); text-decoration:none; }
.expiry-card.critical { border-left-color:#de350b; background:linear-gradient(90deg, #fff0ea 0%, #fff 60%); }
.expiry-card.high     { border-left-color:#ff8b00; background:linear-gradient(90deg, #fff7e6 0%, #fff 60%); }
.expiry-card.warn     { border-left-color:#ffab00; background:linear-gradient(90deg, #fffae6 0%, #fff 60%); }
.expiry-card.expired  { border-left-color:#8b0000; background:linear-gradient(90deg, #ffdede 0%, #fff 60%); }
.expiry-days { text-align:center; padding:8px 4px; border-radius:8px; min-width:92px; }
.expiry-card.critical .expiry-days { background:#de350b; color:#fff; }
.expiry-card.high     .expiry-days { background:#ff8b00; color:#fff; }
.expiry-card.warn     .expiry-days { background:#ffab00; color:#5a3a00; }
.expiry-card.expired  .expiry-days { background:#8b0000; color:#fff; }
.expiry-n { font-size:24px; font-weight:800; line-height:1; }
.expiry-expired { font-size:14px; font-weight:800; line-height:1; letter-spacing:.5px; }
.expiry-l { font-size:10px; text-transform:uppercase; letter-spacing:.5px; opacity:.9; margin-top:4px; font-weight:600; }
.expiry-info { display:flex; flex-direction:column; justify-content:center; min-width:0; }
.expiry-name { font-size:15px; font-weight:700; color:var(--text); margin-bottom:3px; }
.expiry-sub { font-size:12px; color:var(--text-mute); }

/* Custom file upload button for Doc column */
.doc-upload-form { display:flex; gap:4px; align-items:center; }
.doc-file-label {
  display:inline-flex; align-items:center; gap:4px;
  background:#fff; border:1px dashed var(--border-strong); border-radius:4px;
  padding:4px 8px; cursor:pointer; font-size:11px; color:var(--text-mute);
  max-width:140px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
}
.doc-file-label:hover { background:#f4f5f7; border-color:var(--info); color:var(--info); }
.doc-file-label input[type=file] { display:none; }
.doc-file-icon { font-size:12px; }
.doc-file-text { overflow:hidden; text-overflow:ellipsis; }

/* Dropdown-option chips (Settings page) */
.option-chips { display:flex; flex-wrap:wrap; gap:8px; }
.option-chip { display:inline-flex; align-items:center; background:#f4f5f7; border:1px solid var(--border); border-radius:16px; padding:5px 6px 5px 12px; font-size:13px; }
.option-value { color:var(--text); }
.option-remove { background:transparent; color:var(--danger); border:none; cursor:pointer; font-size:18px; line-height:1; width:22px; height:22px; border-radius:50%; margin-left:6px; padding:0; }
.option-remove:hover { background:var(--danger); color:#fff; }

/* Asset category tabs */
.asset-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:14px 0 18px; background:#fff; border:1px solid var(--border); border-radius:8px; padding:8px; box-shadow:0 1px 2px rgba(9,30,66,.05); }
.asset-tab { display:flex; align-items:center; gap:7px; padding:8px 14px; border-radius:6px; text-decoration:none; color:var(--text); font-size:13px; font-weight:500; border:1px solid transparent; transition:all .15s; }
.asset-tab:hover { background:#f4f5f7; text-decoration:none; }
.asset-tab.active { background:var(--info); color:#fff; border-color:var(--info); }
.asset-tab.active .asset-tab-count { background:rgba(255,255,255,.3); color:#fff; }
.asset-tab-icon { font-size:14px; }
.asset-tab-count { background:#ebecf0; color:var(--text-mute); padding:1px 8px; border-radius:10px; font-size:11px; font-weight:700; min-width:22px; text-align:center; }

/* View toggle */
.view-toggle { display:flex; align-items:center; gap:4px; margin:12px 0; }

/* Grouped-by-location cards */
.grouped-locations { display:flex; flex-direction:column; gap:16px; margin-top:12px; }
.group-card { background:#fff; border:1px solid var(--border); border-radius:10px; box-shadow:0 1px 3px rgba(9,30,66,.07); overflow:hidden; }
.group-head { display:flex; justify-content:space-between; align-items:center; background:linear-gradient(90deg, #172b4d, #253858); color:#fff; padding:10px 16px; }
.group-location { font-size:15px; font-weight:600; }
.group-count { font-size:12px; opacity:.85; background:rgba(255,255,255,.15); padding:3px 10px; border-radius:12px; }
.group-table { border:none; box-shadow:none; }
.group-table th { background:#f4f5f7; }

/* Recurring asset issues */
.recurring-list { display:flex; flex-direction:column; gap:8px; }
.recurring-item { display:grid; grid-template-columns:60px 1fr auto; gap:14px; background:#fff0ea; border:1px solid #ffbdad; border-left:5px solid #de350b; border-radius:8px; padding:12px 16px; color:var(--text); align-items:center; }
.recurring-count { background:#de350b; color:#fff; font-size:20px; font-weight:800; width:52px; height:52px; border-radius:50%; display:flex; align-items:center; justify-content:center; }
.recurring-info { min-width:0; cursor:pointer; }
.recurring-info:hover .recurring-tag { color:var(--danger); }
.recurring-tag { color:var(--text); margin-bottom:3px; }
.recurring-actions { display:flex; gap:6px; align-items:center; }

/* Metrics + top requesters card */
.metrics-box { display:flex; flex-direction:column; gap:10px; }
.metric-row { display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; }
.metric { background:#f4f5f7; border-radius:6px; padding:8px 6px; text-align:center; }
.metric-n { font-size:18px; font-weight:700; color:var(--info); line-height:1; }
.metric-l { font-size:10px; color:var(--text-mute); text-transform:uppercase; letter-spacing:.3px; margin-top:4px; font-weight:600; }
.requesters-list { background:#fafbfc; border:1px solid var(--border); border-radius:6px; padding:8px 10px; flex:1; overflow:hidden; }
.requesters-head { font-size:11px; color:var(--text-mute); text-transform:uppercase; letter-spacing:.4px; font-weight:700; margin-bottom:6px; }
.requester-item { display:grid; grid-template-columns: 28px 1fr 32px; gap:6px; align-items:center; padding:3px 0; font-size:12px; border-bottom:1px dashed var(--border); }
.requester-item:last-child { border-bottom:none; }
.requester-item .rank { color:var(--gray-light); font-weight:700; font-size:11px; }
.requester-item .rname { color:var(--text); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.requester-item .rcount { background:var(--info); color:#fff; padding:1px 7px; border-radius:10px; font-weight:700; font-size:11px; text-align:center; }

/* -------- Split layout -------- */
.split { display:flex; gap:16px; flex-wrap:wrap; }
.split > section { min-width:300px; }

/* -------- Page header -------- */
.page-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:10px; }
.page-head h1 { margin:0; }
.page-actions { display:flex; gap:8px; }

/* -------- Responsive sidebar collapse on narrow -------- */
/* Mobile top bar (only shown on narrow screens) */
.mobile-topbar { display:none; position:fixed; top:0; left:0; right:0; height:52px; background:var(--sidebar-bg); color:#fff; z-index:200; align-items:center; gap:10px; padding:0 12px; box-shadow:0 2px 6px rgba(0,0,0,.18); }
.hamburger { background:transparent; color:#fff; border:none; font-size:22px; width:40px; height:40px; cursor:pointer; padding:0; }
.hamburger:hover { background:rgba(255,255,255,.1); border-radius:4px; }
.mobile-logo { height:32px; background:#fff; padding:3px; border-radius:4px; }
.mobile-title { flex:1; font-weight:700; font-size:16px; color:#fff; }
.mobile-logout { background:transparent; color:#fff; border:1px solid rgba(255,255,255,.3); border-radius:4px; width:36px; height:32px; cursor:pointer; font-size:14px; }
.nav-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:150; }

/* Tablet: narrow sidebar with icons only */
@media (max-width: 900px) and (min-width: 601px) {
  .sidebar { width:60px; }
  body.app .main { margin-left: 60px; padding: 16px; }
  .side-app, .side-tag, .side-section, .side-nav a span:not(.ic), .side-user-info, .side-nav a { font-size:0; }
  .side-nav a .ic { font-size:16px; }
  .side-nav a { justify-content:center; padding:10px; }
  .side-brand { justify-content:center; padding:10px; }
  .side-brand > div { display:none; }
  .side-user { flex-direction:column; gap:6px; padding:10px 6px; }
  .logout-btn { padding:4px 6px; font-size:10px; }
}

/* Phone: full-screen slide-in sidebar via hamburger */
@media (max-width: 600px) {
  .mobile-topbar { display:flex; }
  body.app { grid-template-columns: 1fr; }
  body.app .main { margin-left:0; padding: 64px 12px 24px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s; width:260px; box-shadow:4px 0 12px rgba(0,0,0,.25); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display:block; }

  /* Tables scroll horizontally */
  .grid { display:block; overflow-x:auto; white-space:nowrap; }
  .grid td, .grid th { white-space:nowrap; }
  .grid td.wrap { white-space:normal; min-width:200px; }

  /* Forms single-column */
  .grid-form, .inline-form .inline-grid, .row-fields { grid-template-columns:1fr !important; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card .chart-box { height:200px; }

  /* Headings */
  h1 { font-size:18px; }
  h2 { font-size:14px; }
  .page-head { flex-direction:column; align-items:stretch; }
  .page-head .page-actions { flex-wrap:wrap; }

  /* Filters stack */
  .filters { flex-direction:column; align-items:stretch; }
  .filters select, .filters input { width:100%; min-width:0; }

  /* List head */
  .list-head { grid-template-columns:1fr; }
  .list-head .search-form { flex-direction:column; align-items:stretch; }
  .list-head .search-form input { min-width:0; max-width:none; }
  .list-head .actions-bar { flex-direction:column; align-items:stretch; }
  .list-head .actions-bar form { flex-direction:column; width:100%; }
  .list-head .actions-bar input[type=file] { width:100%; }

  /* Dashboard cards stack */
  .split { flex-direction:column; }

  /* Expiry alerts */
  .expiry-card { grid-template-columns:70px 1fr; }

  /* Login */
  .login-card { width:92%; max-width:380px; padding:28px 22px; }

  /* Larger tap targets */
  button, .btn, select, input, textarea { min-height:38px; font-size:14px; }
  .btn.small { min-height:32px; font-size:12px; padding:5px 10px; }
}

/* File + camera upload row */
.upload-row { display:flex; gap:10px; align-items:center; margin-top:6px; flex-wrap:wrap; }
.upload-fileinput { flex:1; min-width:220px; margin:0; }
.camera-btn {
  display:none; align-items:center; gap:8px; padding:10px 16px;
  background:#36b37e; color:#fff; border-radius:6px; cursor:pointer;
  font-weight:600; font-size:14px; white-space:nowrap; margin:0;
}
.camera-btn:hover { background:#2a8f66; }
.camera-btn input[type=file] { display:none; }
.camera-btn span { font-size:18px; }

/* Camera button only on mobile */
@media (max-width: 800px) {
  .camera-btn { display:inline-flex; }
  .mobile-only-btn { display:inline-flex; }
}

.picked-files { margin-top:8px; padding:8px 10px; background:#e3fcef; border-radius:6px; font-size:12px; color:var(--text); line-height:1.6; }
.picked-files:empty { display:none; }

/* Better touch for iPad landscape */
@media (hover: none) and (pointer: coarse) {
  button, .btn { -webkit-tap-highlight-color: rgba(0,0,0,0.1); }
}

/* =========================================================
   PROFESSIONAL POLISH + FULL MOBILE RESPONSIVENESS
   Added below so it overrides where needed.
   ========================================================= */

/* Smoother shadows + refined card feel */
.form-card, .stat, .grid, .chart-card, .recent-list, .group-card, .detail-grid, .desc, .expiry-card, .asset-tabs, .inline-form {
  box-shadow: 0 1px 3px rgba(9,30,66,.06), 0 1px 2px rgba(9,30,66,.04);
  border-color: #e5e7eb;
}
.stat { transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(9,30,66,.1); }

/* Sharper inputs */
input, select, textarea {
  background: #fff;
  border-radius: 6px;
  padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #b4b9c2; }
input:focus, select:focus, textarea:focus {
  background: #fff; border-color: var(--info);
  outline: none; box-shadow: 0 0 0 3px rgba(0,82,204,.12);
}

/* Refined buttons */
button, .btn {
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: .1px;
  transition: all .15s;
  box-shadow: 0 1px 2px rgba(9,30,66,.06);
}
button:hover, .btn:hover { box-shadow: 0 2px 4px rgba(9,30,66,.1); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button.primary, .btn.primary { background: linear-gradient(180deg, #0065ff, #0052cc); }
button.primary:hover, .btn.primary:hover { background: linear-gradient(180deg, #0052cc, #0747a6); }

/* Mobile top bar polish */
.mobile-topbar { background: linear-gradient(180deg, #1d3557, var(--sidebar-bg)); }

/* Smooth sidebar slide */
.sidebar { transition: transform .28s cubic-bezier(.4,0,.2,1); }
.nav-backdrop { opacity:0; transition: opacity .25s; }
body.nav-open .nav-backdrop { opacity:1; }

/* Flash: pill-shaped, prettier */
.flash { padding:11px 16px; border-radius:8px; font-weight:500; display:flex; align-items:center; gap:8px; }

/* -------- Mobile phone (≤ 600px) upgrades -------- */
@media (max-width: 600px) {
  body { font-size: 14px; }
  .main { padding: 64px 12px 24px !important; }

  /* H1 cleaner */
  h1 { font-size: 20px; margin-bottom: 14px; }

  /* Cards use less horizontal padding so content breathes */
  .form-card { padding: 16px; margin-bottom: 14px; }
  .detail-grid { padding: 14px; gap: 12px; }
  .detail-grid > div { font-size: 13px; }

  /* ===== Mobile tables: convert to cards ===== */
  .grid.cards-on-mobile { border: none; box-shadow: none; background: transparent; }
  .grid.cards-on-mobile thead { display: none; }
  .grid.cards-on-mobile tr { display: block; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(9,30,66,.06); }
  .grid.cards-on-mobile td { display: flex; justify-content: space-between; align-items: flex-start; border: none; padding: 5px 0; white-space: normal !important; gap: 10px; font-size: 13px; }
  .grid.cards-on-mobile td::before { content: attr(data-label); font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; flex-shrink: 0; min-width: 90px; }
  .grid.cards-on-mobile td:last-child { padding-top: 8px; border-top: 1px dashed #e5e7eb; margin-top: 6px; }

  /* Default tables still scroll horizontally, but with a visible gradient hint */
  .grid:not(.cards-on-mobile) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .grid:not(.cards-on-mobile) td, .grid:not(.cards-on-mobile) th { font-size: 12.5px; padding: 8px 10px; }

  /* Buttons/forms: large touch targets */
  button, .btn, select, input, textarea { min-height: 42px; font-size: 14px; }
  .btn.small { min-height: 34px; font-size: 12.5px; padding: 6px 10px; }

  /* Filters bar: full width, spacing */
  .filters { padding: 10px; gap: 8px; }
  .filters select, .filters input { padding: 10px 12px; }

  /* Stat tiles: bigger on mobile */
  .stat-row { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 24px; }

  /* Recent list: stack columns naturally */
  .recent-item { grid-template-columns: 1fr; gap: 4px; padding: 10px 12px; }
  .recent-item > * { font-size: 13px; }
  .recent-id { font-size: 11px; color: var(--text-mute); }

  /* Kanban cards: single column */
  .kanban { grid-template-columns: 1fr !important; gap: 10px; }
  .kanban-col { min-height: 0; }

  /* Asset tabs: compact */
  .asset-tabs { padding: 6px; gap: 4px; }
  .asset-tab { padding: 7px 10px; font-size: 12px; }
  .asset-tab-count { padding: 1px 6px; font-size: 10px; min-width: 18px; }

  /* Attachments 2-col */
  .attach-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .attach-item img { height: 100px; }

  /* Hide the right-side preview on template editor on mobile — show stacked */
  .admin-templates-wrap { grid-template-columns: 1fr !important; }

  /* Page head: title + actions stacked, actions full-width */
  .page-head h1 { width: 100%; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn, .page-head .page-actions button { flex: 1; text-align: center; }
}

/* Very small phones (≤ 380px) */
@media (max-width: 380px) {
  .main { padding: 60px 8px 20px !important; }
  h1 { font-size: 18px; }
  .stat-row { grid-template-columns: 1fr; }
  .attach-grid { grid-template-columns: 1fr; }
  .mobile-title { font-size: 14px; }
  .mobile-logo { height: 28px; }
}

/* Tablet range (601 - 900px): cleaner fill */
@media (min-width: 601px) and (max-width: 900px) {
  .main { padding: 18px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  /* Keep collapsed sidebar comfortable */
  .sidebar { width: 68px; }
  body.app .main { margin-left: 68px; }
}

/* Large screens: tighter max line length for readability */
@media (min-width: 1400px) {
  .main { padding: 28px 40px 40px; }
}

/* Badges — tighter, more consistent */
.pri, .st, .cat { font-size: 11px; line-height: 1.6; padding: 2px 9px; border-radius: 4px; }

/* Priority chip color accents */
.p-low      { background:#e3fcef; color:#006644; }
.p-medium   { background:#fff0b3; color:#974f0c; }
.p-high     { background:#ffe2d9; color:#a93212; }
.p-critical { background:#de350b; color:#fff; }

/* Grid-form: on tablet keep 2 cols */
@media (max-width: 1100px) and (min-width: 701px) {
  .grid-form { grid-template-columns: repeat(2, 1fr); }
}

/* Row-fields safer on mobile */
@media (max-width: 600px) {
  .row-fields { grid-template-columns: 1fr !important; gap: 12px; }
}

/* Email templates layout: 2-col desktop, stacks on mobile already handled */
.admin-templates-wrap { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .admin-templates-wrap { grid-template-columns: 1fr; } }

/* Prevent iOS auto-zoom on inputs */
@media (max-width: 600px) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
  input[type=date], input[type=tel], textarea, select { font-size: 16px !important; }
}


/* =========================================================
   MOBILE RESPONSIVENESS v2 — comprehensive fixes
   Appended last so it overrides all earlier rules.
   ========================================================= */

/* --- Global overflow protection: never show horizontal scroll bars on any viewport --- */
html, body { overflow-x: hidden; max-width: 100vw; }
.main, .public-main { max-width: 100%; }
img, video, canvas { max-width: 100%; height: auto; }

/* Long serial numbers / URLs should wrap inside cards, not blow the layout */
.grid.cards-on-mobile td, .detail-grid > div, .desc, .recent-item,
.form-card, .inline-form { word-break: break-word; overflow-wrap: anywhere; }

/* --- Sidebar reliability on phones --- */
@media (max-width: 600px) {
  /* The whole sidebar scrolls as a fallback if the inner nav can't fit everything */
  .sidebar {
    width: min(84vw, 300px);
    max-width: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    /* Use dynamic viewport height when supported, else fall back to 100vh */
    height: 100vh;
    height: 100dvh;
  }
  /* Keep brand / user blocks from being squashed */
  .side-brand { flex-shrink: 0; }
  .side-user  { flex-shrink: 0; position: sticky; bottom: 0; background: var(--sidebar-bg); }

  /* Scrollable middle region with enough room on tall menus */
  .side-nav {
    flex: 1 1 auto;
    min-height: 0;        /* critical: lets flex child actually scroll */
    overflow-y: auto;
    padding-bottom: 8px;
  }

  /* Tighter nav spacing on phones so more items fit without scrolling */
  .side-nav a { padding: 10px 12px; font-size: 14px; }
  .side-section { padding: 10px 10px 4px; }

  /* Lock page scroll when sidebar is open — only the sidebar scrolls behind the backdrop */
  body.nav-open { overflow: hidden; position: fixed; width: 100%; }

  /* Sidebar must sit above the fixed top bar */
  .sidebar { z-index: 220; }
  .nav-backdrop { z-index: 200; }
}

/* --- Ticket detail: fully stack on narrow screens --- */
@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr !important; padding: 12px; }
  .detail-grid > div { padding: 8px 10px; background: #fafbfc; border-radius: 6px; }
  .desc { padding: 12px; font-size: 13px; }
  h3 { margin: 16px 0 8px; font-size: 13px; }
  .back { font-size: 12px; }
}

/* --- Form max-width can cause odd right-edge padding on mobile; always be fluid --- */
@media (max-width: 700px) {
  .form-card { max-width: 100% !important; }
  form.form-card [style*="max-width"] { max-width: 100% !important; }
}

/* --- Rows of inline buttons should always wrap --- */
.row, .page-actions, .recurring-actions, .filters, .page-head {
  flex-wrap: wrap;
}

/* --- Dashboard / stats --- */
@media (max-width: 600px) {
  .stat-row { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .stat { padding: 12px; }
  .stat .n { font-size: 22px; }
  .stat-link { font-size: 10px; }

  /* Split sections stack with full width */
  .split { flex-direction: column; }
  .split > section { flex: 1 1 100% !important; min-width: 0; width: 100%; }

  /* Recurring assets: stack the action buttons under the text */
  .recurring-item { grid-template-columns: 50px 1fr; gap: 10px; }
  .recurring-actions { grid-column: 1 / -1; width: 100%; }
  .recurring-actions .btn { flex: 1; text-align: center; }
  .recurring-count { width: 44px; height: 44px; font-size: 18px; }

  /* Kanban already single-column via earlier rule — just tighten padding */
  .kanban-col { padding: 10px; }
}

/* Very small phones */
@media (max-width: 400px) {
  .stat-row { grid-template-columns: 1fr !important; }
  .recent-item { padding: 10px 10px; }
  .side-nav a { padding: 9px 10px; font-size: 13.5px; }
}

/* --- Expiry alerts: tighter on phone --- */
@media (max-width: 600px) {
  .expiry-card { grid-template-columns: 70px 1fr; padding: 12px; gap: 10px; }
  .expiry-days { padding: 6px 2px; min-width: 70px; }
  .expiry-n { font-size: 20px; }
  .expiry-name { font-size: 14px; }
  .expiry-sub { font-size: 11px; }
}

/* --- Asset tabs horizontal scroll instead of wrap on tiny screens --- */
@media (max-width: 600px) {
  .asset-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .asset-tab { flex-shrink: 0; white-space: nowrap; }
}

/* --- Admin asset dialogs (shared modals) must fit mobile viewport --- */
@media (max-width: 600px) {
  dialog, .modal, .asset-dialog {
    width: 94vw !important;
    max-width: 94vw !important;
    padding: 16px !important;
    border-radius: 10px;
  }
  dialog form, .modal form { max-width: 100% !important; }
}

/* --- Ticket-detail change-status form full width on phone --- */
@media (max-width: 600px) {
  .row-fields { grid-template-columns: 1fr !important; }
  .row-fields > label, .row-fields > div { width: 100%; }
}

/* --- Priority hint panel (new ticket) --- */
#priority-hint { font-size: 13px; }
@media (max-width: 600px) {
  #priority-hint { font-size: 13px; }
  #priority-hint-head { flex-direction: column; align-items: flex-start !important; gap: 4px; padding: 10px 12px !important; }
  #priority-hint-head #priority-hint-sla { font-size: 11px !important; }
  #priority-hint ul { padding-left: 16px !important; }
  #priority-hint ul li { font-size: 12.5px; }
}

/* --- Reports page: charts stack, filters column --- */
@media (max-width: 700px) {
  .charts-grid { grid-template-columns: 1fr !important; }
  .chart-card .chart-box { height: 220px; }
}

/* --- Login card: safe padding on tiny screens --- */
@media (max-width: 400px) {
  .login-card { padding: 22px 16px; width: 94%; }
  .login-logo { height: 54px; }
}

/* --- Mobile topbar: ensure consistent height & centered contents --- */
.mobile-topbar { height: 54px; }
.mobile-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Ensure form buttons like Submit / Cancel are full width on phone --- */
@media (max-width: 600px) {
  .form-card .row { flex-direction: column; align-items: stretch; }
  .form-card .row > button, .form-card .row > .btn { width: 100%; text-align: center; }
}

/* --- Admin board filters & stat cards --- */
@media (max-width: 600px) {
  .list-head { grid-template-columns: 1fr !important; }
}

/* --- Tables inside admin-email-log-detail overflow-safe --- */
.email-preview, .email-body-preview {
  overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch;
}

/* --- Textareas never exceed container on mobile --- */
@media (max-width: 600px) {
  textarea { min-height: 90px; }
}

/* --- Fix for the "Take Photo" button sitting cleanly under file chooser on mobile --- */
@media (max-width: 500px) {
  .upload-row { flex-direction: column; align-items: stretch; }
  .upload-fileinput, .camera-btn { width: 100%; min-width: 0; text-align: center; justify-content: center; }
}

/* --- Picked-files box looks nicer on mobile --- */
.picked-files { word-break: break-all; }

/* --- Avoid the "Logout" button being cut on mobile --- */
.mobile-logout { min-width: 40px; }

/* =========================================================
   MOBILE RESPONSIVENESS v3 — focused action-cell + logout fixes
   ========================================================= */

/* --- Nicer mobile logout button (replaces the tiny ⎋ icon) --- */
.mobile-logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; height: 36px; padding: 0 12px; margin-left: 4px;
  background: rgba(255,255,255,.12);
  color: #fff; font-weight: 600; font-size: 13px;
  border: 1px solid rgba(255,255,255,.25); border-radius: 8px;
  cursor: pointer; letter-spacing: .2px;
  transition: all .15s;
}
.mobile-logout:hover, .mobile-logout:active {
  background: #de350b; border-color: #de350b; color: #fff;
}
.mobile-logout .mlo-ic { font-size: 15px; line-height: 1; }
.mobile-logout .mlo-text { font-size: 12.5px; }
@media (max-width: 400px) {
  .mobile-logout { padding: 0 10px; }
  .mobile-logout .mlo-text { display: none; }   /* icon-only on very small phones */
  .mobile-logout { width: 40px; padding: 0; }
}

/* --- Mobile ACTIONS cell: label on top, buttons in a horizontal wrap below --- */
@media (max-width: 600px) {
  /* The Actions cell is almost always the last one in each admin row */
  .grid.cards-on-mobile td[data-label="Actions"],
  .grid.cards-on-mobile td[data-label="Action"] {
    display: block !important;
    padding: 10px 0 2px !important;
    margin-top: 8px;
    border-top: 1px dashed #e5e7eb;
    width: 100%;
  }
  .grid.cards-on-mobile td[data-label="Actions"]::before,
  .grid.cards-on-mobile td[data-label="Action"]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px; color: var(--text-mute);
    text-transform: uppercase; letter-spacing: .3px; font-weight: 700;
    margin-bottom: 8px;
  }
  /* Direct action buttons + wrapper forms inside the Actions cell flow in a wrap row */
  .grid.cards-on-mobile td[data-label="Actions"] > .btn,
  .grid.cards-on-mobile td[data-label="Actions"] > button,
  .grid.cards-on-mobile td[data-label="Actions"] > form,
  .grid.cards-on-mobile td[data-label="Actions"] > a {
    display: inline-flex; align-items: center;
    margin: 0 6px 6px 0;
    vertical-align: middle;
  }
  /* Forms containing single buttons behave like buttons */
  .grid.cards-on-mobile td[data-label="Actions"] form.inline {
    display: inline-flex !important;
    gap: 6px;
    align-items: center;
  }
  /* Keep buttons readable — never let them become vertical-text columns */
  .grid.cards-on-mobile td[data-label="Actions"] .btn,
  .grid.cards-on-mobile td[data-label="Actions"] button {
    min-width: auto;
    width: auto !important;
    white-space: nowrap;
    padding: 7px 12px;
    font-size: 12.5px;
    min-height: 34px;
  }
  /* The "new pw" input in the Reset form should be compact, not full-width */
  .grid.cards-on-mobile td[data-label="Actions"] input[type="password"],
  .grid.cards-on-mobile td[data-label="Actions"] input[type="text"],
  .grid.cards-on-mobile td[data-label="Actions"] input[name="password"] {
    width: 110px !important;
    min-width: 0 !important;
    max-width: 130px;
    padding: 7px 10px;
    font-size: 13px;
    height: 34px;
    min-height: 34px;
    margin: 0;
  }
}

/* Even on very small phones, Actions buttons should still fit horizontally,
   wrapping to new lines rather than being vertically text-compressed */
@media (max-width: 400px) {
  .grid.cards-on-mobile td[data-label="Actions"] .btn,
  .grid.cards-on-mobile td[data-label="Actions"] button { font-size: 12px; padding: 6px 10px; }
  .grid.cards-on-mobile td[data-label="Actions"] input[name="password"] { width: 100px !important; }
}

/* Same treatment for any other long-form cells (e.g. Docs, Status) that embed buttons */
@media (max-width: 600px) {
  .grid.cards-on-mobile td[data-label="Docs"],
  .grid.cards-on-mobile td[data-label="Links"],
  .grid.cards-on-mobile td[data-label="Options"] {
    display: block !important;
    padding: 10px 0 2px !important;
    margin-top: 6px;
    border-top: 1px dashed #e5e7eb;
    width: 100%;
  }
  .grid.cards-on-mobile td[data-label="Docs"]::before,
  .grid.cards-on-mobile td[data-label="Links"]::before,
  .grid.cards-on-mobile td[data-label="Options"]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px; color: var(--text-mute);
    text-transform: uppercase; letter-spacing: .3px; font-weight: 700;
    margin-bottom: 8px;
  }
}

/* =========================================================
   MOBILE RESPONSIVENESS v4 — right-gap + logout polish
   ========================================================= */

/* --- Logout button: clean red rectangle with text, mobile top bar --- */
.mobile-logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 0; height: 36px; padding: 0 14px; margin-left: 4px;
  background: #de350b;
  color: #fff; font-weight: 700; font-size: 13px;
  border: 1px solid #b52a06; border-radius: 6px;
  cursor: pointer; letter-spacing: .3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: background .15s;
}
.mobile-logout:hover, .mobile-logout:active { background: #bf2600; border-color: #93280a; }
.mobile-logout .mlo-ic { display: none; }                /* hide the ⏻ icon — text only */
.mobile-logout .mlo-text { display: inline; font-size: 12.5px; text-transform: uppercase; }
@media (max-width: 400px) {
  .mobile-logout { padding: 0 10px; width: auto; }
  .mobile-logout .mlo-text { display: inline; }          /* keep text visible even on tiny screens */
}

/* --- Kill the right-hand gap on mobile tables rendered as cards --- */
@media (max-width: 600px) {
  /* Table + its inner rows must be full-width blocks */
  .grid.cards-on-mobile { display: block; width: 100%; max-width: 100%; }
  .grid.cards-on-mobile tbody { display: block; width: 100%; }
  .grid.cards-on-mobile tr {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
  }
  /* Ensure the cards container itself fills */
  .form-card, .list-head, .filters, .page-head, .detail-grid, .desc,
  .recent-list, .asset-tabs, .recurring-list, .expiry-alerts,
  section.cards, .split, .charts-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  /* .main should use the full viewport width minus a small gutter */
  body.app .main { padding: 60px 10px 24px !important; width: 100%; max-width: 100vw; }
}

/* On very narrow phones even tighter gutters so the card uses every pixel */
@media (max-width: 400px) {
  body.app .main { padding: 60px 8px 20px !important; }
  .grid.cards-on-mobile tr { padding: 10px; }
}

/* Protect against any inline style that forces a max-width on a row-cell */
@media (max-width: 600px) {
  .grid.cards-on-mobile td { max-width: none !important; width: 100%; }
}

/* =========================================================
   MOBILE RESPONSIVENESS v5 — Recent Tickets layout
   ========================================================= */

/* Recent Tickets rows: fluid flex layout so content fills end-to-end,
   no more trailing whitespace from fixed-width grid columns */
.recent-list { width: 100%; }
.recent-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-item .recent-id {
  flex: 0 0 auto;
  min-width: 108px;              /* fits the new LES-DDMMYY-### format cleanly */
  font-weight: 700;
  font-size: 12px;
  color: var(--text-mute);
  font-family: Consolas, Menlo, monospace;
}
.recent-item .recent-title {
  flex: 1 1 220px;                /* takes all remaining space, grows aggressively */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-item .recent-title a { color: var(--text); font-weight: 500; }
.recent-item > span:not(.recent-id):not(.recent-title):not(.recent-meta) {
  flex: 0 0 auto;                 /* priority + status badges size to their content */
}
.recent-item .recent-meta {
  flex: 0 1 auto;
  margin-left: auto;              /* pushes raiser+date to the far right */
  font-size: 11.5px;
  color: var(--text-mute);
  white-space: nowrap;
}

/* On narrower screens let the title wrap instead of ellipsis */
@media (max-width: 1100px) {
  .recent-item .recent-title { white-space: normal; }
}

/* On phone: keep the existing stacked behaviour but tidier spacing */
@media (max-width: 600px) {
  .recent-item { gap: 6px; padding: 10px 12px; }
  .recent-item .recent-id { min-width: 0; font-size: 11px; }
  .recent-item .recent-title { flex: 1 1 100%; white-space: normal; }
  .recent-item .recent-meta { margin-left: 0; flex: 1 1 100%; }
}

/* =========================================================
   DASHBOARD FILL FIXES — remove trailing whitespace
   ========================================================= */

/* Make every main-section wrapper explicitly span the main's full width */
section.cards, .split, .charts-grid, .recent-list, .recurring-list,
.expiry-alerts, .stat-row {
  width: 100%;
  box-sizing: border-box;
}

/* Stat tiles: flexbox so incomplete rows still STRETCH to fill width.
   The old CSS grid with `repeat(auto-fit, minmax(170px, 1fr))` left a
   gap whenever the tile count didn't divide evenly into the row. */
.stat-row {
  display: flex !important;
  flex-wrap: wrap;
  gap: 12px;
}
.stat {
  flex: 1 1 180px;
  min-width: 0;
  box-sizing: border-box;
}

/* Split section (Recent Tickets | Expiring Licenses) — balance heights so
   the shorter column doesn't leave visible slack */
.split {
  display: flex !important;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
}
.split > section {
  min-width: 320px;
  flex: 1 1 320px;         /* equal growth; override inline flex:1/flex:2 */
  box-sizing: border-box;
}
/* Preserve the 2:1 intent on wide screens via inline styles — but only if
   there is enough room (above 1000px). */
@media (min-width: 1000px) {
  .split > section[style*="flex:2"],
  .split > section[style*="flex: 2"] { flex: 2 1 480px; }
  .split > section[style*="flex:1"],
  .split > section[style*="flex: 1"] { flex: 1 1 300px; }
}
/* On tablet/narrow laptop the split stacks instead of squeezing */
@media (max-width: 900px) {
  .split { flex-direction: column; }
  .split > section { flex: 1 1 100% !important; width: 100%; }
}

/* Recurring Assets alerts: switch to flex so the text column fills and the
   action buttons sit cleanly on the right without grid slack */
.recurring-item {
  display: flex !important;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
}
.recurring-count { flex: 0 0 auto; }
.recurring-info  { flex: 1 1 260px; min-width: 0; }
.recurring-actions {
  flex: 0 0 auto;
  margin-left: auto;        /* push buttons to the right, no gap after */
  display: flex; gap: 6px; align-items: center;
}
@media (max-width: 600px) {
  .recurring-info { flex: 1 1 100%; }
  .recurring-actions { flex: 1 1 100%; margin-left: 0; }
  .recurring-actions .btn { flex: 1; text-align: center; }
}

/* Expiry cards fill their section width (no accidental max-width) */
.expiry-card { width: 100%; box-sizing: border-box; }

/* Section cards (parent of stat-row/expiry-alerts/recent-list) breathe
   consistently — remove any accidental extra right margin / padding */
.cards { margin-bottom: 18px; }
.cards > h2 { margin: 0 0 12px; }

/* Recent list container: no right-edge slack */
.recent-list { border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; }

/* Ensure no grandchild has a lingering fixed width */
section.cards > * { max-width: 100%; }

/* =========================================================
   MOBILE CARDS v6 — pack label + value together, no middle gap
   ========================================================= */

@media (max-width: 600px) {
  /* Each card row: label + value sit left, no space-between pushing them apart */
  .grid.cards-on-mobile td {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 14px !important;
    padding: 6px 0 !important;
    text-align: left;
  }

  /* Label column: fixed narrow width so values stay aligned vertically */
  .grid.cards-on-mobile td::before {
    content: attr(data-label);
    display: inline-block;
    flex: 0 0 100px !important;      /* fixed label width */
    width: 100px;
    min-width: 100px !important;
    max-width: 100px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.5;
    padding-top: 1px;
  }

  /* Value content fills the remaining space, left-aligned */
  .grid.cards-on-mobile td > * {
    flex: 0 1 auto;
  }
  /* Nowrap cells (badges, ticket IDs) hug the label */
  .grid.cards-on-mobile td.nowrap { gap: 14px !important; }

  /* Row card: slightly tighter padding so there's more width for values */
  .grid.cards-on-mobile tr {
    padding: 14px 14px !important;
  }

  /* Card body: a bit more comfortable vertical rhythm */
  .grid.cards-on-mobile td { font-size: 13.5px; }

  /* The Actions cell (set earlier to block) still wins because of
     its `display:block !important` — unchanged. */
}

/* Very narrow phones (≤ 380px): shrink label column so values have room */
@media (max-width: 380px) {
  .grid.cards-on-mobile td::before {
    flex: 0 0 82px !important;
    width: 82px;
    min-width: 82px !important;
    max-width: 82px;
  }
  .grid.cards-on-mobile td { gap: 10px !important; font-size: 13px; }
}

/* =========================================================
   DASHBOARD RECENT TICKETS — mobile card polish
   ========================================================= */

@media (max-width: 600px) {
  /* Outer list: no wrapping card, just a container — each ticket is its own card */
  .recent-list {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  /* Each ticket item becomes a standalone rounded card */
  .recent-item {
    display: block !important;      /* override desktop flex */
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--info);
    border-radius: 8px;
    padding: 12px 14px !important;
    box-shadow: 0 1px 3px rgba(9,30,66,.06);
    transition: transform .15s, box-shadow .15s;
    gap: 0 !important;
  }
  .recent-item:hover, .recent-item:active {
    box-shadow: 0 3px 8px rgba(9,30,66,.12);
    transform: translateY(-1px);
    border-left-color: var(--green);
  }

  /* Priority-colored left border per ticket */
  .recent-item:has(.p-critical) { border-left-color: #de350b; }
  .recent-item:has(.p-high)     { border-left-color: #ff5630; }
  .recent-item:has(.p-medium)   { border-left-color: #ffab00; }
  .recent-item:has(.p-low)      { border-left-color: #8ab96b; }

  /* ID — top-left muted monospace label */
  .recent-item .recent-id {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-mute);
    letter-spacing: .3px;
    margin-bottom: 4px;
    font-family: Consolas, Menlo, monospace;
  }

  /* Title — the main content, larger + bold, full width */
  .recent-item .recent-title {
    display: block;
    font-size: 15px !important;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.35;
    white-space: normal !important;
  }
  .recent-item .recent-title a { color: var(--text); text-decoration: none; }
  .recent-item .recent-title a:hover { color: var(--info); }

  /* Badge row — priority + status side by side, inline */
  .recent-item > span:not(.recent-id):not(.recent-title):not(.recent-meta) {
    display: inline-block !important;
    margin-right: 6px;
    margin-bottom: 8px;
  }

  /* Meta line — raiser + date, bottom of card, subtle */
  .recent-item .recent-meta {
    display: block !important;
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #eceff2;
    line-height: 1.4;
  }
}

/* =========================================================
   TABLE READABILITY — no mid-word wraps, graceful scroll
   ========================================================= */

/* Badges, pills, buttons never break mid-word */
.pri, .st, .cat,
.grid .btn, .grid button,
.recent-item .pri, .recent-item .st,
.recent-item .cat {
  white-space: nowrap !important;
  overflow: visible;
}

/* Sensible minimums for date / status / id columns */
.grid td, .grid th { word-break: normal; }
.grid td.nowrap, .grid th.nowrap { white-space: nowrap; }

/* When the table is too wide for the viewport, scroll horizontally instead
   of crushing cells into vertical text columns. The `scrollable` class is
   added by JS below whenever the real pixel width > container width. */
.grid.scrollable {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  position: relative;
  /* subtle gradient hint on the right edge so users know to scroll */
  background: linear-gradient(90deg, #fff 70%, rgba(9,30,66,0.06) 100%);
}
.grid.scrollable table, .grid.scrollable thead, .grid.scrollable tbody,
.grid.scrollable tr { white-space: nowrap; }
.grid.scrollable td, .grid.scrollable th { white-space: nowrap; }
.grid.scrollable td.wrap { white-space: normal; }

/* But: if the viewport is phone-sized, cards-on-mobile wins instead */
@media (max-width: 600px) {
  .grid.scrollable { display: block; overflow-x: visible; background: transparent; }
}

/* =========================================================
   DESKTOP TABLE REGRESSION FIX
   Undo the global overflow-wrap:anywhere that was leaking from the
   cards-on-mobile rules into desktop view. Re-apply it only on phones.
   ========================================================= */

/* DESKTOP (601px and up): never break mid-word. */
@media (min-width: 601px) {
  .grid td, .grid th,
  .grid.cards-on-mobile td, .grid.cards-on-mobile th {
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Text that MUST stay on one line: serial numbers, tags, dates, badges, buttons */
  .grid td.mono, .grid td.nowrap, .grid td .mono,
  .grid td .pri, .grid td .st, .grid td .cat,
  .grid td .btn, .grid td button {
    white-space: nowrap;
  }

  /* Allow the table to overflow its container horizontally when it needs to;
     the parent renders a native scrollbar. */
  .grid { table-layout: auto; }

  /* Reasonable minimum widths so columns breathe at any zoom level */
  .grid th, .grid td { min-width: 60px; }
  .grid th:first-child, .grid td:first-child { min-width: 90px; }     /* IDs */

  /* ACTIONS column — buttons flow horizontally without ever splitting a word */
  .grid td[data-label="Actions"], .grid td[data-label="Action"],
  .grid th:last-child, .grid td:last-child {
    min-width: 180px;
    white-space: nowrap;
  }
  .grid td[data-label="Actions"] .btn,
  .grid td[data-label="Actions"] button,
  .grid td:last-child .btn, .grid td:last-child button {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    margin: 2px 2px;
  }
}

/* MOBILE (≤600px): restore the long-URL/serial wrapping ONLY here */
@media (max-width: 600px) {
  .grid.cards-on-mobile td, .detail-grid > div, .desc,
  .form-card, .inline-form {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

/* --- JS-driven .scrollable wrapper: horizontal scroll with nowrap cells --- */
.grid.scrollable {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.grid.scrollable table, .grid.scrollable thead,
.grid.scrollable tbody, .grid.scrollable tr { display: revert; }
.grid.scrollable td, .grid.scrollable th {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}
.grid.scrollable td.wrap { white-space: normal !important; }

/* Hint scrollbar on scrollable tables */
.grid.scrollable::-webkit-scrollbar { height: 10px; }
.grid.scrollable::-webkit-scrollbar-thumb { background: #c1c7d0; border-radius: 5px; }
.grid.scrollable::-webkit-scrollbar-track { background: #f4f5f7; }

/* =========================================================
   FLOATING STICKY HORIZONTAL SCROLL BAR
   A proxy scroll bar pinned to the bottom of the viewport that
   stays reachable no matter how long the table is.
   ========================================================= */
.sticky-hscroll {
  position: fixed;
  bottom: 0;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
  border-top: 1px solid #c1c7d0;
  z-index: 180;
  box-shadow: 0 -2px 6px rgba(9,30,66,.08);
  display: none;                /* JS shows / hides based on viewport */
}
.sticky-hscroll > div { height: 1px; }
.sticky-hscroll::-webkit-scrollbar { height: 14px; }
.sticky-hscroll::-webkit-scrollbar-thumb {
  background: #5e6c84; border-radius: 7px;
}
.sticky-hscroll::-webkit-scrollbar-track { background: #f4f5f7; }

/* Hide the table's own native bottom scrollbar when sticky bar is active —
   keeps just one scrollbar visible */
.grid.scrollable.with-sticky-scroll { scrollbar-width: none; }
.grid.scrollable.with-sticky-scroll::-webkit-scrollbar { display: none; }

/* On mobile (<=600px), use the normal scroll bar — no proxy needed */
@media (max-width: 600px) { .sticky-hscroll { display: none !important; } }

/* =========================================================
   STICKY SCROLL — extend to any element, not just tables
   ========================================================= */

/* Hide the native scrollbar of any element currently proxied by a sticky bar */
.with-sticky-scroll { scrollbar-width: none; }
.with-sticky-scroll::-webkit-scrollbar { display: none; }

/* Opt-in class any view can add to force a horizontal scroll container */
.with-hscroll {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Kanban: give it horizontal scroll when there are too many columns to fit */
@media (min-width: 601px) {
  .kanban {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
}

/* =========================================================
   TABLE WRAP — the FINAL table layout approach
   The <div class="table-wrap"> created by JS around every <table.grid>
   is the horizontal-scroll container. The table itself keeps its native
   table layout at its natural width (not forced to 100%).
   ========================================================= */

.table-wrap {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  /* Hide the native bottom scrollbar — we show a floating sticky one */
  scrollbar-width: none;
}
.table-wrap::-webkit-scrollbar { display: none; }

.table-wrap > table.grid {
  display: table;
  width: max-content;         /* size to content, not forced to 100% */
  min-width: 100%;            /* but never narrower than its container */
  margin: 0;
}

/* On phone, cards-on-mobile takes over and we DON'T want horizontal scroll —
   the table becomes block via its own rules, wrapper stays passive. */
@media (max-width: 600px) {
  .table-wrap {
    overflow-x: visible;
    overflow-y: visible;
  }
  .table-wrap > table.grid.cards-on-mobile {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}

/* Remove the legacy .scrollable rules that were breaking the table layout.
   Now deprecated — the wrapper handles everything. */
.grid.scrollable {
  display: table;             /* undo earlier display:block */
  overflow: visible;
  background: transparent;
}
.grid.scrollable td, .grid.scrollable th {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

/* =========================================================
   WHITESPACE CLEANUP — remove dead gaps everywhere
   ========================================================= */

/* Default margins on common block elements — tighter rhythm */
h1 { margin: 0 0 14px; }
h2 { margin: 0 0 10px; }
h3 { margin: 14px 0 8px; }
p  { margin: 0 0 10px; }

.main {
  padding-top: 20px !important;
  padding-bottom: 28px !important;
}

/* Sections stack with consistent spacing — no extra top margin */
section.cards, .form-card, .list-head, .filters, .page-head,
.detail-grid, .desc, .asset-tabs, .recurring-list, .expiry-alerts,
.recent-list, .charts-grid, .split, .kanban {
  margin-top: 0;
  margin-bottom: 16px;
}
section.cards:last-child, .form-card:last-child { margin-bottom: 0; }

/* Page header spacing */
.page-head { margin-bottom: 14px; }

/* List head spacing */
.list-head { margin: 14px 0 10px; }

/* Remove the empty slack below tables (comes from inline whitespace nodes) */
.table-wrap { margin-bottom: 14px; }
.table-wrap:last-child { margin-bottom: 0; }

/* Tighter tabs */
.asset-tabs { margin: 10px 0 14px; padding: 6px; }

/* Flash messages don't need extra bottom margin when stacked */
.flash { margin-bottom: 12px; }

/* The <main> should have no extra right padding leaking from anywhere */
body.app .main { padding-right: 24px; }
@media (max-width: 900px) { body.app .main { padding-right: 16px; } }
@media (max-width: 600px) { body.app .main { padding-right: 10px; } }

/* Kill phantom bottom margin from the last section in the main area */
body.app .main > *:last-child { margin-bottom: 0; }

/* Prevent runaway vertical rhythm caused by nested .cards + <br> combos */
section.cards > h2 + .stat-row,
section.cards > h2 + .recent-list,
section.cards > h2 + .expiry-alerts,
section.cards > h2 + .recurring-list {
  margin-top: 0;
}

/* =========================================================
   FINAL CLEANUP — row heights + ensure sticky bar visible
   ========================================================= */

/* Compact table rows — eliminate the tall-empty-row issue */
.grid th, .grid td {
  padding: 8px 10px;
  vertical-align: middle;
  line-height: 1.4;
}
.grid td.wrap { vertical-align: top; }

/* Doc upload column — keep inline form compact */
.doc-upload-form { align-items: center; }
.doc-file-label {
  padding: 3px 7px;
  font-size: 11px;
  max-width: 120px;
}

/* Actions column — tight padding on buttons */
.grid td[data-col="actions"] .btn,
.grid td[data-col="actions"] button {
  padding: 4px 8px;
  font-size: 11.5px;
  min-height: 0;
  line-height: 1.4;
  margin: 1px;
}

/* Sticky scroll bar — make it unmissable */
.sticky-hscroll {
  height: 18px !important;
  background: #fff !important;
  border-top: 2px solid #0052cc !important;
  box-shadow: 0 -4px 12px rgba(0,0,0,.15) !important;
  z-index: 500 !important;
}
.sticky-hscroll::-webkit-scrollbar { height: 16px !important; }
.sticky-hscroll::-webkit-scrollbar-thumb {
  background: #0052cc !important;
  border-radius: 8px !important;
  border: 2px solid #fff !important;
}
.sticky-hscroll::-webkit-scrollbar-track { background: #f4f5f7 !important; }

/* Remove the small-text class's row-height inflation */
.small-text { font-size: 12px; line-height: 1.35; }

/* Status badges don't need extra inline height */
.st, .pri, .cat { line-height: 1.3; padding: 2px 8px; }

/* =========================================================
   GROUPED ASSETS — allow horizontal scroll inside group cards
   The .group-card had `overflow:hidden` (for rounded corners),
   which clipped the table-wrap scrollbar underneath.
   ========================================================= */

.group-card {
  overflow: visible !important;      /* was hidden — allow table-wrap to scroll */
}
.group-head {
  border-radius: 10px 10px 0 0;      /* keep the gradient header's own rounded top */
}
.group-card .table-wrap {
  border-radius: 0 0 10px 10px;      /* round the bottom of the scroll area */
  overflow-x: auto;
  overflow-y: hidden;
}
/* Any nested grid table still sized to its natural content width */
.group-card .table-wrap > table.grid {
  width: max-content;
  min-width: 100%;
}

/* =========================================================
   TABLE SCROLL — always show the native scrollbar on wraps
   The sticky floating bar is a bonus; the real scrollbar on each
   .table-wrap must always be visible so tables are always scrollable.
   ========================================================= */

.table-wrap {
  scrollbar-width: thin !important;      /* was: none — show native scrollbar */
  scrollbar-color: #0052cc #f4f5f7;
}
.table-wrap::-webkit-scrollbar {
  display: block !important;             /* was: none */
  height: 12px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #0052cc;
  border-radius: 6px;
  border: 2px solid #f4f5f7;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: #0747a6; }
.table-wrap::-webkit-scrollbar-track { background: #f4f5f7; border-radius: 6px; }

/* Also show on all explicit scrollable containers (kanban, with-hscroll) */
.kanban, .with-hscroll {
  scrollbar-width: thin;
  scrollbar-color: #0052cc #f4f5f7;
}
.kanban::-webkit-scrollbar, .with-hscroll::-webkit-scrollbar { height: 12px; }
.kanban::-webkit-scrollbar-thumb, .with-hscroll::-webkit-scrollbar-thumb {
  background: #0052cc; border-radius: 6px; border: 2px solid #f4f5f7;
}
.kanban::-webkit-scrollbar-track, .with-hscroll::-webkit-scrollbar-track {
  background: #f4f5f7; border-radius: 6px;
}

/* On mobile the table-wrap doesn't scroll (cards layout wins); hide scrollbar */
@media (max-width: 600px) {
  .table-wrap, .table-wrap::-webkit-scrollbar { scrollbar-width: none; }
  .table-wrap::-webkit-scrollbar { display: none !important; }
}

/* =========================================================
   TABLE SCROLL — FINAL BULLETPROOF OVERRIDE
   Ensures .table-wrap always shows horizontal scroll when
   the table inside exceeds its width, regardless of any other rule.
   ========================================================= */
@media (min-width: 601px) {
  div.table-wrap {
    display: block !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    position: relative;
    -webkit-overflow-scrolling: touch;
  }
  div.table-wrap > table.grid {
    display: table !important;
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
    margin: 0 !important;
  }
}

/* Ensure the parent of .table-wrap never clips */
.main > .table-wrap,
.group-card .table-wrap,
.group-card > .table-wrap {
  overflow-x: auto !important;
}
section.cards > .table-wrap { overflow-x: auto !important; }

/* =========================================================
   SIDEBAR ICONS — give emojis a comfortable render box
   ========================================================= */
.side-nav .ic {
  width: 22px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  opacity: 1;
  line-height: 1;
  filter: saturate(0.9);
  flex-shrink: 0;
}
.side-nav a.accent .ic { filter: none; }

/* =========================================================
   SCROLLBAR DEDUPE — only one bar visible at a time
   The JS adds .with-sticky-scroll to every .table-wrap that
   gets the floating sticky bar — hide its native scrollbar.
   ========================================================= */
@media (min-width: 601px) {
  .table-wrap.with-sticky-scroll {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .table-wrap.with-sticky-scroll::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  /* Same treatment for kanban + with-hscroll */
  .kanban.with-sticky-scroll,
  .with-hscroll.with-sticky-scroll {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .kanban.with-sticky-scroll::-webkit-scrollbar,
  .with-hscroll.with-sticky-scroll::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}

/* =========================================================
   FORCED SCROLLBAR HIDE — final overrides, highest specificity
   ========================================================= */
html body.app .table-wrap,
html body .table-wrap,
html body .kanban,
html body .with-hscroll {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
html body .table-wrap::-webkit-scrollbar,
html body .kanban::-webkit-scrollbar,
html body .with-hscroll::-webkit-scrollbar,
html body .table-wrap::-webkit-scrollbar-track,
html body .table-wrap::-webkit-scrollbar-thumb {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* =========================================================
   COLLAPSIBLE SIDEBAR
   ========================================================= */
.side-collapse-btn {
  margin-left: auto;
  background: transparent;
  color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  width: 26px; height: 26px;
  font-size: 16px; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .25s;
  padding: 0;
  box-shadow: none;
}
.side-collapse-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-brand { display: flex; align-items: center; gap: 10px; }
.side-brand-txt { flex: 1; min-width: 0; }

/* COLLAPSED STATE (desktop + tablet) */
@media (min-width: 601px) {
  body.sidebar-collapsed .sidebar { width: 64px; }
  body.sidebar-collapsed.app .main { margin-left: 64px; transition: margin-left .22s; }
  body.sidebar-collapsed .side-app,
  body.sidebar-collapsed .side-tag,
  body.sidebar-collapsed .side-section,
  body.sidebar-collapsed .side-user-info,
  body.sidebar-collapsed .side-nav a > :not(.ic) {
    display: none !important;
  }
  body.sidebar-collapsed .side-brand { justify-content: center; padding: 10px 6px; }
  body.sidebar-collapsed .side-brand-txt { display: none; }
  body.sidebar-collapsed .side-nav a { justify-content: center; padding: 10px; }
  body.sidebar-collapsed .side-nav a .ic { font-size: 16px; }
  body.sidebar-collapsed .side-collapse-btn { transform: rotate(180deg); margin-left: 0; }
  body.sidebar-collapsed .side-user { padding: 8px 4px; }
  body.sidebar-collapsed .side-user-top { justify-content: center; }
  body.sidebar-collapsed .side-user-logout .logout-btn { padding: 5px 6px; font-size: 10px; }
  body.sidebar-collapsed .logout-btn::before { content: '⎋'; }
  body.sidebar-collapsed .logout-btn { font-size: 0; }
  body.sidebar-collapsed .logout-btn::before { font-size: 14px; }
  .sidebar { transition: width .22s; }
}
/* On mobile the collapse button is not useful — hide it */
@media (max-width: 600px) { .side-collapse-btn { display: none; } }

/* =========================================================
   SCROLLBAR — slim + flat (replacing the bulky blue bar)
   ========================================================= */
.sticky-hscroll {
  height: 10px !important;              /* down from 18px */
  background: transparent !important;
  border-top: none !important;
  box-shadow: 0 -1px 4px rgba(0,0,0,.06) !important;
}
.sticky-hscroll::-webkit-scrollbar { height: 8px !important; }
.sticky-hscroll::-webkit-scrollbar-thumb {
  background: rgba(13, 26, 51, .35) !important;
  border-radius: 4px !important;
  border: none !important;
  transition: background .15s;
}
.sticky-hscroll:hover::-webkit-scrollbar-thumb { background: rgba(13, 26, 51, .55) !important; }
.sticky-hscroll::-webkit-scrollbar-track { background: transparent !important; }
/* Firefox */
.sticky-hscroll { scrollbar-width: thin; scrollbar-color: rgba(13,26,51,.35) transparent; }

/* Page vertical scrollbar — slim too */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(94,108,132,.4); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(94,108,132,.65); }
::-webkit-scrollbar-track { background: #f4f5f7; }
html { scrollbar-width: thin; scrollbar-color: rgba(94,108,132,.4) #f4f5f7; }

/* =========================================================
   ADD-NEW MODAL — unified pattern across admin pages
   ========================================================= */
.add-new-wrap { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.add-new-btn {
  background: linear-gradient(180deg, #8dc63f, #6aa032);
  color: #fff !important;
  font-weight: 700;
  padding: 10px 20px;
  border: 1px solid #5a8c2a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: .3px;
  box-shadow: 0 2px 4px rgba(90,140,42,.25);
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.add-new-btn:hover { box-shadow: 0 4px 10px rgba(90,140,42,.35); transform: translateY(-1px); text-decoration: none; }

.add-modal-backdrop {
  position: fixed; inset: 0; background: rgba(13,26,51,.55);
  z-index: 900; display: none; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.add-modal-backdrop.open { display: flex; }
.add-modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 820px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-height: 92vh; display: flex; flex-direction: column;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.add-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #fafbfc, #fff);
  border-radius: 12px 12px 0 0;
}
.add-modal-head h3 { margin: 0; font-size: 16px; color: var(--text); text-transform: none; letter-spacing: 0; }
.add-modal-close {
  background: transparent; border: 1px solid #e5e7eb; color: #5e6c84;
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.add-modal-close:hover { background: #ffebe6; border-color: #de350b; color: #de350b; }
.add-modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.add-modal-body .form-card { padding: 0; margin: 0; border: none; box-shadow: none; background: transparent; }
.add-modal-body section.form-card > h3:first-child { display: none; }

@media (max-width: 600px) {
  .add-modal-backdrop { padding: 12px; align-items: flex-start; }
  .add-modal { max-height: 95vh; }
  .add-modal-head { padding: 12px 14px; }
  .add-modal-body { padding: 14px; }
}

/* =========================================================
   COLLAPSED SIDEBAR v2 — proper clean icon-only rail
   The previous attempt left text nodes visible because
   `> :not(.ic)` doesn't match raw text nodes. Use font-size:0
   on the link + explicit font-size on .ic and reset.
   ========================================================= */

@media (min-width: 601px) {
  body.sidebar-collapsed .sidebar {
    width: 68px !important;
    overflow: hidden;
  }
  body.sidebar-collapsed.app .main { margin-left: 68px !important; }

  /* Brand row — only logo visible, no text */
  body.sidebar-collapsed .side-brand {
    justify-content: center !important;
    padding: 12px 4px !important;
    gap: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  body.sidebar-collapsed .side-brand-txt { display: none !important; }
  body.sidebar-collapsed .side-logo { height: 32px; }

  /* Collapse button — now looks like a tab sticking out, rotated arrow */
  body.sidebar-collapsed .side-collapse-btn {
    margin: 0 !important;
    position: absolute;
    top: 14px;
    right: 6px;
    width: 22px; height: 22px;
    font-size: 12px;
    transform: rotate(180deg);
    background: rgba(255,255,255,.08);
  }

  /* Hide section headers completely */
  body.sidebar-collapsed .side-section { display: none !important; }

  /* Hide nav link text by zeroing font-size; .ic resets to 16px */
  body.sidebar-collapsed .side-nav { padding: 8px 6px !important; }
  body.sidebar-collapsed .side-nav a {
    font-size: 0 !important;       /* hides raw text node after .ic */
    justify-content: center !important;
    padding: 11px 0 !important;
    margin: 2px 0 !important;
    border-radius: 8px;
    position: relative;
  }
  body.sidebar-collapsed .side-nav a > * { font-size: 0 !important; }
  body.sidebar-collapsed .side-nav a .ic {
    font-size: 18px !important;
    width: auto !important;
    margin: 0 !important;
  }

  /* Native tooltip on hover via title attribute would be ideal, but
     we can build a CSS tooltip from the link text that appears to the right */
  body.sidebar-collapsed .side-nav a::after {
    content: attr(aria-label);
    position: absolute;
    left: calc(100% + 6px);
    top: 50%; transform: translateY(-50%);
    background: #0d1a33;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    z-index: 300;
  }
  body.sidebar-collapsed .side-nav a:hover::after { opacity: 1; }

  /* User footer area — just avatar, no text */
  body.sidebar-collapsed .side-user {
    padding: 10px 6px !important;
    align-items: center !important;
  }
  body.sidebar-collapsed .side-user-info { display: none !important; }
  body.sidebar-collapsed .side-user-top {
    justify-content: center !important;
    width: 100%;
  }
  body.sidebar-collapsed .avatar { margin: 0 auto; }

  /* Logout — compact icon-only button */
  body.sidebar-collapsed .side-user-logout .logout-btn {
    width: 40px; height: 32px;
    padding: 0 !important;
    font-size: 0 !important;
    border-radius: 6px;
    position: relative;
  }
  body.sidebar-collapsed .side-user-logout .logout-btn::before {
    content: '⎋';
    font-size: 14px;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Add aria-label to nav links for the CSS tooltip to read.
   We'll do this via JS in header.ejs — see the tweak below. */

/* =========================================================
   COLLAPSE BUTTON — full-width footer, matches reference UI
   ========================================================= */

/* Hide the old top-right collapse button if any template still has it */
.side-collapse-btn { display: none !important; }

/* New footer collapse button */
.side-collapse-footer {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 11px 14px;
  width: 100%;
  background: rgba(255,255,255,.04);
  color: var(--sidebar-mute);
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: all .15s;
  box-shadow: none;
  border-radius: 0;
  flex-shrink: 0;
}
.side-collapse-footer:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.side-collapse-footer .scf-arrow {
  font-size: 15px;
  line-height: 1;
  transition: transform .25s;
}
.side-collapse-footer .scf-text {
  font-size: 12.5px;
}

/* Collapsed state — arrow flips right, text hidden, button stays wide */
@media (min-width: 601px) {
  body.sidebar-collapsed .side-collapse-footer {
    padding: 11px 6px;
    justify-content: center;
    gap: 0;
  }
  body.sidebar-collapsed .side-collapse-footer .scf-arrow {
    transform: rotate(180deg);
    font-size: 16px;
  }
  body.sidebar-collapsed .side-collapse-footer .scf-text {
    display: none;
  }
}

/* On mobile the collapse button doesn't apply (sidebar is a slide-in) */
@media (max-width: 600px) {
  .side-collapse-footer { display: none; }
}

/* =========================================================
   TITLE COMBOBOX — searchable dropdown (type to filter)
   ========================================================= */
.combobox { position: relative; }
.combobox > input[type="text"]:not(#title-other) {
  width: 100%;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235e6c84' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
}
.combobox-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(9,30,66,.15);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}
.combobox-option {
  padding: 9px 14px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid #f4f5f7;
  transition: background .1s;
}
.combobox-option:last-child { border-bottom: none; }
.combobox-option:hover, .combobox-option.active {
  background: #eef3ff;
  color: #0747a6;
  font-weight: 500;
}
.combobox-option mark {
  background: #fff0b3;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* =========================================================
   INLINE-FORM ALIGNMENT POLISH (Replace vendor, Renew, etc.)
   ========================================================= */
.inline-form {
  background: #fff;
  border: 1px solid #c0b6f0;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 4px;
  box-shadow: 0 2px 8px rgba(13,26,51,.06);
}
.inline-form h4 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--navy, #0d1a33);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e8f0;
}
.inline-form .inline-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: 14px 20px !important;
  align-items: start !important;
}
.inline-form label {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin: 0 !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  color: var(--text-mute) !important;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.inline-form label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 11px;
  margin-left: 4px;
}
.inline-form input,
.inline-form select,
.inline-form textarea {
  width: 100% !important;
  min-height: 38px !important;
  margin-top: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  background: #fff !important;
  box-sizing: border-box;
}
.inline-form input:focus,
.inline-form select:focus,
.inline-form textarea:focus {
  outline: none;
  border-color: #0052cc !important;
  box-shadow: 0 0 0 3px rgba(0,82,204,.12) !important;
}
.inline-form .full {
  grid-column: 1 / -1;
}
.inline-form .inline-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid #e5e8f0;
}

/* Mobile: 1 column for inline forms */
@media (max-width: 600px) {
  .inline-form { padding: 14px; }
  .inline-form .inline-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .inline-form .inline-actions { flex-direction: column; }
  .inline-form .inline-actions button,
  .inline-form .inline-actions .btn { width: 100%; text-align: center; }
}

/* =========================================================
   GENERIC FORM ALIGNMENT POLISH (grid-form)
   ========================================================= */
.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.grid-form label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 11px;
}
.grid-form input,
.grid-form select,
.grid-form textarea {
  width: 100%;
  margin-top: 0;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}
/* Mobile — single column + tighter */
@media (max-width: 600px) {
  .grid-form { grid-template-columns: 1fr !important; gap: 12px !important; }
}

/* =========================================================
   ALIGNMENT CROSS-CHECKS (mobile-first polish)
   ========================================================= */

/* All modals: keep child forms well-spaced on phones */
@media (max-width: 600px) {
  .add-modal-body .grid-form,
  .add-modal-body .inline-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .add-modal-body label {
    width: 100%;
  }
  .add-modal-head h3 { font-size: 15px; }
}

/* The Transfer / asset-dialog backdrop used an inline style — ensure its dialogs behave on mobile */
#asset-dialog-backdrop .asset-dlg {
  width: 100%;
  max-width: 620px;
  box-sizing: border-box;
}
#asset-dialog-backdrop .asset-dlg form .inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}
#asset-dialog-backdrop .asset-dlg label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase; letter-spacing: .3px;
  margin: 0;
}
#asset-dialog-backdrop .asset-dlg label .muted {
  text-transform: none; letter-spacing: 0; font-weight: 400;
  font-size: 11px;
}
#asset-dialog-backdrop .asset-dlg input,
#asset-dialog-backdrop .asset-dlg select,
#asset-dialog-backdrop .asset-dlg textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  box-sizing: border-box;
}
#asset-dialog-backdrop .asset-dlg h4 {
  margin: 0 0 14px;
  font-size: 15px;
  color: #0d1a33;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e8f0;
}
#asset-dialog-backdrop .asset-dlg .inline-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e8f0;
  display: flex; gap: 10px; flex-wrap: wrap;
}
@media (max-width: 600px) {
  #asset-dialog-backdrop .asset-dlg .inline-grid { grid-template-columns: 1fr !important; }
  #asset-dialog-backdrop .asset-dlg .inline-actions { flex-direction: column; }
  #asset-dialog-backdrop .asset-dlg .inline-actions button,
  #asset-dialog-backdrop .asset-dlg .inline-actions .btn { width: 100%; text-align: center; }
}

/* Page header actions wrap correctly on mobile */
.page-head .page-actions {
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 600px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .page-actions { width: 100%; flex-direction: row; }
  .page-head .page-actions .btn,
  .page-head .page-actions .add-new-btn,
  .page-head .page-actions button { flex: 1 1 auto; text-align: center; }
}
