:root {
  --primary: #4f46e5;
  --primary-contrast: #ffffff;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;
  --primary-hover: #e0e7ff;
  --sidebar-start: #20205c;
  --sidebar-end: #11132f;
  --sidebar-text: #ffffff;
  --sidebar-muted: rgba(255,255,255,.62);
  --sidebar-nav-text: rgba(255,255,255,.74);
  --sidebar-hover: rgba(255,255,255,.08);
  --sidebar-border: rgba(255,255,255,.10);
  --nav-active: #4f46e5;
  --nav-active-text: #ffffff;
  --background: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #fafbfe;
  --text: #101828;
  --muted: #667085;
  --subtle: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.045);
  --shadow-md: 0 22px 55px rgba(16, 24, 40, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.56; }
a { color: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea { min-height: 115px; resize: vertical; line-height: 1.65; }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
input[type="checkbox"],
input[type="radio"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--primary); }
input[type="color"] { min-height: 48px; padding: 5px; cursor: pointer; }

.primary-button,
.outline-button,
.danger-button,
.success-button,
.danger-outline-button,
.icon-button,
.language-button,
.notification-button,
.square-button {
  border-radius: 12px;
  border: 1px solid transparent;
  min-height: 42px;
  padding: 9px 14px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}
.primary-button { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 22%, transparent); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(0.96); }
.outline-button { background: var(--surface); color: #344054; border-color: var(--border); }
.outline-button:hover:not(:disabled) { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); }
.danger-button { color: #fff; background: #dc2626; }
.success-button { color: #fff; background: #16803a; }
.danger-outline-button { color: #b42318; background: #fff; border-color: #fecdca; }
.danger-outline-button:hover { background: #fff1f0; }
.icon-button { width: 38px; min-height: 38px; padding: 7px; background: #fff; border-color: var(--border); color: #475467; }
.icon-button:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.square-button { width: 44px; padding: 0; display: grid; place-items: center; font-size: 20px; }
.compact-button { min-height: 38px; padding: 7px 11px; font-size: 13px; }
.large-button { min-height: 49px; font-size: 15px; }
.full-button { width: 100%; margin-top: 4px; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 10% 15%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 31%),
    radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.10), transparent 28%),
    linear-gradient(160deg, #fbfcff, #f3f5fa);
}
.auth-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid rgba(228, 231, 236, 0.95);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.10);
}
.auth-brand,
.sidebar-brand,
.branding-preview { display: flex; align-items: center; gap: 13px; }
.brand-logo {
  flex: 0 0 auto;
  min-width: 56px;
  max-width: 132px;
  height: 56px;
  padding: 6px 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 17px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.09);
}
/* Works for square and wide logos: keep the height, let the width follow the logo's shape. */
.brand-logo img { display: block; width: auto; max-width: 100%; height: auto; max-height: 44px; object-fit: contain; background: #fff; }
.auth-brand b, .sidebar-brand b { display: block; font-size: 17px; }
.auth-brand small, .sidebar-brand small, .branding-preview small { display: block; margin-top: 4px; color: var(--muted); }
.auth-heading { margin: 32px 0 23px; }
.auth-heading h1 { margin: 0 0 9px; font-size: clamp(27px, 4vw, 38px); line-height: 1.2; }
.auth-heading p { margin: 0; color: var(--muted); line-height: 1.75; }
.language-button { position: absolute; top: 23px; inset-inline-end: 23px; background: #fff; color: var(--primary); border-color: var(--primary-border); }

.form-grid { display: grid; gap: 14px; }
.form-grid > label { display: grid; gap: 7px; color: #475467; font-size: 13px; font-weight: 600; }
.form-grid > label > small, .help-text { color: var(--subtle); font-weight: 400; line-height: 1.55; }
.two-columns, .two-column-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.three-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.two-columns > label, .two-column-fields > label, .three-columns > label { display: grid; gap: 7px; color: #475467; font-size: 13px; font-weight: 600; }
.checkbox-row { display: flex !important; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; margin-top: 4px; }
.form-error { padding: 11px 13px; border: 1px solid #fecdca; border-radius: 12px; background: #fff1f0; color: #b42318; font-size: 13px; line-height: 1.5; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: var(--sidebar-text);
  background: linear-gradient(180deg, var(--sidebar-start), var(--sidebar-end));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.sidebar-brand { padding: 2px 5px 23px; border-bottom: 1px solid var(--sidebar-border); margin-bottom: 18px; }
/* Logo on top, names underneath, so wide logos never squeeze the company name. */
.sidebar-brand { flex-direction: column; align-items: flex-start; gap: 10px; }
.sidebar-brand .brand-logo { max-width: 100%; height: 64px; padding: 8px 12px; }
.sidebar-brand .brand-logo img { max-height: 48px; }
.sidebar-brand > div:last-child { min-width: 0; max-width: 100%; }
.sidebar-brand small { color: var(--sidebar-muted); }
.sidebar-nav { display: grid; gap: 5px; }
.sidebar-nav button {
  width: 100%;
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--sidebar-nav-text);
  background: transparent;
  text-align: start;
}
.sidebar-nav button span { width: 23px; display: grid; place-items: center; font-size: 17px; }
.sidebar-nav button b { font-size: 13px; font-weight: 650; }
.sidebar-nav button:hover { color: var(--sidebar-text); background: var(--sidebar-hover); }
.sidebar-nav button.active { color: var(--nav-active-text); background: var(--nav-active); box-shadow: 0 12px 24px color-mix(in srgb, var(--primary) 30%, transparent); }
.sidebar-security { display: flex; align-items: flex-start; gap: 10px; margin-top: 22px; padding: 13px; border: 1px solid var(--sidebar-border); border-radius: 14px; background: var(--sidebar-hover); }
.sidebar-security > span { font-size: 20px; }
.sidebar-security b { display: block; font-size: 12px; }
.sidebar-security small { display: block; margin-top: 4px; color: var(--sidebar-muted); font-size: 10px; line-height: 1.45; }
.main-area { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 25px;
  border-bottom: 1px solid rgba(228,231,236,.94);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
}
.topbar h1 { margin: 0; font-size: 19px; }
.topbar > div:first-child small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.notification-button { position: relative; width: 41px; min-height: 41px; padding: 0; display: grid; place-items: center; background: #fff; border-color: var(--border); }
.notification-button > span { position: absolute; top: -7px; inset-inline-end: -7px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 999px; color: #fff; background: #dc2626; font-size: 10px; }
.version-chip { padding: 5px 8px; border: 1px solid var(--primary-border); border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 10px; font-weight: 800; }
.user-summary { min-width: 120px; }
.user-summary b { display: block; font-size: 12px; }
.user-summary small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.content { padding: 26px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-header h2 { margin: 0 0 7px; font-size: clamp(25px, 3vw, 32px); }
.page-header p { max-width: 800px; margin: 0; color: var(--muted); line-height: 1.65; }
.page-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); padding: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.panel-heading h3 { margin: 0 0 6px; font-size: 17px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.eyebrow { display: inline-block; margin-bottom: 7px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; margin-bottom: 17px; }
.kpi-card { min-height: 139px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border-radius: 20px; color: #fff; box-shadow: 0 15px 36px rgba(16,24,40,.10); }
.kpi-card small { opacity: .82; font-weight: 650; }
.kpi-card strong { font-size: 36px; line-height: 1; }
.kpi-card span { font-size: 11px; opacity: .75; }
.kpi-purple { background: linear-gradient(135deg, #6d28d9, #8b5cf6); }
.kpi-blue { background: linear-gradient(135deg, #1d4ed8, #0ea5e9); }
.kpi-amber { background: linear-gradient(135deg, #c2410c, #f59e0b); }
.kpi-slate { background: linear-gradient(135deg, #334155, #64748b); }
.kpi-teal { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.kpi-rose { background: linear-gradient(135deg, #be123c, #f43f5e); }
.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(285px, .72fr); gap: 16px; align-items: start; }
.dashboard-side { display: grid; gap: 16px; }
.recent-panel { min-width: 0; }
.status-bars { display: grid; gap: 14px; }
.status-bar-row { display: grid; gap: 7px; }
.status-bar-row > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.status-progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: #eef1f5; }
.status-progress::-webkit-progress-bar { background: #eef1f5; border-radius: 999px; }
.status-progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.status-progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.progress-pendingApproval::-webkit-progress-value, .progress-pendingApproval::-moz-progress-bar { background: #7c3aed; }
.progress-open::-webkit-progress-value, .progress-open::-moz-progress-bar { background: #2563eb; }
.progress-in_progress::-webkit-progress-value, .progress-in_progress::-moz-progress-bar { background: #f97316; }
.progress-pending::-webkit-progress-value, .progress-pending::-moz-progress-bar { background: #d97706; }
.progress-closed::-webkit-progress-value, .progress-closed::-moz-progress-bar { background: #475569; }
.progress-rejected::-webkit-progress-value, .progress-rejected::-moz-progress-bar { background: #dc2626; }
.rating-summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.rating-summary > div { min-height: 94px; display: grid; place-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.rating-summary span { font-size: 25px; }
.rating-summary b { font-size: 21px; }
.rating-summary small { color: var(--muted); }

.filter-panel { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 10px; margin-bottom: 15px; padding: 14px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-sm); }
.filter-panel input, .filter-panel select { min-height: 41px; font-size: 12px; }
.date-filter { display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.date-filter input { min-height: 41px; }
.report-kpis { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 13px; margin: 0 0 25px; }
.report-kpis article { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; padding: 17px; border-radius: 18px; color: var(--primary-contrast); background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #0ea5e9)); box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 17%, transparent); }
.report-kpis span { font-size: 12px; opacity: .82; }
.report-kpis b { font-size: 30px; }
.report-details-panel { margin-top: 0; }

.table-scroll { max-width: 100%; overflow-x: auto; border-radius: 14px; }
.data-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid #edf0f4; text-align: start; vertical-align: middle; font-size: 12px; }
.data-table th { position: sticky; top: 0; z-index: 1; color: #667085; background: #f8fafc; font-weight: 800; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-ticket-id] { cursor: pointer; }
.data-table tbody tr[data-ticket-id]:hover { background: color-mix(in srgb, var(--primary-soft) 45%, #fff); }
.data-table td small { display: block; margin-top: 4px; color: var(--subtle); }
.empty-cell { padding: 35px !important; text-align: center !important; color: var(--subtle); }
.mono-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; }
.note-cell { max-width: 300px; white-space: normal; line-height: 1.55; }
.unread-pill { display: inline-flex; margin-inline-start: 6px; padding: 3px 7px; border-radius: 999px; color: #fff; background: #dc2626; font-size: 9px; font-weight: 800; vertical-align: middle; }
.category-inline { display: inline-flex; align-items: center; gap: 6px; }

.status-badge,
.approval-badge,
.asset-status,
.state-badge,
.rating-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pending_approval, .approval-pending { color: #6d28d9; background: #ede9fe; }
.status-open { color: #1d4ed8; background: #dbeafe; }
.status-in_progress { color: #c2410c; background: #ffedd5; }
.status-pending { color: #92400e; background: #fef3c7; }
.status-closed { color: #fff; background: #475569; }
.status-rejected, .approval-rejected { color: #b42318; background: #fee4e2; }
.approval-approved { color: #067647; background: #dcfae6; }
.state-active { color: #067647; background: #dcfae6; }
.state-disabled { color: #475467; background: #eaecf0; }
.asset-available { color: #067647; background: #dcfae6; }
.asset-assigned { color: #1d4ed8; background: #dbeafe; }
.asset-maintenance { color: #c2410c; background: #ffedd5; }
.asset-retired { color: #fff; background: #475569; }
.asset-lost { color: #b42318; background: #fee4e2; }
.rating-pill span { font-size: 19px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 23px; background: rgba(15,23,42,.53); backdrop-filter: blur(3px); }
.modal {
  position: relative;
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  scrollbar-gutter: stable;
  padding: 27px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 26px;
  background: #f8fafc;
  box-shadow: 0 32px 100px rgba(15,23,42,.30);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.modal-medium { width: min(650px, 96vw); }
.modal-wide { width: min(1180px, 96vw); }
.modal::-webkit-scrollbar { width: 10px; }
.modal::-webkit-scrollbar-track { background: transparent; margin: 19px 0; }
.modal::-webkit-scrollbar-thumb { border: 2px solid #f8fafc; border-radius: 999px; background: #cbd5e1; }
.modal::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.modal-close { position: sticky; z-index: 5; top: 0; float: inline-end; width: 39px; height: 39px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 11px; color: #475467; background: rgba(255,255,255,.97); font-size: 23px; line-height: 1; }
.modal-heading { padding-inline-end: 50px; margin-bottom: 20px; }
.modal-heading h2 { margin: 0 0 7px; font-size: 25px; }
.modal-heading p { margin: 0; color: var(--muted); line-height: 1.65; }
.ticket-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-inline-end: 49px; margin-bottom: 17px; }
.ticket-modal-header h2 { margin: 8px 0 6px; font-size: 26px; }
.ticket-modal-header p { margin: 0; color: var(--muted); }
.ticket-number { display: inline-flex; padding: 5px 9px; border: 1px solid var(--primary-border); border-radius: 999px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.ticket-badges { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.ticket-layout { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 17px; align-items: start; }
.ticket-main-column { min-width: 0; display: grid; gap: 14px; }
.ticket-side-column { min-width: 0; position: sticky; top: 0; }
.requester-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; }
.requester-grid > article { min-height: 104px; padding: 14px; border: 1px solid var(--border); border-radius: 15px; background: #fff; }
.requester-grid span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.requester-grid b { display: block; font-size: 13px; }
.requester-grid small { display: block; margin-top: 5px; color: var(--subtle); }
.ticket-description h3 { margin: 0 0 10px; }
.description-text { margin: 0; white-space: pre-wrap; line-height: 1.8; }
.approval-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; border: 1px solid #d8b4fe; border-radius: 18px; background: linear-gradient(135deg, #faf5ff, #fff); }
.approval-panel h3 { margin: 0 0 6px; }
.approval-panel p { margin: 0; color: var(--muted); }
.rejection-panel { padding: 13px; border: 1px solid #fecdca; border-radius: 13px; color: #b42318; background: #fff1f0; }
.rejection-panel b { display: block; margin-bottom: 5px; }
.rejection-panel p { margin: 0; line-height: 1.55; }
.conversation-panel { overflow: hidden; }
.conversation-timeline {
  display: grid;
  gap: 11px;
  max-height: min(430px, 52vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  margin-bottom: 14px;
  padding-inline-end: 5px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.conversation-timeline::-webkit-scrollbar { width: 8px; }
.conversation-timeline::-webkit-scrollbar-track { background: transparent; }
.conversation-timeline::-webkit-scrollbar-thumb { border-radius: 999px; background: #cbd5e1; }
.conversation-timeline::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.chat-message { padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.chat-message > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chat-message > header b { font-size: 12px; }
.chat-message > header time { color: var(--subtle); font-size: 10px; }
.chat-message p { margin: 0; white-space: pre-wrap; line-height: 1.7; }
.initial-attachments, .message-attachments { display: grid; gap: 8px; margin-top: 10px; }
.attachment-card { display: flex; align-items: center; gap: 10px; max-width: 570px; padding: 9px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; background: #fff; transition: border-color 120ms ease, transform 120ms ease; }
.attachment-card:hover { border-color: var(--primary-border); transform: translateY(-1px); }
.attachment-card img { width: 108px; height: 78px; flex: 0 0 auto; object-fit: cover; border: 1px solid #eef0f4; border-radius: 9px; }
.attachment-card b { display: block; max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-card small { display: block; margin-top: 4px; color: var(--subtle); font-size: 9px; }
.attachment-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--primary-soft); font-size: 22px; }
.excel-attachment .attachment-icon { background: #e7f6ec; }
.attachment-preview { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; color: inherit; background: none; font: inherit; text-align: start; text-decoration: none; cursor: pointer; }
.attachment-preview > div { min-width: 0; }
.image-attachment .attachment-preview img { cursor: zoom-in; }
.attachment-download { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--primary); background: var(--surface); font-size: 16px; font-weight: 800; text-decoration: none; transition: background 120ms ease, border-color 120ms ease; }
.attachment-download:hover { border-color: var(--primary-border); background: var(--primary-soft); }

.image-viewer { position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; background: rgba(10,14,28,.88); backdrop-filter: blur(4px); }
.image-viewer-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; }
.image-viewer-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.image-viewer-download { min-height: 40px; text-decoration: none; }
.image-viewer-close { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.3); border-radius: 11px; color: #fff; background: rgba(255,255,255,.08); font-size: 24px; line-height: 1; cursor: pointer; }
.image-viewer-close:hover { background: rgba(255,255,255,.18); }
.image-viewer-stage { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 0 16px 16px; }
.image-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.viewer-pdf .image-viewer-stage, .viewer-excel .image-viewer-stage { place-items: stretch; }
.viewer-frame { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #fff; }
.viewer-message { align-self: center; justify-self: center; display: grid; justify-items: center; gap: 12px; max-width: 460px; padding: 28px; border-radius: 16px; background: #fff; color: var(--text); text-align: center; line-height: 1.7; }
.viewer-message span { font-size: 38px; }
.viewer-message p { margin: 0; }
.viewer-message .primary-button { text-decoration: none; }
.viewer-sheet-wrap { display: flex; flex-direction: column; min-height: 0; height: 100%; border-radius: 10px; background: #fff; overflow: hidden; }
.viewer-sheet-tabs { display: flex; gap: 4px; padding: 8px 8px 0; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.viewer-sheet-tabs button { padding: 7px 14px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: #fff; color: #475467; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.viewer-sheet-tabs button.active { color: #05603a; background: #ecfdf3; border-color: #a6f4c5; }
.viewer-sheet { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; padding: 8px; }
.viewer-sheet.hidden { display: none; }
.viewer-sheet-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.viewer-sheet-table { border-collapse: collapse; font-size: 12px; color: #101828; }
.viewer-sheet-table th, .viewer-sheet-table td { padding: 6px 10px; border: 1px solid #e4e7ec; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.viewer-sheet-table thead th { position: sticky; top: 0; z-index: 1; background: #f2f4f7; color: #667085; font-weight: 700; }
.viewer-sheet-table tbody th { position: sticky; inset-inline-start: 0; background: #f9fafb; color: #98a2b3; font-weight: 600; text-align: center; }
.reply-form { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.reply-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachment-input { position: relative; display: inline-flex !important; align-items: center; justify-content: center; min-height: 42px; padding: 9px 13px; border: 1px dashed var(--primary-border); border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 12px !important; font-weight: 750 !important; cursor: pointer; }
.attachment-input input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.reply-form > small, .file-summary { color: var(--subtle); font-size: 10px; }
.ticket-details-card { padding: 21px; overflow: hidden; }
.detail-list { margin: 0 0 16px; }
.detail-list > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid #edf0f4; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { margin: 0; text-align: end; font-size: 11px; font-weight: 750; }
.compact-form { padding-top: 3px; }
.rating-faces { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; }
.rating-faces button { min-height: 92px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.rating-faces button span { display: block; font-size: 28px; }
.rating-faces button b { display: block; margin-top: 5px; font-size: 11px; }
.rating-faces button:hover, .rating-faces button.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.requester-rating { display: grid; gap: 12px; }
.rating-confirmation { display: flex; align-items: center; gap: 13px; }
.rating-confirmation > span { font-size: 33px; }
.rating-confirmation h3 { margin: 0 0 5px; }
.rating-confirmation p { margin: 0; color: var(--muted); }

.profile-layout { display: grid; grid-template-columns: .85fr 1.15fr .75fr; gap: 15px; align-items: start; }
.profile-card { text-align: center; }
.profile-avatar { width: 78px; height: 78px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 23px; color: var(--primary-contrast); background: linear-gradient(135deg, var(--primary), var(--sidebar-start)); font-size: 31px; font-weight: 850; }
.profile-card h2 { margin: 0 0 5px; }
.profile-card > div:nth-child(2) p { margin: 0; color: var(--muted); }
.profile-details { margin: 18px 0 0; text-align: start; }
.profile-details > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.profile-details dt { color: var(--muted); font-size: 11px; }
.profile-details dd { margin: 0; font-weight: 750; font-size: 11px; }
.language-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.language-card { min-height: 90px; border: 1px solid var(--border); border-radius: 15px; color: var(--text); background: #fff; }
.language-card b, .language-card small { display: block; }
.language-card small { margin-top: 4px; color: var(--muted); }
.language-card.selected { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }

.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; align-items: start; }
.settings-card { min-width: 0; }
.branding-preview { min-height: 86px; margin-bottom: 16px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.logo-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.theme-presets { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.theme-option { position: relative; min-height: 64px; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 13px; background: #fff; cursor: pointer; }
.theme-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.theme-swatch { width: 32px; height: 32px; flex: 0 0 auto; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 1px #d0d5dd; background: var(--primary); }
.theme-indigo .theme-swatch { background: #4f46e5; }
.theme-blue .theme-swatch { background: #2563eb; }
.theme-teal .theme-swatch { background: #0f766e; }
.theme-green .theme-swatch { background: #15803d; }
.theme-purple .theme-swatch { background: #7e22ce; }
.theme-rose .theme-swatch { background: #be123c; }
.theme-slate .theme-swatch { background: #334155; }
.theme-white .theme-swatch { background: #ffffff; }
.theme-amber .theme-swatch { background: #d97706; }
.theme-cyan .theme-swatch { background: #0891b2; }
.theme-navy .theme-swatch { background: #1e3a8a; }
.theme-custom .theme-swatch { background: #4f46e5; }
.custom-color-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.custom-color-row.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.custom-color-row b { display: block; margin-bottom: 4px; }
.custom-color-row small { display: block; max-width: 520px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.custom-color-control { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.custom-color-control input[type="color"] {
  width: 48px;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}
.custom-color-control code {
  min-width: 78px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #344054;
  background: #f8fafc;
  direction: ltr;
  text-align: center;
  font-size: 11px;
  font-weight: 750;
}


.security-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 12px; border: 1px solid var(--primary-border); border-radius: 13px; color: #475467; background: var(--primary-soft); }
.security-note p { margin: 0; font-size: 11px; line-height: 1.6; }

.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.role-card { display: grid; gap: 13px; padding: 17px; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); }
.role-card h3 { margin: 0 0 5px; }
.role-card p { margin: 0; color: var(--muted); font-size: 11px; }
.role-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-key { color: var(--primary); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; max-height: 430px; overflow: auto; padding: 11px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.permission-grid label { display: flex !important; align-items: flex-start; gap: 8px; padding: 9px; border: 1px solid #edf0f4; border-radius: 10px; background: var(--surface-soft); }
.permission-grid label span { line-height: 1.4; }
.permission-cell { text-align: center !important; }
.permission-yes, .permission-no { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 999px; font-weight: 900; }
.permission-yes { color: #067647; background: #dcfae6; }
.permission-no { color: #98a2b3; background: #f2f4f7; }

.organization-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.master-heading { min-height: 70px; margin-bottom: 20px; }
.master-list { display: grid; gap: 9px; }
.master-list article { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.master-list article b { display: block; }
.master-list article small { display: block; margin-top: 4px; color: var(--subtle); }
.category-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.category-admin-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 11px; padding: 15px; border: 1px solid var(--border); border-radius: 17px; background: #fff; box-shadow: var(--shadow-sm); }
.category-admin-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); font-size: 24px; }
.category-admin-card h3 { margin: 0 0 4px; font-size: 14px; }
.category-admin-card small { color: var(--subtle); }
.icon-suggestions { display: flex; flex-wrap: wrap; gap: 7px; }
.icon-suggestions button { width: 39px; height: 39px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 19px; }
.icon-suggestions button:hover { border-color: var(--primary); background: var(--primary-soft); }
.category-picker { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; max-height: 365px; overflow: auto; padding: 3px; }
.category-choice { min-height: 108px; padding: 13px; border: 1px solid var(--border); border-radius: 15px; background: #fff; text-align: start; }
.category-choice > span { display: block; margin-bottom: 7px; font-size: 27px; }
.category-choice b { display: block; font-size: 12px; }
.category-choice small { display: block; margin-top: 5px; color: var(--subtle); font-size: 9px; }
.category-choice:hover, .category-choice.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }

.notification-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; }
.notification-list { display: grid; gap: 8px; }
.notification-item { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: #fff; text-align: start; }
.notification-item.unread { border-color: var(--primary-border); background: var(--primary-soft); }
.notification-item.read { opacity: .68; }
.notification-item b { display: block; font-size: 12px; }
.notification-item p { margin: 5px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.notification-item small { color: var(--subtle); font-size: 9px; }
.notification-dot { width: 9px; height: 9px; border-radius: 999px; background: #cbd5e1; }
.notification-item.unread .notification-dot { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.notification-arrow { color: var(--primary); font-size: 17px; }
.empty-state { min-height: 160px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--subtle); text-align: center; }
.empty-state > span { font-size: 31px; }
.compact-empty { min-height: 90px; }

.toast-region { position: fixed; z-index: 300; inset-inline-end: 20px; bottom: 20px; display: grid; gap: 9px; pointer-events: none; }
.toast { max-width: min(390px, 90vw); padding: 12px 14px; border: 1px solid #a6f4c5; border-radius: 13px; color: #05603a; background: #ecfdf3; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(8px); transition: opacity 180ms ease, transform 180ms ease; }
.toast-error { border-color: #fecdca; color: #b42318; background: #fff1f0; }
.toast-show { opacity: 1; transform: translateY(0); }
.fatal-error { display: grid; justify-items: start; gap: 11px; margin-top: 30px; }
.fatal-error > span { font-size: 38px; }
.fatal-error h1, .fatal-error p { margin: 0; }
.fatal-error p { color: var(--muted); line-height: 1.6; }
.fatal-error code { padding: 5px 8px; border-radius: 8px; background: #f2f4f7; }

/* Asset types & numbering */
.asset-tag { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; letter-spacing: .02em; white-space: nowrap; }
td > .asset-tag + small { white-space: nowrap; }
.asset-type-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.asset-type-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); background: var(--surface); font-size: 12px; cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
.asset-type-chip:hover { border-color: var(--primary-border); background: var(--primary-soft); }
.asset-type-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.asset-type-chip small { min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; }
.asset-type-chip.active small { background: var(--primary); color: var(--primary-contrast); }
.asset-tag-preview { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border: 1px dashed var(--primary-border); border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; direction: ltr; justify-content: flex-end; }
[dir="ltr"] .asset-tag-preview { justify-content: flex-start; }
.asset-tag-preview.changing { border-color: #f79009; color: #b54708; background: #fffaeb; }
.field-hint { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.55; }
.four-columns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.numbering-panel { display: grid; gap: 8px; margin-bottom: 14px; }
.numbering-prefix { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.numbering-prefix label { display: grid; gap: 7px; color: #475467; font-size: 13px; font-weight: 600; }
.numbering-prefix input { width: 160px; text-transform: uppercase; }
.numbering-example { display: grid; gap: 4px; padding: 8px 12px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); }
.numbering-example small { color: var(--muted); font-size: 11px; }
.numbering-example b { color: var(--primary); font-size: 15px; }
.asset-type-icon { font-size: 20px; }
.row-disabled td { opacity: .55; }
#assetTypeForm, .danger-zone { margin-top: 14px; }
#assetTypeForm h3, .danger-zone h3 { margin: 0; font-size: 16px; }
.danger-zone { border-color: #fecdca; background: #fffbfa; }
.danger-zone p { margin: 0; color: #475467; font-size: 13px; line-height: 1.8; }

/* Asset Excel import */
.import-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.import-step { display: flex; align-items: flex-start; gap: 12px; }
.import-step h3 { margin: 0 0 6px; font-size: 15px; }
.import-step p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.import-step-number { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: var(--primary-contrast); background: var(--primary); font-weight: 800; }
.import-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.import-pill { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.import-pill-ok { color: #05603a; background: #ecfdf3; border: 1px solid #a6f4c5; }
.import-pill-error { color: #b42318; background: #fff1f0; border: 1px solid #fecdca; }
.import-row-error { background: #fffbfa; }
.import-errors { min-width: 190px; margin: 0; padding-inline-start: 16px; color: #b42318; font-size: 12px; line-height: 1.6; white-space: normal; }
.import-ok { color: #05603a; font-weight: 700; font-size: 12px; }
.muted-text { color: var(--subtle); }
#importPreview .form-actions { margin-top: 12px; }

/* Canned replies */
.reply-footer { flex-wrap: wrap; }
.canned-wrap { position: relative; }
.canned-menu { position: absolute; z-index: 20; bottom: calc(100% + 6px); inset-inline-start: 0; width: min(380px, 80vw); max-height: 320px; overflow-y: auto; display: grid; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); }
.canned-menu.hidden { display: none; }
.canned-item { display: grid; gap: 3px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.canned-item:hover, .canned-item:focus-visible { background: var(--primary-soft); }
.canned-item b { font-size: 13px; }
.canned-item small { color: var(--muted); font-size: 11px; line-height: 1.5; white-space: pre-line; }
.canned-manage { margin-top: 4px; padding: 8px 10px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--primary); font: inherit; font-size: 12px; font-weight: 700; text-align: start; cursor: pointer; }
.canned-body-cell { max-width: 420px; color: #475467; font-size: 12px; line-height: 1.6; white-space: pre-line; }
.canned-placeholders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.placeholder-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px dashed var(--primary-border); border-radius: 999px; background: var(--primary-soft); color: var(--primary); font: inherit; font-size: 11px; cursor: pointer; }
.placeholder-chip code { direction: ltr; font-weight: 800; }
.canned-token { display: inline-block; padding: 0 5px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; unicode-bidi: isolate; }

/* Handover / return form */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-soft); width: fit-content; max-width: 100%; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #475467; }
.segmented input:checked + span { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 6px 14px color-mix(in srgb, var(--primary) 25%, transparent); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.handover-assets-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.handover-assets-head h3 { margin: 0; font-size: 15px; }
.handover-assets-head input { max-width: 280px; }
.handover-asset-list { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.handover-asset { padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.handover-asset.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 60%, #fff); }
.handover-asset-main { display: flex !important; align-items: center; gap: 10px; cursor: pointer; }
.handover-asset-main small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.handover-asset-extra { display: grid; grid-template-columns: 160px 1fr; gap: 10px; margin-top: 8px; padding-inline-start: 28px; }
.handover-asset-extra label { display: grid; gap: 4px; font-size: 11px; color: var(--muted); }
.handover-group-title { margin: 6px 0 2px; font-size: 13px; color: #344054; }
.custody-badge { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: #ecfdf3; color: #05603a; font-size: 11px; font-weight: 700; }
.handover-extra-row { display: grid; grid-template-columns: 1.4fr 1fr 72px 130px 1.2fr 38px; gap: 8px; margin-bottom: 8px; }
@media (max-width: 780px) {
  .handover-extra-row { grid-template-columns: 1fr 1fr; }
  .handover-asset-extra { grid-template-columns: 1fr; padding-inline-start: 0; }
}

/* Printable handover sheet (on screen: full-page preview; on paper: the sheet only) */
.print-document { position: fixed; inset: 0; z-index: 400; overflow-y: auto; background: #e5e7eb; }
.print-document-toolbar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.print-document-toolbar b { flex: 1 1 auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.print-document-page { width: min(210mm, 100%); margin: 20px auto; padding: 14mm 12mm; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.handover-sheet { color: #111827; font-size: 12px; }
.handover-sheet-head { display: grid; grid-template-columns: 170px 1fr 180px; align-items: center; gap: 12px; margin-bottom: 14px; }
.handover-sheet-head img { max-width: 170px; max-height: 66px; object-fit: contain; }
.handover-sheet-title { text-align: center; border: 1.5px solid #111827; padding: 8px; }
.handover-sheet-title h1 { margin: 0; font-size: 18px; }
.handover-sheet-title span { display: block; margin-top: 2px; color: #6b7280; font-size: 11px; letter-spacing: .04em; }
.handover-sheet-meta { margin: 0; display: grid; gap: 4px; }
.handover-sheet-meta div { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px solid #e5e7eb; padding-bottom: 3px; }
.handover-sheet-meta dt { color: #6b7280; }
.handover-sheet-meta dd { margin: 0; font-weight: 800; direction: ltr; white-space: nowrap; }
.handover-sheet-meta dt { white-space: nowrap; }
.handover-sheet-info { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid #111827; margin-bottom: 12px; }
.handover-sheet-info div { display: flex; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #d1d5db; }
.handover-sheet-info div:nth-child(odd) { border-inline-end: 1px solid #d1d5db; }
.handover-sheet-info div:nth-last-child(-n+2) { border-bottom: 0; }
.handover-sheet-info span { color: #6b7280; min-width: 92px; }
.handover-sheet-blank { flex: 1; min-height: 18px; border-bottom: 1px dotted #9ca3af; }
.branch-custody { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eff8ff; color: #175cd3; font-size: 12px; font-weight: 700; white-space: nowrap; }
.handover-sheet-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.handover-sheet-table th { padding: 8px 6px; border: 1px solid #111827; background: #d35400; color: #fff; font-size: 11px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.handover-sheet-table td { padding: 8px 6px; border: 1px solid #111827; text-align: center; font-weight: 600; }
.handover-sheet-table td:nth-child(2), .handover-sheet-table th:nth-child(2) { white-space: nowrap; }
.handover-sheet-notes { margin: 0 0 10px; }
.handover-sheet-ack { margin: 0 0 16px; padding: 10px 12px; border: 1px dashed #9ca3af; background: #f9fafb; line-height: 1.9; }
.handover-sheet-ack p { margin: 0; }
.handover-sheet-ack p[lang="en"] { margin-top: 6px; padding-top: 6px; border-top: 1px dotted #d1d5db; text-align: left; line-height: 1.6; color: #374151; font-size: 11px; }
/* Bilingual form: English line under each Arabic label */
.handover-sheet .bi-en { display: block; font-style: normal; font-weight: 500; font-size: 9.5px; color: #6b7280; direction: ltr; letter-spacing: .01em; }
.handover-sheet-table th .bi-en { color: rgba(255, 255, 255, .85); }
.handover-sheet-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.handover-sheet-signatures div { border: 1px solid #111827; padding: 10px 12px; }
.handover-sheet-signatures h3 { margin: 0 0 8px; font-size: 13px; }
.handover-sheet-signatures p { display: flex; align-items: flex-end; gap: 6px; margin: 0 0 10px; }
.handover-sheet-signatures p span { color: #6b7280; min-width: 50px; white-space: nowrap; }
.handover-sheet-signatures i { flex: 1; height: 28px; border-bottom: 1px solid #111827; }
.handover-sheet-foot { padding-top: 8px; border-top: 1px solid #e5e7eb; color: #9ca3af; font-size: 10px; text-align: center; }
@media (max-width: 640px) {
  .handover-sheet-head { grid-template-columns: 1fr; text-align: center; }
  .handover-sheet-head img { margin: 0 auto; }
  .handover-sheet-info, .handover-sheet-signatures { grid-template-columns: 1fr; }
  .handover-sheet-table { font-size: 10px; }
}

@media print {
  @page { size: A4; margin: 10mm; }
  body.printing-document > *:not(#printDocument) { display: none !important; }
  body.printing-document { background: #fff !important; }
  body.printing-document .print-document { position: static; overflow: visible; background: #fff; }
  body.printing-document .print-document-toolbar { display: none !important; }
  body.printing-document .print-document-page { width: auto; margin: 0; padding: 0; box-shadow: none; }
}

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .profile-layout { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .category-admin-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-panel { grid-template-columns: repeat(4, minmax(145px,1fr)); }
}

@media (max-width: 1030px) {
  .app-shell { grid-template-columns: 220px minmax(0,1fr); }
  .dashboard-layout, .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side-column { position: static; }
  .ticket-details-card { max-width: none; }
  .settings-grid, .profile-layout { grid-template-columns: 1fr; }
  .role-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .permission-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-panel { grid-template-columns: repeat(3, minmax(140px,1fr)); }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 16px; }
  .sidebar-brand { margin-bottom: 12px; padding-bottom: 14px; }
  .sidebar-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar-security { display: none; }
  .topbar { position: relative; padding: 14px 16px; align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .user-summary { display: none; }
  .content { padding: 16px; }
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filter-panel { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .report-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .organization-grid { grid-template-columns: 1fr; }
  .category-picker { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .requester-grid { grid-template-columns: 1fr; }
  .three-columns, .two-columns, .two-column-fields { grid-template-columns: 1fr; }
  .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-steps { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 10px; }
  .modal { width: 100%; max-height: 96vh; padding: 19px; border-radius: 20px; }
  .ticket-modal-header { flex-direction: column; }
  .ticket-badges { justify-content: flex-start; }
  .approval-panel { flex-direction: column; align-items: flex-start; }
  .rating-faces { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 520px) {
  .auth-shell { padding: 12px; }
  .auth-panel { padding: 24px 19px; border-radius: 21px; }
  .language-button { top: 16px; inset-inline-end: 16px; }
  .sidebar-nav { grid-template-columns: 1fr; }
  .topbar > div:first-child small, .version-chip { display: none; }
  .kpi-grid, .filter-panel, .report-kpis, .role-grid, .category-admin-grid, .category-picker, .theme-presets, .rating-faces, .language-cards { grid-template-columns: 1fr; }
  .kpi-card { min-height: 118px; }
  .page-actions > button { flex: 1 1 auto; }
  .reply-footer { align-items: stretch; flex-direction: column; }
  .attachment-card { align-items: flex-start; }
  .attachment-card img { width: 86px; height: 68px; }

  .notification-heading { flex-direction: column; }
}

@media print {
  .sidebar, .topbar, .page-actions, .filter-panel, .modal-backdrop, .toast-region, button { display: none !important; }
  body, .app-shell, .main-area, .content { display: block; min-height: 0; background: #fff; padding: 0; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  .data-table { min-width: 0; font-size: 9px; }
  .data-table th, .data-table td { padding: 6px; }
  .report-kpis { grid-template-columns: repeat(5, 1fr); }
  .report-kpis article { min-height: 80px; color: #111; background: #f3f4f6; box-shadow: none; border: 1px solid #ddd; }
}
.ticket-table-compact { min-width: 620px; }
input[type="email"], input[type="url"], input[name="host"], input[name="user"], input[name="fromEmail"], input[name="serialNumber"], input[name="assetTag"] { direction: ltr; text-align: left; }

.message-unread-pill {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: #d92d20;
  box-shadow: 0 5px 12px rgba(217,45,32,.20);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}
.logo-upload-preview {
  min-height: 105px;
  display: grid;
  place-items: center;
  margin: 12px 0;
  padding: 12px;
  border: 1px dashed var(--primary-border);
  border-radius: 14px;
  background: var(--primary-soft);
}
.logo-upload-preview img {
  max-width: min(280px, 100%);
  max-height: 92px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}


/* v3.0.8 asset action polish retained below */
.table-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.asset-delete-button {
  color: #b42318;
  border-color: #fecdca;
  background: #fff7f6;
}
.asset-delete-button:hover:not(:disabled) {
  color: #fff;
  border-color: #d92d20;
  background: #d92d20;
}


/* v3.0.9 — field alignment and localized custom file chooser */
.user-language-password-row > label,
.ticket-create-control-row > label {
  grid-template-rows: auto 44px auto;
  align-content: start;
}

.user-language-password-row > label > input,
.user-language-password-row > label > select,
.ticket-create-control-row > label > select,
.ticket-create-control-row .custom-file-control {
  height: 44px;
  min-height: 44px;
}

.field-help-spacer {
  visibility: hidden;
  min-height: 20px;
}

.custom-file-control {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 44px;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.custom-file-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.custom-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.custom-file-button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-inline-end: 1px solid var(--border);
  border-radius: 0;
  color: #344054;
  background: #f8fafc;
  font-weight: 750;
  white-space: nowrap;
}

[dir="rtl"] .custom-file-button {
  border-inline-end: 0;
  border-inline-start: 1px solid var(--border);
}

.custom-file-button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.custom-file-summary {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  padding-inline: 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* v3.0.10 — authentication recovery UI */
.auth-inline-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: -2px;
}

.auth-link-button {
  padding: 3px 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-button:hover {
  color: color-mix(in srgb, var(--primary) 78%, #000);
}

.auth-notice,
.auth-success {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.7;
}

.auth-notice {
  margin-bottom: 14px;
  border: 1px solid #fedf89;
  color: #854a0e;
  background: #fffaeb;
}

.auth-success {
  border: 1px solid #abefc6;
  color: #067647;
  background: #ecfdf3;
}


/* v3.1.0 — MySQL backup/restore and email administration */
.settings-action-row { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.backup-card { grid-column:1 / -1; }
.backup-subform { padding-top:4px; }
.backup-subform h4 { margin:0 0 2px; font-size:15px; }
.backup-divider { height:1px; margin:22px 0; background:var(--border); }
.danger-note { display:flex; gap:10px; align-items:flex-start; padding:12px 14px; border:1px solid #fecdca; border-radius:12px; background:#fef3f2; color:#912018; }
.danger-note p { margin:0; font-size:12px; line-height:1.7; }
.danger-button { min-height:42px; padding:10px 16px; border:1px solid #d92d20; border-radius:10px; background:#d92d20; color:#fff; font-weight:800; }
.danger-button:hover { background:#b42318; }
.danger-button:disabled { opacity:.55; cursor:not-allowed; }
#backupFileName { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Asset quantity (cameras / NVRs): a 4th narrow field in the serial row */
.three-columns.with-quantity { grid-template-columns: repeat(3, minmax(0, 1fr)) 110px; }
@media (max-width: 780px) { .three-columns.with-quantity { grid-template-columns: 1fr; } }
.quantity-badge { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-border); font-size: 12px; font-weight: 700; vertical-align: middle; }
