/* ============================================================
   Support Gelex — design system (light only)
   ============================================================ */
:root {
  /* Brand GELEX — đỏ */
  --brand-50: #fef2f2;
  --brand-100: #fee2e2;
  --brand-200: #fecaca;
  --brand-500: #ef4444;
  --brand-600: #dc2626;
  --brand-700: #b91c1c;
  --brand-800: #991b1b;
  --brand-900: #7f1d1d;

  /* Surfaces & neutrals (cool slate) */
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e9eef4;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;

  /* Semantic */
  --success: #059669;  --success-bg: #ecfdf5;  --success-border: #a7f3d0;  --success-text: #065f46;
  --warning: #d97706;  --warning-bg: #fffbeb;  --warning-border: #fde68a;  --warning-text: #92400e;
  --danger:  #dc2626;  --danger-bg:  #fef2f2;  --danger-border:  #fecaca;  --danger-text:  #991b1b;
  --info:    #2563eb;  --info-bg:    #eff6ff;  --info-border:    #bfdbfe;  --info-text:    #1e40af;

  /* Elevation & shape */
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .05);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / .08), 0 2px 4px -2px rgb(15 23 42 / .05);
  --shadow-lg: 0 24px 48px -12px rgb(15 23 42 / .25);
  --radius: 14px;
  --radius-sm: 9px;
  --focus-ring: 0 0 0 3px rgb(220 38 38 / .22);
  --sidebar-w: 248px;
  --topbar-h: 60px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: light only;
}

* { box-sizing: border-box; }
/* Author display rules must never defeat the hidden attribute
   (e.g. .local-login-form, #supportedUserField set their own display). */
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: .2rem; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; margin-bottom: .5rem; }
a { color: var(--brand-700); }
.icon { flex: 0 0 auto; vertical-align: -0.18em; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* ---------- Buttons ---------- */
button, .button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--brand-600); color: #fff; font-weight: 600; font-size: .92rem;
  padding: .52rem .95rem; cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
button:hover, .button-link:hover { background: var(--brand-700); }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-secondary {
  background: var(--surface); color: var(--text-2); border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.button-secondary:hover { background: var(--surface-2); color: var(--text); }
.button-ghost { background: transparent; color: var(--text-2); }
.button-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Inputs ---------- */
input, select, textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); padding: .5rem .65rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { border-color: var(--brand-500); box-shadow: var(--focus-ring); outline: none; }
textarea { resize: vertical; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
fieldset { border: 0; margin: 0; padding: 0; }
fieldset legend { font-weight: 600; font-size: .92rem; padding: 0; }
fieldset label { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-weight: 400; }
fieldset input { width: auto; accent-color: var(--brand-600); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--brand-600); }

/* ============================================================
   App shell: sidebar + topbar
   ============================================================ */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.1rem .85rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: .6rem; color: var(--text);
  font-size: 1.02rem; font-weight: 750; letter-spacing: -0.01em; text-decoration: none;
  padding: .35rem .55rem; margin-bottom: .6rem;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-800));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px -2px rgb(220 38 38 / .45);
}
.brand small { display: block; font-size: .72rem; font-weight: 500; color: var(--text-3); letter-spacing: .02em; }

.side-nav { display: grid; gap: .15rem; }
.side-link {
  display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem;
  border-radius: var(--radius-sm); color: var(--text-2); font-weight: 550; font-size: .93rem;
  text-decoration: none; border: 0; background: transparent; justify-content: flex-start;
  transition: background .12s ease, color .12s ease;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.is-active { background: var(--brand-50); color: var(--brand-800); font-weight: 650; }
.side-link.is-active .icon { color: var(--brand-600); }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: .75rem; display: grid; gap: .4rem; }
.sidebar-user { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand-100); color: var(--brand-800); font-size: .8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase;
}
.avatar-lg { width: 40px; height: 40px; font-size: .95rem; }
.sidebar-user div { min-width: 0; }
.sidebar-user strong { display: block; font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { display: block; font-size: .75rem; color: var(--text-3); }
.sidebar-logout {
  justify-content: flex-start; background: transparent; color: var(--text-2);
  font-weight: 550; box-shadow: none;
}
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); }
.sidebar-message { color: var(--danger-text); font-size: .8rem; margin: 0; padding: 0 .5rem; }

.app-body { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 1rem;
  background: rgb(255 255 255 / 85%); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 10;
}
/* Global search trigger (opens the ⌘K palette) */
.global-search {
  display: inline-flex; align-items: center; gap: .55rem; max-width: 440px; width: 100%;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-sm);
  box-shadow: none; color: var(--text-3); font-weight: 450; font-size: .92rem;
  padding: .52rem .75rem; justify-content: flex-start;
}
.global-search:hover { background: var(--surface-3); color: var(--text-2); }
.global-search span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search kbd, .palette-input kbd {
  font-family: var(--font-sans); font-size: .68rem; font-weight: 650; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: .08rem .38rem;
}

/* GELEX wordmark (public/logo.svg, ~3.75:1 aspect) */
.brand-logo { height: 24px; width: auto; display: block; }
.login-logo { height: 20px; width: auto; display: block; }
.feedback-logo { height: 22px; width: auto; display: block; }
.brand { align-items: center; }
.brand > span { line-height: 1.15; }

/* Nav badge (ticket count on the Yêu cầu link) */
.nav-badge {
  font-style: normal; background: var(--brand-600); color: #fff; font-size: .68rem; font-weight: 700;
  border-radius: 999px; padding: .06rem .45rem; margin-left: auto; line-height: 1.5;
}
.topbar-meta { margin-left: auto; color: var(--text-3); font-size: .85rem; white-space: nowrap; }
.topbar-logout {
  display: none; background: transparent; color: var(--text-2); padding: .5rem;
  margin-left: auto; flex: 0 0 auto;
}
.topbar-logout:hover { background: var(--danger-bg); color: var(--danger); }

.app-main { margin: 0 auto; max-width: 1200px; width: 100%; padding: 1.75rem 1.5rem 4rem; }

/* ---------- Page headings ---------- */
.page-heading, .section-heading { align-items: flex-start; display: flex; gap: 1rem; justify-content: space-between; }
.page-heading { margin-bottom: 1.25rem; }
.page-heading p, .section-heading p { color: var(--text-3); margin-bottom: 0; font-size: .95rem; }

/* ---------- Cards (unified) ---------- */
.ticket-form-panel, .ticket-list, .feedback-card, .report-section, .integration-panel, .card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.15rem;
}
.ticket-form-panel { margin-bottom: 1.25rem; }
.ticket-form-panel form { display: grid; gap: .85rem; margin-top: 1rem; max-width: 700px; }
.ticket-form-panel form > button { justify-self: start; }
.ticket-form-panel #supportedUserField { display: grid; gap: .35rem; }

/* ---------- Notices / states ---------- */
.glpi-link-status {
  align-items: center; background: var(--warning-bg); border: 1px solid var(--warning-border);
  border-radius: 999px; color: var(--warning-text); display: flex; gap: 1rem;
  justify-content: space-between; margin: 0 0 1.1rem; padding: .5rem .6rem .5rem 1.1rem; font-size: .88rem;
}
.glpi-link-status strong { display: block; font-size: .86rem; }
.glpi-link-status > button { border-radius: 999px; padding: .4rem .95rem; font-size: .84rem; }
.glpi-link-status strong { display: block; }
.glpi-link-status p { margin: .2rem 0 0; }
.glpi-link-status > button { background: var(--warning); flex: 0 0 auto; }
.glpi-link-status > button:hover { background: #b45309; }
.glpi-link-status.is-linked { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }

.state {
  border-radius: var(--radius-sm); color: var(--text-2); margin: 1rem 0; padding: 1rem;
  text-align: center; font-size: .95rem;
}
.state.loading { background: var(--info-bg); color: var(--info-text); }
.state.error, .form-error { background: var(--danger-bg); color: var(--danger-text); }
.state.error button { margin-top: .6rem; background: var(--danger-text); }
.state.error button:hover { background: #7f1d1d; }
.state.empty { background: var(--surface-2); color: var(--text-3); }
.state.success { background: var(--success-bg); color: var(--success-text); }
.form-error { border-radius: var(--radius-sm); margin: 0; padding: .65rem; font-size: .9rem; }

/* Skeleton loading shimmer */
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(100deg, var(--surface-2) 40%, var(--surface-3) 50%, var(--surface-2) 60%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-row { display: grid; grid-template-columns: 64px 1fr 130px 110px 120px 130px; gap: .9rem; align-items: center; padding: .8rem .25rem; }
.skeleton-row .skeleton { height: 14px; }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex; flex-wrap: wrap; gap: .2rem; margin: -.15rem 0 1rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .25rem;
}
.tab {
  background: transparent; color: var(--text-2); font-weight: 550;
  border-radius: 999px; padding: .45rem .95rem; transition: background .12s ease, color .12s ease;
}
.tab:hover { background: rgb(255 255 255 / .75); color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--brand-800); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ---------- Filter bar ---------- */
.filter-bar { align-items: center; display: grid; gap: .5rem; grid-template-columns: repeat(8, minmax(120px, 1fr)) auto auto; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select {
  border-radius: 999px; height: 38px; background: var(--surface-2); border-color: transparent;
  font-size: .88rem; padding: .3rem .95rem;
}
.filter-bar input:focus, .filter-bar select:focus { background: var(--surface); }
.filter-bar > button { border-radius: 999px; height: 38px; padding: .3rem .95rem; font-size: .88rem; }
.filter-bar input[type="search"] { padding-left: 1.1rem; }
.filter-bar .assignee-filter { position: relative; }
.user-picker { position: relative; }
.user-results {
  background: var(--surface); border-radius: var(--radius-sm); color: var(--text-2); font-size: .9rem;
  left: 0; max-height: 190px; overflow: auto; position: absolute; right: 0; top: calc(100% + .3rem);
  z-index: 5; box-shadow: var(--shadow-md);
}
.user-results:has(*) { border: 1px solid var(--border); }
.user-results button {
  background: var(--surface); border-radius: 0; color: var(--text); display: grid; gap: .1rem;
  padding: .55rem .65rem; text-align: left; width: 100%; box-shadow: none; font-weight: 500;
}
.user-results button:hover { background: var(--brand-50); }
.user-results small, #supportedUserSelected { color: var(--text-3); font-weight: 400; }
.ticket-form-panel .user-results { position: static; box-shadow: none; }

/* ---------- Badges & priority ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
  font-size: .76rem; font-weight: 650; padding: .18rem .6rem; white-space: nowrap; line-height: 1.5;
}
.badge--info    { background: var(--info-bg);    color: var(--info-text); }
.badge--success { background: var(--success-bg); color: var(--success-text); }
.badge--warning { background: var(--warning-bg); color: var(--warning-text); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge--brand   { background: var(--brand-50);   color: var(--brand-800); }
/* "Đang xử lý" needs its own tint: the brand is red, so a red badge here
   would read as an error/urgent state. */
.badge--processing { background: #eef2ff; color: #4338ca; }
.badge--neutral { background: var(--surface-2);  color: var(--text-2); }

.priority { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--text-2); white-space: nowrap; }
.priority::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.priority--low::before      { background: #94a3b8; }
.priority--medium::before   { background: #3b82f6; }
.priority--high::before     { background: #f59e0b; }
.priority--critical::before { background: #ef4444; box-shadow: 0 0 0 3px var(--danger-bg); }

.code-mono { font-family: var(--font-mono); font-size: .84rem; color: var(--text-3); font-weight: 600; }

/* ============================================================
   Smart-list & feedback components (toasts, palette, sort, …)
   ============================================================ */

/* Toasts */
.toast-host {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
  display: grid; gap: .55rem; max-width: min(380px, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: center; gap: .6rem; padding: .7rem .95rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--info);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); font-size: .9rem;
  color: var(--text-2); cursor: pointer; animation: toastIn .18s ease;
}
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }
.toast.is-leaving { opacity: 0; transition: opacity .18s ease; }
.toast--success { border-left-color: var(--success); } .toast--success .icon { color: var(--success); }
.toast--warning { border-left-color: var(--warning); } .toast--warning .icon { color: var(--warning); }
.toast--error   { border-left-color: var(--danger); }  .toast--error .icon { color: var(--danger); }
.toast--info    { border-left-color: var(--info); }    .toast--info .icon { color: var(--info); }

/* ⌘K palette */
.palette-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgb(15 23 42 / 45%);
  backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start;
  padding: 10vh 1rem 1rem; animation: fadeIn .12s ease;
}
.palette {
  width: min(560px, 100%); background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: popIn .15s ease;
}
.palette-input { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input input { border: 0; box-shadow: none; padding: 0; font-size: 1rem; background: transparent; }
.palette-input input:focus { box-shadow: none; }
.palette-results { max-height: 340px; overflow-y: auto; padding: .35rem; }
.palette-item {
  display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left;
  background: transparent; box-shadow: none; color: var(--text-2); font-weight: 500;
  border-radius: var(--radius-sm); padding: .55rem .7rem; justify-content: flex-start;
}
.palette-item.is-active, .palette-item:hover { background: var(--brand-50); color: var(--brand-800); }
.palette-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.palette-item-sub { color: var(--text-3); font-size: .78rem; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: 1rem; color: var(--text-3); font-size: .88rem; text-align: center; }
.palette-footer { display: flex; gap: 1rem; padding: .5rem 1rem; border-top: 1px solid var(--border); color: var(--text-3); font-size: .74rem; }

/* Tab counts, sort, pagination */
.tab-count {
  display: inline-block; background: var(--surface-2); color: var(--text-2); font-size: .72rem;
  font-weight: 700; border-radius: 999px; padding: .04rem .45rem; margin-left: .25rem; vertical-align: 1px;
}
.tab.is-active .tab-count { background: var(--brand-100); color: var(--brand-800); }
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--text-2); }
.sort-arrow { color: var(--brand-600); margin-left: .15rem; }
.pagination-controls { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.page-btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2);
  box-shadow: none; min-width: 34px; padding: .4rem .5rem; font-weight: 600; font-size: .88rem;
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.page-ellipsis { color: var(--text-3); padding: 0 .15rem; }
.per-page { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; font-size: .85rem; color: var(--text-3); }
.per-page select { width: auto; padding: .3rem .4rem; }

/* KPI drill-down + see-all */
.kpi-link { cursor: pointer; text-align: left; box-shadow: var(--shadow-sm); transition: box-shadow .12s ease, transform .12s ease; }
.kpi-link:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.see-all { padding: .3rem .5rem; font-size: .85rem; }

/* Autocomplete keyboard highlight */
.user-results button.is-active { background: var(--brand-50); }

/* Users: role confirm, entity chips, password tools */
.role-confirm { display: grid; gap: .35rem; }
.role-confirm-actions { display: flex; gap: .4rem; }
.role-confirm-actions button { padding: .35rem .7rem; font-size: .84rem; }
.entity-scope-editor { display: grid; gap: .55rem; }
.entity-scope-search { max-width: 220px; }
.entity-chip-list { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 150px; overflow-y: auto; }
.entity-chip {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 999px; padding: .28rem .7rem .28rem .45rem;
  font-size: .84rem; font-weight: 550; color: var(--text-2); background: var(--surface);
  transition: background .1s ease, border-color .1s ease;
}
.entity-chip:hover { border-color: var(--brand-500); }
.entity-chip:has(input:checked) { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-800); }
.entity-chip input { width: auto; accent-color: var(--brand-600); margin: 0; }
.password-input-row { display: flex; gap: .45rem; align-items: center; }
.password-input-row input { flex: 1; }
.password-visibility { padding: .35rem .6rem; font-size: .84rem; flex: 0 0 auto; }
.password-modal-tools { display: flex; gap: .4rem; margin-top: .4rem; }
.password-modal-tools button { padding: .32rem .6rem; font-size: .82rem; }

/* Ticket form: segmented options + draft note */
.seg-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-options label {
  display: inline-flex; align-items: center; gap: .4rem; font-weight: 550; font-size: .9rem;
  border: 1px solid var(--border-strong); border-radius: 999px; padding: .35rem .8rem;
  cursor: pointer; color: var(--text-2); background: var(--surface);
}
.seg-options label:has(input:checked) { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-800); }
.seg-options input { width: auto; accent-color: var(--brand-600); margin: 0; }
.draft-note { color: var(--text-3); font-size: .82rem; margin: 0; }

/* Type cards need the full row; the category picker sits on its own row below. */
.request-category-fields { display: grid; gap: 1rem; }

.field { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.field-label { color: var(--text); }

/* Category picker: searchable, grouped, keyboard-friendly */
.category-picker { position: relative; }
.category-picker-input { padding-right: 2.4rem; }
.category-picker-clear {
  position: absolute; right: .45rem; top: calc(50% + .15rem); transform: translateY(-50%);
  background: transparent; box-shadow: none; color: var(--text-3); padding: .3rem .45rem; border-radius: 6px;
}
.category-picker-clear:hover { background: var(--surface-2); color: var(--danger); }
.category-picker-results { max-height: 260px; }
.category-picker-group { color: var(--text-3); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .5rem .65rem .2rem; }
.category-picker-results button small { color: var(--text-3); }
.category-picker-results button .is-selected-mark { color: var(--brand-600); margin-left: auto; }
.category-picker-hint { color: var(--text-3); font-size: .76rem; margin: .3rem 0 0; }

/* Smart create-ticket form */
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.title-suggest {
  background: transparent; box-shadow: none; color: var(--brand-700);
  font-size: .78rem; font-weight: 600; padding: .15rem .4rem; border-radius: 6px;
}
.title-suggest:hover { background: var(--brand-50); }
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .5rem; }
.type-card {
  display: flex; align-items: flex-start; gap: .55rem; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: .6rem .7rem; background: var(--surface);
  transition: border-color .12s ease, background .12s ease;
}
.type-card:hover { border-color: var(--brand-500); }
.type-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); box-shadow: var(--focus-ring); }
.type-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.type-card-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.type-card:has(input:checked) .type-card-icon { background: var(--brand-600); color: #fff; }
.type-card-copy strong { display: block; font-size: .88rem; color: var(--text); }
.type-card-copy small { display: block; color: var(--text-3); font-size: .74rem; line-height: 1.35; margin-top: .1rem; }
.priority-options .priority { font-size: .86rem; font-weight: 600; }
.priority-guide { margin: .45rem 0 0; color: var(--text-3); font-size: .78rem; min-height: 1.1em; }
.form-submit { display: grid; gap: .35rem; }
.form-submit > button { width: 100%; padding: .75rem 1rem; font-size: .95rem; }
.form-submit-note { text-align: center; color: var(--text-3); font-size: .74rem; }
@media (max-width: 640px) {
  /* Stacked full-width cards stay compact: one-line tap targets with the
     icon leading, hint text beside it instead of wrapping tall. */
  .type-cards { grid-template-columns: 1fr; gap: .45rem; }
  .type-card { align-items: center; padding: .6rem .7rem; border-radius: 12px; }
  .type-card-icon { width: 38px; height: 38px; border-radius: 10px; }
  .type-card-copy strong { font-size: .92rem; }
  .type-card-copy small { font-size: .76rem; }
  .category-picker-results { max-height: 200px; }
  .category-picker-hint { font-size: .72rem; }
  .priority-guide { font-size: .74rem; }
  .form-submit > button { min-height: 48px; }
  .seg-options { width: 100%; }
  .seg-options label { flex: 1; justify-content: center; }
  .priority-options label { flex: 1; justify-content: center; padding: .45rem .3rem; }
  .priority-options .priority { font-size: .8rem; }
  .field, .ticket-form-panel label { font-size: .9rem; }
  .rte-hint { font-size: .7rem; }
}

/* Rich-text editor */
.rte { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.rte:focus-within { border-color: var(--brand-500); box-shadow: var(--focus-ring); }
.rte-toolbar {
  display: flex; align-items: center; gap: .15rem; padding: .3rem .4rem;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.rte-btn {
  background: transparent; box-shadow: none; color: var(--text-2);
  padding: .3rem .55rem; font-size: .88rem; min-width: 32px; border-radius: 6px;
}
.rte-btn:hover { background: var(--surface-3); color: var(--text); }
.rte-spacer { flex: 1; }
.rte-editor {
  min-height: 150px; max-height: 360px; overflow-y: auto; padding: .65rem .75rem;
  outline: none; background: var(--surface); font-size: .95rem; color: var(--text);
}
.rte-editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.rte-editor img { max-width: min(280px, 100%); border-radius: 8px; border: 1px solid var(--border); margin: .4rem 0; display: block; }
.rte-editor ul, .rte-editor ol { padding-left: 1.4rem; }
.rte-hint { padding: .35rem .6rem .4rem; color: var(--text-3); font-size: .74rem; background: var(--surface-2); border-top: 1px solid var(--border); }
label > .rte { margin-top: .35rem; }

/* Drawer copy button */
.copy-code {
  background: transparent; box-shadow: none; color: inherit; padding: .1rem .3rem;
  vertical-align: middle; margin-left: .2rem;
}
.copy-code:hover { color: var(--brand-700); background: var(--brand-50); }

/* Sync pulse indicator */
.sync-pulse {
  display: inline-block; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--brand-500); margin-right: .45rem;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

/* Numeric alignment + gentle page transition */
.ticket-table td, .report-table td, .users-table td, .code-mono, .kpi-card strong { font-variant-numeric: tabular-nums; }
.app-main { animation: pageIn .16s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Ticket table ---------- */
.ticket-table-wrap { overflow-x: auto; }
.empty-state { display: grid; justify-items: center; gap: .35rem; padding: 2.6rem 1rem; text-align: center; }
.empty-state-art {
  width: 64px; height: 64px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: .35rem;
}
.empty-state h3 { margin: 0; font-size: 1.02rem; }
.empty-state p { color: var(--text-3); margin: 0 0 .9rem; font-size: .9rem; max-width: 320px; }
.empty-state button { justify-self: center; }
.ticket-table { border-collapse: collapse; min-width: 720px; width: 100%; }
.ticket-table th {
  text-align: left; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3); padding: .55rem .9rem; border-bottom: 1px solid var(--border);
  background: transparent;
}
.ticket-table td { padding: .72rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ticket-table tbody tr { cursor: pointer; transition: background .1s ease; }
.ticket-table tbody tr:hover { background: var(--brand-50); }
.ticket-table tbody tr:last-child td { border-bottom: 0; }
.ticket-table .ticket-title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.ticket-table .ticket-sub { color: var(--text-3); font-size: .8rem; margin-top: .05rem; }
.ticket-table time { color: var(--text-3); font-size: .84rem; white-space: nowrap; }

.pagination {
  align-items: center; color: var(--text-3); display: flex; font-size: .88rem;
  justify-content: space-between; margin-top: 1rem;
}
.pagination div { display: flex; gap: .45rem; }

/* ---------- Drawer ---------- */
.drawer-overlay {
  align-items: stretch; background: rgb(15 23 42 / 40%); backdrop-filter: blur(2px);
  display: flex; inset: 0; justify-content: flex-end; position: fixed; z-index: 40;
  animation: fadeIn .15s ease;
}
.drawer {
  background: var(--surface); box-shadow: var(--shadow-lg); max-width: 760px; overflow-y: auto;
  padding: 1.75rem 2rem 2rem; position: relative; width: min(100%, 760px);
  animation: slideIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } }
.drawer-close {
  background: var(--surface-2); color: var(--text-2); padding: .4rem; position: absolute;
  right: 1rem; top: 1rem; box-shadow: none;
}
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
/* ---------- Modal dialog ---------- */
.modal-overlay {
  align-items: center; justify-content: center; display: flex; inset: 0;
  background: rgb(15 23 42 / 45%); backdrop-filter: blur(3px);
  position: fixed; z-index: 50; padding: 1.25rem; animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(640px, 100%); max-height: calc(100vh - 2.5rem); overflow-y: auto;
  position: relative; padding: 1.6rem 1.75rem 1.75rem;
  animation: popIn .18s ease;
}
@keyframes popIn { from { transform: scale(.96) translateY(8px); opacity: 0; } }
body.modal-open { overflow: hidden; }
/* The form panel loses its card chrome inside the modal shell. */
.modal .ticket-form-panel { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; }
.modal .ticket-form-panel form { margin-top: 0; max-width: none; }

.eyebrow { color: var(--brand-600); font-size: .8rem; font-weight: 750; letter-spacing: .06em; margin-bottom: .35rem; text-transform: uppercase; }
.drawer-header-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }

.ticket-details { display: grid; gap: .75rem 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1.25rem 0; }
.ticket-details div { border-bottom: 1px solid var(--border); padding-bottom: .55rem; }
.ticket-details dt { color: var(--text-3); font-size: .78rem; }
.ticket-details dd { margin: .12rem 0 0; overflow-wrap: anywhere; font-weight: 550; }
.drawer section { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.1rem; }
.rich-content { overflow-wrap: anywhere; color: var(--text-2); }
.rich-content img { max-width: 100%; border-radius: var(--radius-sm); }
.actor-list { background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-2); font-size: .9rem; margin-bottom: .8rem; padding: .65rem .8rem; }

.timeline { border-left: 2px solid var(--brand-100); list-style: none; margin: .8rem 0 0 .2rem; padding-left: 1.1rem; }
.timeline li { margin-bottom: 1.1rem; position: relative; }
.timeline .timeline-head { display: flex; align-items: center; gap: .55rem; }
.timeline li::before {
  background: var(--surface); border: 2px solid var(--brand-500); border-radius: 50%;
  content: ""; height: .6rem; left: -1.42rem; position: absolute; top: .3rem; width: .6rem;
}
.timeline time { color: var(--text-3); display: block; font-size: .8rem; margin: .2rem 0 .35rem; }

.drawer-feedback { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.1rem; }
.drawer-feedback > p { color: var(--text-3); }
.drawer-feedback-form { display: grid; gap: .85rem; max-width: 560px; }
.drawer-feedback-form fieldset { display: grid; gap: .45rem; }
.drawer-feedback-form > button { justify-self: start; }
.feedback-readonly { display: grid; gap: .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.feedback-readonly div { background: var(--surface-2); border-radius: var(--radius-sm); padding: .65rem .8rem; }
.feedback-readonly .feedback-comment { grid-column: 1 / -1; }
.feedback-readonly dt { color: var(--text-3); font-size: .78rem; }
.feedback-readonly dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.feedback-stars { color: #f59e0b; letter-spacing: .08em; font-size: 1.05rem; }
.feedback-status { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm); color: var(--warning-text); padding: .65rem; }
.button-link { display: inline-flex; margin-top: 1rem; }

/* ---------- Rating input (stars) ---------- */
.rating-input { display: flex; flex-wrap: wrap; gap: .45rem; }
.rating-input label {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: #f59e0b; cursor: pointer; display: inline-flex; align-items: center; padding: .35rem .55rem;
  font-size: 1.1rem; line-height: 1; transition: background .12s ease, border-color .12s ease;
}
.rating-input label:hover, .rating-input label:has(input:checked) { background: #fffbeb; border-color: #fcd34d; }
.rating-input label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.rating-input input { width: auto; }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.05rem 1.15rem; display: flex; gap: .85rem; align-items: center;
  /* Cards double as drill-down <button>s; the global button rule paints text
     white, so the card must own its colors explicitly. */
  color: var(--text); text-align: left; justify-content: flex-start;
}
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.kpi-icon--brand  { background: var(--brand-50);   color: var(--brand-700); }
.kpi-icon--info   { background: var(--info-bg);    color: var(--info); }
.kpi-icon--ok     { background: var(--success-bg); color: var(--success); }
.kpi-icon--warn   { background: var(--warning-bg); color: var(--warning); }
.kpi-card strong { display: block; font-size: 1.45rem; font-weight: 750; line-height: 1.2; letter-spacing: -0.01em; }
.kpi-card span { color: var(--text-3); font-size: .85rem; }
.kpi-card .kpi-detail { color: var(--text-3); display: block; font-size: .75rem; margin-top: .16rem; }
.kpi-card--urgent { border-color: var(--warning-border); }
.kpi-card--urgent strong { color: var(--warning-text); }

.dashboard-grid { display: grid; gap: 1.25rem; grid-template-columns: 3fr 2fr; align-items: start; }
.chart-bars { align-items: flex-end; display: flex; gap: .4rem; height: 140px; margin-top: .5rem; }
.chart-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: .3rem; min-width: 0; padding: 0 .15rem; }
.chart-bar i {
  display: block; background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  border-radius: 4px 4px 2px 2px; min-height: 2px; transition: opacity .12s ease; position: relative;
}
.chart-bar:hover i { opacity: .8; }
.chart-bar span { color: var(--text-3); font-size: .66rem; text-align: center; white-space: nowrap; }
.mini-list { display: grid; gap: .1rem; }
.mini-item {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  background: transparent; box-shadow: none; border-radius: var(--radius-sm);
  padding: .55rem .6rem; font-weight: 500; color: var(--text); justify-content: flex-start;
}
.mini-item:hover { background: var(--brand-50); }
.mini-item .mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item small { display: block; color: var(--text-3); font-weight: 400; font-size: .78rem; }

/* ---------- Reports / Users / Integrations ---------- */
.report-section { margin-bottom: 1.25rem; }
.report-section .section-heading { margin-bottom: .75rem; }
.report-section .section-heading h2 { margin-bottom: 0; }
.report-person { display: inline-flex; align-items: center; gap: .55rem; }

/* ---------- Reports hero: gauge + rate + auto insights ---------- */
.report-hero {
  background:
    radial-gradient(60% 90% at 100% 0%, var(--brand-50) 0%, transparent 55%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.4rem 1.5rem; margin-bottom: 1.1rem;
}
.report-hero-main { display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.gauge { width: 148px; height: 148px; flex: 0 0 auto; }
.gauge-track { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.gauge-fill {
  fill: none; stroke-width: 11; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 65px 65px;
  transition: stroke-dasharray .6s ease;
}
.gauge-value { font-size: 1.7rem; font-weight: 750; fill: var(--text); }
.gauge-sub { font-size: .6rem; fill: var(--text-3); letter-spacing: .04em; }
.report-hero-stats { display: grid; gap: 1.1rem; min-width: 220px; flex: 1; }
.hero-stat strong { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.01em; }
.hero-stat span { display: block; color: var(--text-3); font-size: .85rem; }
.hero-stat-top { display: flex; align-items: baseline; gap: .6rem; }
.hero-stat-top span { display: inline; }
.hero-rate-track { display: block; background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; margin-top: .45rem; }
.hero-rate-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand-500), var(--brand-700)); min-width: 4px; }

.insight-list { list-style: none; margin: 1.1rem 0 0; padding: .9rem 0 0; border-top: 1px dashed var(--border-strong); display: grid; gap: .5rem; }
.insight-list li { display: flex; align-items: center; gap: .6rem; font-size: .92rem; color: var(--text-2); }
.insight-list li .icon { margin-top: -1px; }
.insight-list li.is-success .icon { color: var(--success); }
.insight-list li.is-warning .icon { color: var(--warning); }
.insight-list li.is-danger .icon { color: var(--danger); }

/* ---------- Segmented tabs ---------- */
.seg-tabs-wrap { margin-bottom: 1.1rem; }
.seg-tabs { display: inline-flex; gap: .2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .25rem; }
.seg-tab {
  background: transparent; color: var(--text-2); font-weight: 600; font-size: .9rem;
  border-radius: 999px; padding: .45rem 1rem; box-shadow: none;
}
.seg-tab:hover { background: rgb(255 255 255 / .7); color: var(--text); }
.seg-tab.is-active { background: var(--surface); color: var(--brand-800); box-shadow: var(--shadow-sm); }

/* Insights & hero drill-down */
.insight-list li.is-clickable { cursor: pointer; border-radius: var(--radius-sm); padding: .3rem .45rem; margin: -.15rem -.45rem; transition: background .1s ease; }
.insight-list li.is-clickable:hover { background: var(--surface-2); }
.insight-list .insight-go { font-style: normal; color: var(--text-3); font-size: .78rem; margin-left: auto; flex: 0 0 auto; }
.hero-stat.is-clickable {
  background: transparent; border: 0; box-shadow: none; border-radius: var(--radius-sm);
  display: block; text-align: left; padding: .35rem .5rem; margin: -.35rem -.5rem; color: inherit;
  cursor: pointer; transition: background .1s ease;
}
.hero-stat.is-clickable:hover { background: var(--surface-2); }
.hero-stat.is-clickable strong { color: var(--danger); }
.hero-stat.is-clickable span { color: var(--text-2); }

/* Employee score mini-bar */
.employee-score { display: inline-flex; align-items: center; gap: .6rem; }
.employee-score-track { width: 72px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.employee-score-track i { display: block; height: 100%; border-radius: 999px; }
.employee-score-track i.is-success { background: var(--success); }
.employee-score-track i.is-warning { background: var(--warning); }
.employee-score-track i.is-danger { background: var(--danger); }
.employee-score-track i.is-neutral { background: var(--border-strong); }

/* Low-score reason chips */
.low-score-reasons { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.low-score-reason {
  background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border);
  font-size: .74rem; font-weight: 600; border-radius: 999px; padding: .12rem .55rem;
}

/* Employee feedback hover board */
.feedback-popover {
  position: fixed; z-index: 60; width: min(420px, calc(100vw - 24px));
  max-height: min(420px, 70vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: .9rem .95rem;
  animation: popIn .14s ease;
}
.feedback-popover-head-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.feedback-popover-head-row strong { font-size: .98rem; }
.feedback-popover-count { color: var(--text-3); font-size: .78rem; }
.feedback-popover-item { border-top: 1px solid var(--border); padding: .6rem 0 .55rem; }
.feedback-popover-item:first-of-type { border-top: 0; }
.feedback-popover-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.feedback-popover-title { font-weight: 600; flex: 1; min-width: 140px; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-table tr[data-employee-id] { cursor: help; }

/* Employee ranking */
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-3); font-size: .8rem; font-weight: 700;
}
.rank.is-top { background: var(--brand-50); color: var(--brand-800); }

/* Horizontal rating bars (by department) */
.rating-bars { display: grid; gap: .55rem; }
.rating-bar-row {
  display: grid; align-items: center; gap: .75rem;
  grid-template-columns: minmax(120px, 180px) 1fr 44px max-content;
}
.rating-bar-label { font-size: .88rem; font-weight: 550; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-bar-track { background: var(--surface-2); border-radius: 999px; height: 10px; overflow: hidden; }
.rating-bar-track i { display: block; height: 100%; border-radius: 999px; min-width: 6px; transition: width .3s ease; }
.rating-bar-track i.is-success { background: linear-gradient(90deg, #34d399, var(--success)); }
.rating-bar-track i.is-warning { background: linear-gradient(90deg, #fbbf24, var(--warning)); }
.rating-bar-track i.is-danger  { background: linear-gradient(90deg, #f87171, var(--danger)); }
.rating-bar-track i.is-neutral { background: var(--border-strong); }
.rating-bar-value { font-weight: 700; font-size: .92rem; text-align: right; }
.rating-bar-count { color: var(--text-3); font-size: .8rem; white-space: nowrap; }

/* Low-score feedback cards */
.low-score-list { display: grid; gap: .7rem; }
.low-score-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .9rem; }
.low-score-head { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.low-score-title { font-weight: 600; flex: 1; min-width: 160px; }
.low-score-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; color: var(--text-3); font-size: .82rem; margin-top: .4rem; }
.low-score-comment { color: var(--text-2); font-size: .9rem; margin: .55rem 0 0; border-left: 3px solid var(--border-strong); padding-left: .65rem; overflow-wrap: anywhere; }
.report-table-wrap { overflow-x: auto; }
.report-table, .users-table { border-collapse: collapse; min-width: 100%; }
.report-table th, .report-table td, .users-table th, .users-table td {
  border-bottom: 1px solid var(--border); padding: .6rem .75rem; text-align: left; vertical-align: top;
}
.report-table th, .users-table th {
  background: var(--surface-2); color: var(--text-3); font-size: .76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.report-table td, .users-table td { color: var(--text-2); font-size: .92rem; }
.report-table tbody tr:hover, .users-table tbody tr:hover { background: var(--surface-2); }
.report-table td { max-width: 320px; overflow-wrap: anywhere; }
.report-table { width: max-content; }

.users-page { display: grid; gap: 1rem; }

/* Overview stat chips (double as filters) */
.users-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.users-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: .8rem 1rem; display: grid; gap: .1rem;
  color: var(--text); text-align: left; justify-content: start;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.users-stat:hover { border-color: var(--brand-500); }
.users-stat strong { font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.users-stat span { color: var(--text-3); font-size: .8rem; }
.users-stat.is-active { border-color: var(--brand-500); box-shadow: var(--focus-ring); }
.users-stat.is-warn strong { color: var(--warning); }

.users-filter-bar { display: grid; gap: .65rem; grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px); margin-bottom: 1rem; }
.users-filter-bar input, .users-filter-bar select { border-radius: 999px; height: 38px; background: var(--surface-2); border-color: transparent; padding: .3rem .95rem; font-size: .88rem; }
.users-filter-bar input:focus, .users-filter-bar select:focus { background: var(--surface); }

/* Master list rows */
.users-list { display: grid; gap: .3rem; }
.user-row {
  display: flex; align-items: center; gap: .8rem; width: 100%;
  background: transparent; box-shadow: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: .6rem .7rem; color: var(--text); text-align: left; justify-content: flex-start;
  transition: background .1s ease, border-color .1s ease;
}
.user-row:hover { background: var(--brand-50); }
.user-row:active { background: var(--brand-100); }
.user-row .icon { color: var(--text-3); }
.user-row-copy { flex: 1; min-width: 0; display: grid; gap: .05rem; }
.user-row-copy strong { font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-copy small { color: var(--text-3); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-tags { display: flex; gap: .35rem; flex: 0 0 auto; }

/* User drawer */
.user-drawer { max-width: 560px; }
.user-drawer-head { display: flex; gap: .9rem; align-items: center; margin-bottom: .5rem; }
.user-drawer-head h2 { font-size: 1.15rem; margin: 0; }
.user-drawer-head p { margin: .1rem 0 .35rem; color: var(--text-3); font-size: .86rem; }
.user-drawer-section { border-top: 1px solid var(--border); margin-top: 1.1rem; padding-top: 1rem; }
.user-drawer-section h3 { font-size: .86rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.user-action-row { display: flex; flex-wrap: wrap; gap: .55rem; }

.entity-scope-cell { min-width: 200px; }
.user-link-status { color: var(--warning-text); font-size: .9rem; font-weight: 650; white-space: nowrap; }
.user-link-status.is-linked { color: var(--success-text); }
.user-link-message { color: var(--text-3); display: block; margin-top: .3rem; max-width: 240px; }
.user-link-button { white-space: nowrap; }
.user-role { color: var(--text-2); font-size: .9rem; font-weight: 650; white-space: nowrap; }
.user-role-select { min-width: 135px; }
.entity-scope-cell { min-width: 240px; }
.entity-scope-note { color: var(--text-3); display: block; font-size: .85rem; }
.entity-scope-button { margin-top: .45rem; white-space: nowrap; }
.entity-scope-warning {
  background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm);
  color: var(--warning-text); font-size: .85rem; font-weight: 650; margin: 0 0 .45rem; padding: .55rem .65rem;
}
.entity-scope-editor { display: grid; gap: .5rem; }
.entity-scope-editor select { min-width: 220px; }
.entity-scope-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.entity-scope-message { color: var(--success-text); display: block; font-size: .85rem; }
.entity-scope-message.is-error { color: var(--danger-text); }

.password-panel { max-width: 560px; }
.password-note { color: var(--text-3); margin: 0; }
.password-form { display: grid; gap: .85rem; margin-top: 1rem; }
.password-form label, .password-modal label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; }
.password-form > button { justify-self: start; }
.form-success { background: var(--success-bg); border-radius: var(--radius-sm); color: var(--success-text); margin: 0; padding: .65rem; font-size: .9rem; }
.password-modal-backdrop { align-items: center; background: rgb(15 23 42 / .42); display: flex; inset: 0; justify-content: center; padding: 1rem; position: fixed; z-index: 60; }
.password-modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-md); display: grid; gap: .85rem; max-width: 440px; padding: 1.25rem; width: 100%; }
.glpi-sync-modal { max-width: 720px; max-height: calc(100vh - 2rem); }
.glpi-sync-modal progress { width: 100%; }
.glpi-sync-counts { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .9rem; }
.glpi-sync-results { max-height: 42vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
.glpi-sync-results section + section { border-top: 1px solid var(--border); margin-top: .75rem; padding-top: .75rem; }
.glpi-sync-results h3 { font-size: .92rem; margin: 0 0 .35rem; }
.glpi-sync-results ul { display: grid; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.glpi-sync-results li { display: grid; gap: .1rem; font-size: .88rem; }
.glpi-sync-results small { color: var(--text-3); }
.glpi-sync-banner { align-items: center; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)); border-radius: var(--radius); display: flex; gap: .75rem; justify-content: space-between; margin-bottom: .8rem; padding: .65rem .8rem; }
.password-modal h2, .password-modal p { margin: 0; }
.password-modal p { color: var(--text-3); }
.password-modal-actions { display: flex; gap: .65rem; justify-content: flex-end; }

.integration-panel { margin-bottom: 1.25rem; }

/* Entity assignees (tab 2) redesign */
.assignee-legend { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 .6rem; }
.assignee-legend-chip {
  display: inline-flex; align-items: center; gap: .4rem; border-radius: 999px;
  padding: .35rem .8rem; font-size: .84rem; border: 1px solid var(--border);
}
.assignee-legend-chip strong { font-weight: 700; }
.assignee-legend-chip.is-handler { background: var(--info-bg); color: var(--info-text); border-color: var(--info-border); }
.assignee-legend-chip.is-observer { background: var(--surface-2); color: var(--text-2); }
.assignee-rules { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .55rem .8rem; margin-bottom: 1rem; }
.assignee-rules summary { cursor: pointer; color: var(--text-2); font-size: .84rem; font-weight: 600; user-select: none; }
.assignee-rules summary:hover { color: var(--text); }
.assignee-rules ul { margin: .55rem 0 0; padding-left: 1.2rem; color: var(--text-3); font-size: .82rem; display: grid; gap: .35rem; }
.assignee-rules li::marker { color: var(--brand-500); }

.entity-assignees-table td { vertical-align: top; padding: .9rem .9rem; }
.entity-assignees-table tbody tr { border-bottom: 1px solid var(--border); }
.entity-assignees-table tbody tr:hover { background: transparent; }
.entity-assignees-table td[data-label="Công ty"] strong { display: block; margin-bottom: .35rem; }

.assignee-actor-chip {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: .3rem .45rem .3rem .35rem; margin-bottom: .4rem;
}
.assignee-actor-chip.is-paused { opacity: .65; border-style: dashed; }
.assignee-actor-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: var(--info-bg); color: var(--info-text); font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; text-transform: uppercase;
}
.assignee-actor-avatar.is-group { background: var(--surface-2); font-size: .85rem; }
.assignee-actor-copy strong { font-size: .84rem; display: block; line-height: 1.2; }
.assignee-actor-copy small { color: var(--text-3); font-size: .72rem; display: block; }
.assignee-actor-actions { display: inline-flex; gap: .2rem; margin-left: auto; }
.assignee-actor-actions .button-ghost { padding: .25rem .55rem; font-size: .74rem; }
.assignee-actor-actions .button-ghost.is-danger:hover { background: var(--danger-bg); color: var(--danger); }
.assignee-next { display: inline-flex; align-items: center; gap: .3rem; background: var(--info-bg); color: var(--info-text); border-radius: 999px; padding: .22rem .7rem; font-size: .78rem; margin: .15rem 0 .45rem; }
.entity-assignee-controls select { border-radius: 999px; height: 34px; background: var(--surface-2); border-color: transparent; font-size: .82rem; padding: .25rem .8rem; max-width: 260px; }
.entity-assignee-controls .user-picker input { border-radius: 999px; height: 34px; background: var(--surface-2); border-color: transparent; font-size: .82rem; }

@media (max-width: 760px) {
  .entity-assignees-table, .entity-assignees-table tbody, .entity-assignees-table tr, .entity-assignees-table td { display: block; width: 100%; }
  .entity-assignees-table thead { display: none; }
  .entity-assignees-table tr { border: 1px solid var(--border); border-radius: 14px; margin-bottom: .7rem; padding: .3rem 0 .6rem; box-shadow: var(--shadow-sm); }
  .entity-assignees-table td { border: 0; padding: .45rem .85rem; }
  .entity-assignees-table td[data-label="Công ty"] { padding-top: .75rem; }
  .entity-assignees-table td::before { content: attr(data-label); display: block; color: var(--text-3); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
  .entity-assignees-table td[data-label="Công ty"]::before { display: none; }
}

/* Operations: connection hero + sync panel */
.integration-hero {
  background:
    radial-gradient(60% 90% at 100% 0%, var(--brand-50) 0%, transparent 55%),
    var(--surface);
  margin-bottom: 1rem;
}
.integration-hero-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.integration-health { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .95rem; }
.integration-health i { width: 10px; height: 10px; border-radius: 50%; }
.integration-health.is-up { color: var(--success-text); }
.integration-health.is-up i { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); animation: pulse 2s ease-in-out infinite; }
.integration-health.is-down { color: var(--warning-text); }
.integration-health.is-down i { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg); }
.integration-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.integration-kpis .hero-stat strong { font-size: 1.25rem; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.integration-kpis .hero-stat span { display: block; color: var(--text-3); font-size: .8rem; margin-top: .1rem; }
.token-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.integration-hero-url strong { font-size: .95rem; font-weight: 650; direction: rtl; text-align: left; }
.integration-sync-panel { margin-bottom: 1rem; }
.integration-mode-field { border: 0; margin: 0 0 1rem; padding: 0; }
.integration-mode-field legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: .45rem; }
.integration-sync-panel .integration-actions { align-items: center; }
@media (max-width: 900px) {
  .integration-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .integration-kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .integration-hero-url { grid-column: 1 / -1; }
  .integration-actions { align-items: stretch; flex-direction: column; }
  .integration-actions > button { width: 100%; }
}
.integration-details { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1rem 0; }
.integration-details div { background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .85rem; }
.integration-details dt { color: var(--text-3); font-size: .78rem; }
.integration-details dd { font-weight: 650; margin: .15rem 0 0; overflow-wrap: anywhere; }
.integration-actions { align-items: end; display: flex; flex-wrap: wrap; gap: .65rem; }
.integration-actions label { font-size: .9rem; min-width: 220px; }
.integration-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm); color: var(--warning-text); margin: 1rem 0 0; padding: .7rem .85rem; }
.integration-message { background: var(--success-bg); border: 1px solid var(--success-border); border-radius: var(--radius-sm); color: var(--success-text); margin: .75rem 0 0; padding: .7rem .85rem; }

/* ---------- Feedback public page ---------- */
.feedback-page {
  align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 1.25rem;
  background:
    radial-gradient(50% 40% at 85% 0%, var(--brand-50) 0%, transparent 70%),
    radial-gradient(40% 35% at 0% 100%, #fff1f2 0%, transparent 70%),
    var(--bg);
}
.feedback-shell { max-width: 620px; width: 100%; }
.feedback-card { padding: 1.75rem; box-shadow: var(--shadow-md); }
.feedback-card form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.feedback-brand { display: flex; align-items: center; gap: .55rem; color: var(--text-3); font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 1rem; }
.feedback-brand .brand-mark { color: #fff; font-size: .85rem; }
.feedback-context { display: flex; align-items: center; gap: .55rem; color: var(--text-3); font-size: .85rem; margin-bottom: .4rem; flex-wrap: wrap; }
.feedback-assignee { color: var(--text-2); font-size: .92rem; margin: .3rem 0 0; }
.feedback-question { color: var(--text-2); font-size: 1rem; margin: 1.1rem 0 0; }
.feedback-deadline { color: var(--text-3); font-size: .8rem; margin: .2rem 0 0; text-align: center; }

/* Shared star-rating widget */
.star-rating { border: 0; margin: 0; padding: 0; }
.star-rating-legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .5rem; visibility: hidden; height: 0; }
.star-rating-stars { display: flex; flex-direction: row-reverse; justify-content: center; gap: .35rem; }
.star-rating-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-rating-stars label { cursor: pointer; padding: .2rem; border-radius: 8px; transition: transform .1s ease; }
.star-rating-stars label svg path { fill: var(--surface-3); stroke: var(--border-strong); stroke-width: 1; transition: fill .08s ease; }
.star-rating-stars label:hover { transform: scale(1.12); }
.star-rating-stars label:hover path, .star-rating-stars label:hover ~ label path { fill: #fbbf24; stroke: #f59e0b; }
.star-rating-stars label.is-filled path { fill: #f59e0b; stroke: #d97706; }
.star-rating-stars label:has(input:checked) path, .star-rating-stars label:has(input:checked) ~ label path { fill: #f59e0b; stroke: #d97706; }
.star-rating-stars label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.star-rating-scale { display: flex; justify-content: space-between; max-width: 280px; margin: .35rem auto 0; color: var(--text-3); font-size: .78rem; }

.reason-chips { display: grid; gap: .5rem; background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm); padding: .8rem .9rem; }
.reason-chips-title { margin: 0; font-weight: 650; color: var(--warning-text); font-size: .9rem; }
.reason-chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }

.feedback-thanks { display: flex; align-items: center; gap: .8rem; margin: .8rem 0; }
.feedback-thanks-check {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Login ---------- */
.login-page {
  align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 1.25rem;
  background:
    radial-gradient(50% 40% at 85% 0%, var(--brand-50) 0%, transparent 70%),
    radial-gradient(40% 35% at 0% 100%, #fff1f2 0%, transparent 70%),
    var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-md); max-width: 460px; padding: 2rem; width: 100%;
}
.login-card > p:not(.eyebrow):not(.form-error) { color: var(--text-3); }
.local-login-form { border-bottom: 1px solid var(--border); display: grid; gap: .85rem; margin-top: 1.25rem; padding-bottom: 1.25rem; }
.local-login-form > button { justify-self: start; }
.login-availability { display: grid; gap: .75rem; margin-top: 1.25rem; }
.login-availability .login-button { margin-top: 0; justify-content: center; }
.login-config-message { color: var(--warning-text); margin-bottom: 0; font-size: .88rem; }

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  /* 7 fixed columns cannot fit below ~1280px; wrap into two rows instead of overflowing */
  .filter-bar { grid-template-columns: repeat(4, minmax(120px, 1fr)) auto auto; }
}

/* ---------- Responsive: mobile shell (sidebar → bottom tab bar) ---------- */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; z-index: 30;
    flex-direction: row; align-items: stretch; gap: 0; overflow-x: auto;
    padding: .3rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    background: rgb(255 255 255 / 94%);
    backdrop-filter: blur(14px);
    box-shadow: 0 -6px 24px rgb(15 23 42 / .08);
  }
  .brand, .sidebar-footer, .sidebar-user, .sidebar-logout, .sidebar-message { display: none; }
  .side-nav { display: flex; gap: .15rem; width: 100%; }
  /* Material-3 style tab: the icon gets a tinted pill, the label stays plain. */
  .side-link {
    flex: 1; flex-direction: column; gap: .3rem; justify-content: center;
    font-size: .66rem; font-weight: 550; padding: 0; border-radius: 12px;
    min-height: 54px; min-width: 56px; -webkit-user-select: none; user-select: none;
  }
  .side-link span { display: block; white-space: nowrap; letter-spacing: 0; }
  .side-link .icon { padding: .3rem 1rem; border-radius: 999px; transition: background .15s ease, color .15s ease; }
  .side-link.is-active { background: transparent; color: var(--brand-800); font-weight: 700; }
  .side-link.is-active .icon { background: var(--brand-600); color: #fff; }
  .side-link .nav-badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; font-size: .58rem; padding: .02rem .32rem; }
  .app-main { padding: 1rem .85rem 1.5rem; }
  .topbar { padding: 0 .85rem; height: 56px; }
  .topbar-meta { display: none; }
  .global-search { max-width: none; }
  .global-search kbd { display: none; }
  .toast-host { bottom: calc(78px + env(safe-area-inset-bottom)); right: .75rem; left: .75rem; }
  .toast { flex: 1; }

  /* Compact page heading + floating action button instead of a full-width bar */
  .page-heading { align-items: center; gap: .6rem; margin-bottom: 1rem; }
  .page-heading h1 { font-size: 1.3rem; }
  .page-heading p { font-size: .84rem; }
  .page-heading > button {
    position: fixed; right: 1rem; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 25;
    width: auto; margin: 0; padding: .85rem 1.25rem; border-radius: 999px;
    box-shadow: 0 10px 24px -6px rgb(220 38 38 / .5);
  }
  .page-heading > button:active { transform: scale(.96); }

  /* Filter strip → pill chips */
  .filter-bar {
    display: flex; gap: .45rem; overflow-x: auto; margin: 0 0 .9rem;
    padding: .1rem .1rem .55rem; grid-template-columns: none;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar-wrap, .tabs-wrap { position: relative; }
  .filter-bar-wrap::after, .tabs-wrap::after {
    content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 34px;
    background: linear-gradient(90deg, transparent, var(--surface));
    pointer-events: none;
  }
  .filter-bar > * { flex: 0 0 auto; width: auto; scroll-snap-align: start; }
  .filter-bar input, .filter-bar select {
    border-radius: 999px; min-width: 132px; height: 38px; padding: .3rem .95rem;
    background: var(--surface-2); border-color: transparent;
    font-size: .86rem; white-space: nowrap;
  }
  .filter-bar input:focus, .filter-bar select:focus { background: var(--surface); }
  .filter-bar .user-picker input { min-width: 132px; }
  .filter-bar > button { border-radius: 999px; height: 38px; padding: .3rem .95rem; font-size: .86rem; }
  .filter-bar .user-results { position: static; box-shadow: none; border-radius: var(--radius-sm); }
  .filter-bar .user-results:has(*) { border-color: var(--border-strong); }

  /* Scope tabs: sticky under the topbar while the list scrolls */
  .tabs-wrap { margin: -.15rem 0 .9rem; top: 56px; z-index: 5; background: var(--surface); }
  .tabs-wrap .tabs {
    display: flex; width: max-content; max-width: 100%; overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: .45rem .8rem; font-size: .86rem; }
  .tab-count { font-size: .66rem; }

  /* Drag handle for bottom sheets */
  .drawer::before, .modal::before {
    content: ""; position: absolute; top: .55rem; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 999px; background: var(--border-strong);
  }
  .modal { padding-top: 1.9rem; }
  .modal .drawer-close { top: 1.05rem; }
}

/* Users master–detail on mobile */
@media (max-width: 640px) {
  .users-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
  .users-stat { padding: .6rem .65rem; border-radius: 12px; }
  .users-stat strong { font-size: 1.05rem; }
  .users-stat span { font-size: .68rem; }
  .users-filter-bar { grid-template-columns: 1fr; }
  .user-row { flex-wrap: wrap; }
  .user-row-tags { width: 100%; padding-left: 3.4rem; }
  .user-drawer-head h2 { font-size: 1.05rem; }
}

/* ---------- Responsive: small phones ---------- */
@media (max-width: 640px) {
  /* Prevent iOS zoom-on-focus: keep inputs at 16px */
  input, select, textarea { font-size: max(16px, 1em); }

  .section-heading, .pagination, .glpi-link-status, .user-overview { align-items: stretch; flex-direction: column; }
  .report-hero { padding: 1.1rem 1.1rem 1.25rem; }
  .report-hero-main { gap: 1.25rem; }
  .gauge { width: 122px; height: 122px; }
  .seg-tabs-wrap { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .seg-tabs-wrap::-webkit-scrollbar { display: none; }
  .seg-tabs { display: flex; width: max-content; }
  .rating-bar-row { grid-template-columns: minmax(90px, 1fr) 60px; grid-template-areas: "label value" "track track" "count count"; row-gap: .3rem; }
  .rating-bar-label { grid-area: label; }
  .rating-bar-track { grid-area: track; }
  .rating-bar-value { grid-area: value; }
  .rating-bar-count { grid-area: count; }
  .glpi-link-status > button { width: 100%; }
  .users-filter-bar, .integration-details { grid-template-columns: 1fr; }
  .integration-actions { align-items: stretch; flex-direction: column; }
  .integration-actions > button, .integration-actions label { width: 100%; }
  .ticket-details { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .kpi-card { padding: .85rem .9rem; }
  .kpi-card strong { font-size: 1.2rem; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .dashboard-grid { gap: 1rem; }
  .global-search { max-width: none; }

  /* Ticket table → stacked cards */
  .ticket-table-wrap { overflow: visible; }
  .ticket-table, .ticket-table tbody, .ticket-table tr, .ticket-table td { display: block; width: 100%; }
  .ticket-table { min-width: 0; }
  .ticket-table thead { display: none; }
  .ticket-table tr {
    position: relative; border: 1px solid var(--border); border-radius: 14px;
    margin-bottom: .55rem; padding: .6rem .3rem .6rem 1rem; background: var(--surface);
    box-shadow: var(--shadow-sm); transition: background .1s ease;
  }
  .ticket-table tr:active { background: var(--brand-50); }
  /* Status accent bar — a sliver of the status colour on the card's left edge. */
  .ticket-table tr::before {
    content: ""; position: absolute; left: .3rem; top: 14%; bottom: 14%; width: 4px;
    border-radius: 999px; background: var(--text-3);
  }
  .ticket-table tr[data-status="NEW"]::before { background: var(--info); }
  .ticket-table tr[data-status="PROCESSING_ASSIGNED"]::before,
  .ticket-table tr[data-status="PROCESSING_PLANNED"]::before { background: #6366f1; }
  .ticket-table tr[data-status="PENDING"]::before { background: var(--warning); }
  .ticket-table tr[data-status="SOLVED"]::before { background: var(--success); }
  .ticket-table tr[data-status="CLOSED"]::before { background: var(--border-strong); }
  .ticket-table tr:hover { background: transparent; }
  .ticket-table td { border-bottom: 0; padding: .3rem .7rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
  .ticket-table td::before {
    content: attr(data-label); color: var(--text-3); font-size: .74rem; font-weight: 650;
    text-transform: uppercase; letter-spacing: .04em; flex: 0 0 auto;
  }
  .ticket-table td:last-child { border-bottom: 0; }
  .ticket-table td[data-label="Tiêu đề"] { flex-direction: column; align-items: flex-start; gap: .1rem; padding-top: .55rem; }
  .ticket-table td[data-label="Tiêu đề"]::before { display: none; }
  .ticket-table .ticket-title { max-width: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ticket-table .ticket-sub { margin-top: .1rem; }

  /* Drawer → full-width sheet */
  .drawer {
    max-width: none; width: 100%; padding: 3.5rem 1rem 2rem;
    border-radius: 16px 16px 0 0; animation: sheetUp .2s ease;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  .modal-overlay { padding: .75rem; align-items: flex-end; }
  .modal { padding: 2rem 1.1rem 1.5rem; animation: sheetUp .2s ease; max-height: calc(100dvh - 1.5rem); border-radius: 18px 18px 0 0; }
  .modal .drawer-close { top: 1rem; }
  .drawer-close { top: .85rem; right: .85rem; padding: .55rem; }
  @keyframes sheetUp { from { transform: translateY(32px); opacity: .5; } }

  .pagination > div { width: 100%; }
  .pagination > div > button { flex: 1; padding: .65rem .5rem; }
  .report-table-wrap, .users-table-wrap { margin: 0 -.85rem; padding: 0 .85rem; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kpi-card { padding: .7rem .75rem; gap: .55rem; }
  .kpi-card strong { font-size: 1.05rem; }
  .kpi-card span { font-size: .72rem; }
  .kpi-icon { width: 32px; height: 32px; border-radius: 9px; }
  .chart-bar span { display: none; }
  .page-heading h1 { font-size: 1.15rem; }
}

/* === WP-11 entity default assignees (bắt đầu) === */
.entity-assignees-section { margin-top: 1.25rem; }
.entity-assignees-limit { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-sm); color: var(--warning-text); margin: 0 0 .85rem; padding: .7rem .85rem; }
.entity-assignees-roles { background: var(--info-bg); border: 1px solid var(--info-border); border-radius: var(--radius-sm); color: var(--info-text); margin: 0 0 .85rem; padding: .7rem .85rem; }
.entity-assignees-table td { min-width: 150px; }
.entity-assignees-table .user-picker { min-width: 220px; }
.entity-assignees-table select { min-width: 180px; }
.entity-assignee-controls { display: grid; gap: .5rem; min-width: 220px; }
.entity-observer-list { display: grid; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.entity-observer-list li { align-items: center; display: flex; flex-wrap: wrap; gap: .4rem; }
.entity-observer-list button { font-size: .78rem; padding: .25rem .5rem; }
.entity-assignees-unassigned { color: var(--warning-text); font-weight: 650; }
.entity-assignees-unavailable { color: var(--text-3); display: block; font-size: .88rem; max-width: 220px; }
.entity-assignees-message { color: var(--success-text); display: block; font-size: .82rem; margin-top: .35rem; }
.entity-assignees-message.is-error { color: var(--danger-text); }
/* === WP-11 entity default assignees (kết thúc) === */

/* === WP-12 báo cáo vận hành (bắt đầu) === */
operations-reports { display: block; margin-bottom: 1.25rem; }
.operations-reports { padding: 1.1rem; }
.operations-heading { align-items: flex-start; gap: 1rem; }
.operations-heading p { color: var(--text-3); font-size: .88rem; margin: .25rem 0 0; }
.operations-date-filter { align-items: end; display: flex; flex-wrap: wrap; gap: .6rem; }
.operations-date-filter label { color: var(--text-3); display: grid; font-size: .78rem; font-weight: 650; gap: .25rem; }
.operations-date-filter input { min-height: 36px; }
.operations-date-filter button { min-height: 36px; }
.operations-summary { display: grid; gap: .75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1rem 0 1.35rem; }
.operations-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; gap: .2rem; padding: .8rem; }
.operations-kpi strong { color: var(--text); font-size: 1.25rem; }
.operations-kpi span, .operations-note { color: var(--text-3); font-size: .8rem; margin: 0; }
.operations-grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.operations-grid section { min-width: 0; }
.operations-grid h3 { font-size: .95rem; margin: 0 0 .45rem; }
.operations-table { min-width: 0; }
.operations-note { margin: -.15rem 0 .55rem; }
.operations-trend { display: grid; gap: .55rem; }
.operations-trend-row { align-items: center; display: grid; gap: .6rem; grid-template-columns: 58px 1fr 34px; }
.operations-trend-row span, .operations-trend-row strong { font-size: .82rem; }
.operations-trend-row i { background: var(--surface-2); border-radius: 999px; height: 8px; overflow: hidden; }
.operations-trend-row b { background: var(--brand-500); border-radius: inherit; display: block; height: 100%; }
@media (max-width: 760px) {
  .operations-heading { flex-direction: column; }
  .operations-date-filter { width: 100%; }
  .operations-date-filter label { flex: 1 1 120px; }
  .operations-summary, .operations-grid { grid-template-columns: 1fr; }
}
/* === WP-12 báo cáo vận hành (kết thúc) === */

/* === Báo cáo vận hành: biểu đồ và bố cục quản trị (bắt đầu) === */
.operations-reports { padding: 1.25rem; }
.operations-heading { align-items: flex-end; gap: 1rem; }
.operations-heading p, .operations-section-heading p { color: var(--text-3); font-size: .84rem; margin: .25rem 0 0; }
.operations-date-filter { align-items: end; display: flex; flex-wrap: wrap; gap: .6rem; }
.operations-date-filter label { color: var(--text-3); display: grid; font-size: .78rem; font-weight: 650; gap: .25rem; }
.operations-date-filter input, .operations-date-filter button { min-height: 36px; }

.operations-summary { display: grid; gap: .75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.15rem 0 1.5rem; }
.operations-summary-skeleton { margin: 1.15rem 0 1.5rem; }
.operations-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; gap: .18rem; min-height: 98px; padding: .85rem .9rem; }
.operations-kpi span, .operations-kpi small, .operations-note { color: var(--text-3); font-size: .8rem; margin: 0; }
.operations-kpi strong { color: var(--text); font-size: 1.55rem; letter-spacing: -.025em; line-height: 1.15; }
.operations-kpi--wide { grid-template-rows: auto 1fr auto; }
.operations-kpi--wide strong { font-size: 1.25rem; align-self: center; }

.operations-report-stack { display: grid; gap: 1.35rem; }
.operations-detail-grid { display: grid; gap: 1.35rem; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.operations-report-section { border-top: 1px solid var(--border); min-width: 0; padding-top: 1.1rem; }
.operations-section-heading { align-items: flex-start; display: flex; gap: .75rem; justify-content: space-between; margin-bottom: .8rem; }
.operations-section-heading h3 { color: var(--text); font-size: 1rem; margin: 0; }
.operations-view-toggle { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; flex: 0 0 auto; font: inherit; font-size: .8rem; padding: .38rem .6rem; }
.operations-view-toggle:hover { background: var(--surface-2); color: var(--text); }
.operations-view-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.operations-chart-wrap { min-width: 0; overflow-x: auto; padding-bottom: .2rem; }
.operations-line-chart, .operations-entity-chart { display: block; min-width: 640px; width: 100%; }
.operations-chart-grid { stroke: var(--border); stroke-width: 1; }
.operations-chart-axis, .operations-company-label, .operations-company-total { fill: var(--text-3); font-size: 13px; }
.operations-chart-axis-line { stroke: var(--border-strong); stroke-width: 1; }
.operations-trend-line { fill: none; stroke: var(--info); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.operations-chart-hit { fill: transparent; cursor: pointer; }
.operations-chart-dot { fill: var(--surface); stroke: var(--info); stroke-width: 2; pointer-events: none; }
.operations-line-chart g:hover .operations-chart-dot, .operations-line-chart g:focus .operations-chart-dot { fill: var(--info); }

.operations-status-legend { color: var(--text-2); display: flex; flex-wrap: wrap; font-size: .8rem; gap: .45rem 1rem; margin-bottom: .55rem; }
.operations-status-legend span { align-items: center; display: inline-flex; gap: .35rem; }
.operations-status-legend i { border-radius: 2px; display: block; height: 10px; width: 10px; }
.operations-entity-segment.is-active, .operations-status-legend .is-active { fill: var(--info); background: var(--info); }
.operations-entity-segment.is-waiting, .operations-status-legend .is-waiting { fill: var(--warning); background: var(--warning); }
.operations-entity-segment.is-resolved, .operations-status-legend .is-resolved { fill: var(--success); background: var(--success); }
.operations-stack-track { fill: var(--surface-2); }
.operations-chart-segment-label { fill: var(--text); font-size: 12px; font-weight: 700; pointer-events: none; }
.operations-company-total { fill: var(--text-2); font-weight: 650; }

.operations-assignee-bars { display: grid; gap: .65rem; }
.operations-assignee-row { align-items: center; display: grid; gap: .6rem; grid-template-columns: minmax(100px, .9fr) minmax(110px, 2fr) 44px; }
.operations-assignee-name { color: var(--text-2); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operations-assignee-track { background: var(--surface-2); border-radius: 4px; display: block; height: 16px; overflow: hidden; }
.operations-assignee-track i { background: var(--info); border-radius: 4px; display: block; height: 100%; min-width: 2px; }
.operations-assignee-row strong { color: var(--text); font-size: .86rem; text-align: right; }

.operations-backlog-table tr.operations-backlog--unassigned { background: var(--warning-bg); }
.operations-backlog-table tr.operations-backlog--old { background: var(--surface-2); }
.operations-backlog-signal { border-radius: 999px; color: var(--text-3); font-size: .76rem; font-weight: 650; padding: .22rem .45rem; white-space: nowrap; }
.operations-backlog-signal.is-unassigned { background: var(--warning-bg); color: var(--warning-text); }
.operations-backlog-signal.is-old { background: var(--surface-3); color: var(--text-2); }
.report-display-summary { color: var(--text-3); font-size: .82rem; margin: .7rem 0 0; }

@media (max-width: 860px) {
  .operations-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operations-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .operations-reports { padding: 1rem; }
  .operations-heading { align-items: stretch; flex-direction: column; }
  .operations-date-filter { width: 100%; }
  .operations-date-filter label { flex: 1 1 120px; }
  .operations-summary { gap: .6rem; }
  .operations-kpi { min-height: 88px; padding: .75rem; }
  .operations-kpi strong { font-size: 1.3rem; }
  .operations-section-heading { align-items: flex-start; }
  .operations-line-chart, .operations-entity-chart { min-width: 620px; }
}
@media (max-width: 420px) {
  .operations-summary { grid-template-columns: 1fr; }
  .operations-assignee-row { grid-template-columns: minmax(88px, 1fr) minmax(80px, 1.6fr) 36px; gap: .45rem; }
}
/* === Báo cáo vận hành: biểu đồ và bố cục quản trị (kết thúc) === */

/* === Menu hồ sơ và tab vận hành GLPI (bắt đầu) === */
.sidebar-footer { position: relative; }
.sidebar-account-trigger { background: transparent; border: 0; box-shadow: none; color: var(--text-2); cursor: pointer; font: inherit; text-align: left; width: 100%; }
.sidebar-account-trigger:hover, .sidebar-account-trigger.is-active, .sidebar-account-trigger[aria-expanded="true"] { background: var(--brand-50); color: var(--brand-800); }
.sidebar-user-copy { display: block; min-width: 0; flex: 1; }
.sidebar-user-copy strong, .sidebar-user-copy > span { display: block; }
.sidebar-user-copy strong { font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy > span { color: var(--text-3); font-size: .75rem; }
.account-menu-caret { color: var(--text-3); font-size: 1rem; line-height: 1; transition: transform .12s ease; }
.sidebar-account-trigger[aria-expanded="true"] .account-menu-caret { transform: rotate(180deg); }
.account-menu { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); display: grid; gap: .15rem; left: .25rem; padding: .3rem; position: absolute; right: .25rem; bottom: calc(100% + .35rem); z-index: 20; }
.account-menu[hidden] { display: none; }
.account-menu-item { align-items: center; background: transparent; border: 0; border-radius: calc(var(--radius-sm) - 2px); box-shadow: none; color: var(--text-2); cursor: pointer; display: flex; font: inherit; font-size: .88rem; font-weight: 550; gap: .55rem; justify-content: flex-start; padding: .5rem .6rem; text-align: left; text-decoration: none; width: 100%; }
.account-menu-item:hover, .account-menu-item:focus-visible, .account-menu-item.is-active { background: var(--brand-50); color: var(--brand-800); outline: none; }
.account-menu-item.is-danger:hover, .account-menu-item.is-danger:focus-visible { background: var(--danger-bg); color: var(--danger); }
.integration-tabs-wrap { margin-bottom: 1.25rem; }
.integration-assignees-panel { min-width: 0; }
/* === Menu hồ sơ và tab vận hành GLPI (kết thúc) === */

/* === Khả năng tiếp cận và bảng thẻ trên màn hình hẹp (bắt đầu) === */
.chart-sample-note { color: var(--text-3); font-size: .8rem; margin: .2rem 0 .55rem; }

@media (max-width: 700px) {
  .report-table-wrap, .users-table-wrap { margin: 0; overflow: visible; padding: 0; }
  .report-table, .users-table, .report-table tbody, .users-table tbody, .report-table tr, .users-table tr, .report-table td, .users-table td { display: block; width: 100%; }
  .report-table, .users-table { min-width: 0; }
  .report-table thead, .users-table thead { display: none; }
  .report-table tr, .users-table tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: .7rem; padding: .45rem .15rem;
  }
  .report-table td, .users-table td {
    align-items: flex-start; border-bottom: 0; display: flex; gap: .75rem; justify-content: space-between;
    max-width: none; padding: .4rem .7rem;
  }
  .report-table td::before, .users-table td::before {
    color: var(--text-3); content: attr(data-label); flex: 0 0 38%; font-size: .74rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase;
  }
  .report-table .report-person, .users-table .role-confirm, .users-table .entity-scope-editor { flex: 1; min-width: 0; }
  .users-table .user-actions { align-items: stretch; flex-direction: column; }
  .users-table .user-actions button { width: 100%; }
  .entity-assignees-table .user-picker, .entity-assignees-table select { min-width: 0; width: 100%; }
  .entity-assignees-table td { min-width: 0; }
}
/* === Khả năng tiếp cận và bảng thẻ trên màn hình hẹp (kết thúc) === */
