:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #f0f9ff;
  --testing: #5b21b6;
  --testing-soft: #f5f3ff;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 8px 18px rgba(15, 23, 42, .06);
  --sidebar: 236px;
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-muted: #9ca3af;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
p { margin: 0 0 12px; color: var(--muted); }
h1, h2 { color: var(--text); letter-spacing: 0; }
h1 { margin: 0 0 18px; font-size: 24px; line-height: 1.2; }
h2 { margin: 0 0 14px; font-size: 16px; line-height: 1.25; }

.auth-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-body .page { width: min(430px, 100%); margin: 0; }
.auth-card {
  width: 100%;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card h1 {
  margin: 0 0 18px;
  text-align: center;
}
.login-logo {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid #0b1220;
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: inherit;
  text-decoration: none;
}
.sidebar-brand:hover { color: inherit; text-decoration: none; background: rgba(255, 255, 255, .03); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand strong { color: #fff; }
.sidebar-brand small { display: block; color: var(--sidebar-muted); font-size: 12px; margin-top: 1px; }
.side-nav { display: grid; gap: 5px; }
.side-nav a, .logout-link, .admin-portal-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #d1d5db;
  font-weight: 650;
}
.side-nav a:hover, .logout-link:hover, .admin-portal-link:hover { background: var(--sidebar-hover); color: #fff; }
.side-nav a.active {
  background: rgba(37, 99, 235, .16);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.side-nav svg, .logout-link svg, .admin-portal-link svg { width: 18px; height: 18px; flex: 0 0 auto; }
.side-nav path, .logout-link path, .admin-portal-link path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
}
.admin-portal-form { margin: 0; }
.admin-portal-link {
  width: 100%;
  border-radius: 10px;
  background: transparent;
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, .16);
  cursor: pointer;
  font: inherit;
}
.logout-link { color: #fca5a5; }
.auth-subtitle {
  margin: -10px 0 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.content-shell { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 30px;
  background: rgba(243, 245, 248, .96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar h1 { display: none; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.user-chip span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
}
.user-chip strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-button, .mobile-brand, .nav-toggle, .nav-scrim { display: none; }
.page { width: min(1280px, calc(100% - 60px)); margin: 16px auto 32px; }
.page > h1, .title-row:not(.ticket-heading) h1 { display: none; }
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.page-heading h1 {
  display: block;
  margin: 0;
  font-size: 24px;
}
.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel, .table-wrap, .stat, .project-card, .ticket-card, .timeline-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel { padding: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .025); }
.title-row, .toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.title-row p { margin-top: -8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.stats.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { position: relative; min-height: 72px; padding: 11px 13px; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 23, 42, .025); }
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat strong { display: block; margin-top: 5px; font-size: 25px; line-height: 1; }
.stat-open {
  background: var(--surface);
  border-color: #cbd5e1;
  color: #475569;
}
.stat-open::before { background: #64748b; }
.stat-open span, .stat-open strong { color: #334155; }
.stat-in_progress {
  background: var(--surface);
  border-color: #bfdbfe;
}
.stat-in_progress::before { background: var(--primary); }
.stat-in_progress span, .stat-in_progress strong { color: #1d4ed8; }
.stat-waiting {
  background: var(--surface);
  border-color: #fde68a;
}
.stat-waiting::before { background: #f59e0b; }
.stat-waiting span, .stat-waiting strong { color: #b45309; }
.stat-testing {
  background: var(--surface);
  border-color: #ddd6fe;
}
.stat-testing::before { background: #7c3aed; }
.stat-testing span, .stat-testing strong { color: var(--testing); }
.stat-completed {
  background: var(--surface);
  border-color: #bbf7d0;
}
.stat-completed::before { background: #16a34a; }
.stat-completed span, .stat-completed strong { color: #15803d; }
.stat-overdue::before { background: var(--danger); }
.stat-overdue span, .stat-overdue strong { color: var(--danger); }
.stat-link { color: inherit; text-decoration: none; }
.stat-link:hover { border-color: var(--border-strong); color: inherit; text-decoration: none; }
.dashboard-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }
.dashboard-overview .stat { min-height: 64px; }
.dashboard-overview .stat::before { background: var(--primary); }
.user-summary-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.user-summary-grid .stat { grid-column: span 3; }
.user-summary-grid .stat:nth-child(n + 5) { grid-column: span 4; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin: 0 0 10px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-dashboard-filters { grid-template-columns: minmax(220px, 1.35fr) repeat(5, minmax(112px, 1fr)) auto; }
.filters input, .filters select {
  min-height: 44px;
  border-color: #dbe3ed;
  background-color: #fbfdff;
}
.filters button { min-height: 44px; }
.dashboard-scope { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.scope-option, .scope-clear { min-height: 34px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 750; }
.scope-option.active { border-color: #bfdbfe; background: var(--primary-soft); color: var(--primary-dark); }
.scope-option:hover { background: var(--surface-soft); color: var(--text); }
.scope-clear { margin-left: 6px; border-color: transparent; background: transparent; color: var(--primary); }
.scope-clear:hover { background: var(--primary-soft); color: var(--primary-dark); }
.dashboard-list-heading { margin: 8px 0 8px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.due-today, .due-tomorrow, .overdue-text { display: block; margin-top: 2px; font-size: 11px; font-weight: 750; }
.due-today { color: var(--warning); }
.due-tomorrow { color: var(--primary); }
.overdue-text { color: var(--danger); }
.tickets-table th:last-child, .tickets-table td:last-child { width: 120px; min-width: 120px; }
.user-tickets-table th:last-child, .user-tickets-table td:last-child { width: 76px; min-width: 76px; }
.ticket-actions { vertical-align: middle; }
.ticket-action-group { display: flex; align-items: center; gap: 8px; }
.action-icon { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); text-decoration: none; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.action-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-icon:hover { border-color: #bfdbfe; background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.action-icon:focus-visible { outline: 3px solid rgba(37, 99, 235, .2); outline-offset: 2px; }
.action-icon.danger { border-color: #fecaca; color: var(--danger); }
.action-icon.danger:hover { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; }
.row-actions form { margin: 0; }
.ticket-actions .button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notification-actions form, .notification-item form { margin: 0; }
.notification-item .button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.notification-item .action-icon { flex: 0 0 36px; }
.completion-summary { margin-top: 14px; }
.completion-months { display: grid; gap: 6px; }
.completion-month { display: grid; grid-template-columns: 86px 1fr 28px; align-items: center; gap: 8px; font-size: 12px; }
.completion-month > span { color: var(--muted); }
.completion-month strong { text-align: right; }
.completion-bar { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.completion-bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.report-filters { display: grid; grid-template-columns: 150px minmax(180px, 1fr) minmax(180px, 1fr) auto; gap: 10px; align-items: end; margin: 0 0 14px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumbs-separator { color: var(--border-strong); }
.breadcrumbs-current { color: var(--text); }
.report-filters label { gap: 6px; }
.report-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.report-summary-card { padding: 10px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.report-summary-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.report-summary-card strong { display: block; margin-top: 3px; color: var(--text); font-size: 22px; }
.reports-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.report-wide { grid-column: 1 / -1; }
.report-panel { min-width: 0; }
.report-panel .section-heading span { color: var(--muted); font-size: 12px; font-weight: 700; }
.report-chart-container { position: relative; height: 176px; overflow: hidden; }
.report-y-axis { position: absolute; inset: 4px auto 22px 0; display: flex; width: 22px; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 10px; line-height: 1; text-align: right; }
.report-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; align-items: end; height: 176px; padding: 4px 0 0 30px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 41px, var(--surface-soft) 42px, transparent 43px); }
.report-bar-item { display: grid; grid-template-rows: 16px 136px 18px; gap: 2px; align-items: end; min-width: 0; text-align: center; font-size: 11px; }
.report-bar-item strong { color: var(--text); font-size: 11px; }
.report-bar-item span { color: var(--muted); }
.report-bar-track { display: flex; align-items: end; justify-content: center; height: 136px; border-bottom: 1px solid var(--border); }
.report-bar-track i { display: block; width: min(34px, 78%); border-radius: 5px 5px 0 0; background: transparent; transition: height .2s ease; }
.report-bar-track i.has-value { background: var(--primary); }
.report-horizontal-bars { display: grid; gap: 12px; }
.report-horizontal-bars > div { display: grid; grid-template-columns: minmax(100px, 145px) 1fr 30px; gap: 8px; align-items: center; font-size: 12px; }
.report-horizontal-bars > div > span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.report-horizontal-bars > div > div { height: 9px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.report-horizontal-bars i { display: block; height: 100%; border-radius: inherit; background: transparent; }
.donut-layout { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 14px; min-height: 150px; }
.report-donut { width: 150px; height: 150px; overflow: visible; }
.report-donut circle { fill: none; stroke-width: 14; }
.donut-track { stroke: var(--surface-soft); }
.donut-segment { transform: rotate(-90deg); transform-origin: 56px 56px; stroke-linecap: butt; }
.report-donut text { fill: var(--text); font-size: 17px; font-weight: 800; }
.report-donut .donut-caption { fill: var(--muted); font-size: 8px; font-weight: 700; }
.donut-legend { display: grid; gap: 8px; }
.donut-legend > div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.donut-legend > div strong { color: var(--text); }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin: 0 7px 1px 0; border-radius: 50%; }
.donut-status-open { stroke: #64748b; background: #64748b; }.donut-status-in_progress { stroke: #2563eb; background: #2563eb; }.donut-status-testing { stroke: #7c3aed; background: #7c3aed; }.donut-status-waiting { stroke: #d97706; background: #d97706; }.donut-status-completed { stroke: #16a34a; background: #16a34a; }
.donut-priority-high { stroke: #dc2626; background: #dc2626; }.donut-priority-medium { stroke: #d97706; background: #d97706; }.donut-priority-low { stroke: #16a34a; background: #16a34a; }
.project-chart { display: grid; grid-template-columns: repeat(10, minmax(52px, 1fr)); gap: 10px; align-items: end; height: 190px; overflow-x: auto; padding: 10px 0 0; border-bottom: 1px solid var(--border); }
.project-bar-item { display: grid; grid-template-rows: 18px 138px 28px; align-items: end; min-width: 52px; text-align: center; font-size: 11px; }
.project-bar-item strong { color: var(--text); }
.project-bar-item > div { display: flex; align-items: end; justify-content: center; height: 138px; }
.project-bar-item i { display: block; width: min(28px, 60%); border-radius: 5px 5px 0 0; background: var(--primary); }
.project-bar-item span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.chart-container { position: relative; width: 100%; overflow: hidden; }
.monthly-chart-container { height: 220px; }
.donut-chart-container { height: 185px; }
.project-chart-container { height: 220px; }
.chart-container canvas { display: block; width: 100% !important; height: 100% !important; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 12px; }
.chart-empty[hidden], .chart-container canvas[hidden] { display: none; }
.confirm-modal { position: fixed; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .48); }
.confirm-modal.is-open { display: flex; }
.confirm-dialog { width: min(440px, 100%); padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 20px 55px rgba(15, 23, 42, .22); }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.confirm-dialog p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.confirm-actions .button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.confirm-actions .button.danger:hover { background: #991b1b; border-color: #991b1b; }
@media (min-width: 981px) {
  body { font-size: 15px; }
  .page { width: min(1360px, calc(100% - 64px)); margin-top: 22px; }
  h1 { font-size: 28px; }
  h2 { font-size: 17px; }
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 14px; }
  .sidebar { padding-top: 20px; }
  .side-nav a, .logout-link, .admin-portal-link { min-height: 42px; font-size: 14px; }
  .stat { min-height: 80px; padding: 14px 16px; }
  .stat span { font-size: 13px; }
  .stat strong { margin-top: 7px; font-size: 28px; }
  .filters { gap: 10px; padding: 9px; }
  .filters input, .filters select, .filters button { min-height: 46px; padding-left: 14px; padding-right: 14px; font-size: 14px; }
  .dashboard-scope { gap: 0; margin-bottom: 10px; }
  .scope-option, .scope-clear { min-height: 38px; padding: 8px 14px; border-color: var(--border-strong); color: #1f2937; font-size: 13px; }
  .scope-option { border-radius: 0; }
  .scope-option:first-child { border-radius: 9px 0 0 9px; }
  .scope-option:last-of-type { border-radius: 0 9px 9px 0; }
  .scope-option.active { border-color: var(--primary); background: var(--primary); color: #fff; }
  .scope-option:hover { border-color: #93c5fd; background: var(--primary-soft); color: var(--primary-dark); }
  .scope-option.active:hover { background: var(--primary-dark); color: #fff; }
  .scope-clear { margin-left: 10px; border-radius: 9px; background: var(--surface); color: var(--primary-dark); }
  .scope-clear:hover { border-color: #93c5fd; background: var(--primary-soft); color: var(--primary-dark); }
  table th { font-size: 13px; }
  table td { font-size: 14px; padding-top: 14px; padding-bottom: 14px; }
  .action-icon { width: 40px; height: 40px; color: #1f4f8f; border-color: #94a3b8; }
  .action-icon svg { width: 19px; height: 19px; }
}
button.action-icon { min-height: 36px; padding: 0; background: var(--surface); color: #1f4f8f; border-color: var(--border-strong); }
button.action-icon.danger { background: #fff5f5; color: #c81e1e; border-color: #fecaca; }
button.action-icon.danger:hover { background: #c81e1e; color: #fff; border-color: #c81e1e; }
.work-item-actions details > summary.action-icon { display: inline-flex; list-style: none; }
.work-item-actions details > summary.action-icon::-webkit-details-marker { display: none; }
.report-horizontal-bars strong { text-align: right; }
.status-bar-open { background: #64748b !important; }.status-bar-in_progress { background: #2563eb !important; }.status-bar-testing { background: #7c3aed !important; }.status-bar-waiting { background: #d97706 !important; }.status-bar-completed { background: #16a34a !important; }
.priority-bar-high { background: #dc2626 !important; }.priority-bar-medium { background: #d97706 !important; }.priority-bar-low { background: #64748b !important; }.project-bar { background: #2563eb !important; }
.form { display: grid; gap: 12px; }
label { display: grid; gap: 7px; color: var(--text); font-size: 13px; font-weight: 700; }
.project-selector-field { gap: 7px; }
.project-combobox { position: relative; display: block; }
.project-combobox > input { padding-right: 42px; }
.project-combobox-arrow { position: absolute; top: 17px; right: 14px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.project-combobox-menu { position: absolute; z-index: 1100; top: calc(100% + 7px); left: 0; right: 0; display: none; max-height: 240px; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 28px rgba(15, 23, 42, .14); }
.project-combobox-menu.is-open { display: block; }
.project-combobox-option { display: block; width: 100%; min-height: 40px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.project-combobox-option:hover, .project-combobox-option:focus { background: var(--primary-soft); color: var(--primary-dark); outline: none; }
.project-combobox-empty { margin: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 500; }
.project-combobox select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px; }
.password-toggle { position: absolute; top: 4px; right: 4px; width: 36px; min-height: 36px; padding: 7px; border: 0; background: transparent; color: var(--muted); box-shadow: none; }
.password-toggle:hover { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.password-toggle svg { display: block; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-eye-off { display: none !important; }
.password-toggle.is-visible .password-eye { display: none; }
.password-toggle.is-visible .password-eye-off { display: block !important; }
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  cursor: pointer;
}
select::-ms-expand { display: none; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.custom-select {
  position: relative;
  display: block;
  width: 100%;
}
.custom-select select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.custom-select-button {
  width: 100%;
  min-height: 44px;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  box-shadow: none;
}
.filters .custom-select-button {
  border-color: #dbe3ed;
  background: #fbfdff;
}
.custom-select-button:hover {
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: none;
}
.custom-select-button:focus,
.custom-select.is-open .custom-select-button {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.custom-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-arrow {
  position: absolute;
  right: 12px;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}
.custom-select-menu {
  position: absolute;
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .14);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .12s ease, transform .12s ease;
}
.custom-select-menu.is-open {
  opacity: 1;
  transform: translateY(0);
}
.custom-select-option {
  width: 100%;
  min-height: 40px;
  justify-content: flex-start;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 550;
  text-align: left;
  box-shadow: none;
}
.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
}
.custom-select-option.is-selected {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover, .button:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .16);
}
.button.secondary { background: #fff; color: var(--primary); border-color: var(--border-strong); }
.button.secondary:hover { background: var(--primary-soft); color: var(--primary-dark); }
.button.danger, button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.button.danger:hover, button.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: auto; min-height: auto; }

.table-wrap { overflow-x: auto; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
th, td { padding: 9px 14px; height: 52px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
td { color: #374151; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.clickable-row { cursor: pointer; }
.ticket-link {
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .04em;
}
.ticket-title-link {
  color: var(--text);
  font-weight: 750;
}
.ticket-title-link:hover { color: var(--primary); text-decoration: none; }
.meta-text { color: var(--muted); }

.entity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.entity strong, .entity small { display: block; }
.entity small { color: var(--muted); font-size: 12px; margin-top: 1px; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.brand-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 52px;
  overflow: visible;
  flex: 0 0 auto;
}
.brand-logo {
  width: 44px;
  height: 52px;
  object-fit: contain;
}
.dashboard-date {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.role-badge { background: #eef2ff; color: #4338ca; }
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  background: #fff;
}
.icon-action:hover { background: var(--primary-soft); border-color: #bfdbfe; text-decoration: none; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-open { background: var(--info-soft); color: var(--info); }
.status-in_progress { background: var(--primary-soft); color: var(--primary); }
.status-testing { background: var(--testing-soft); color: var(--testing); }
.status-waiting { background: var(--warning-soft); color: var(--warning); }
.status-completed, .active-state { background: var(--success-soft); color: var(--success); }
.inactive-state, .priority-high { background: var(--danger-soft); color: var(--danger); }
.priority-medium { background: var(--warning-soft); color: var(--warning); }
.priority-low { background: var(--success-soft); color: var(--success); }
.project-status { background: var(--surface-soft); color: var(--muted); justify-self: start; }
.project-status-active {
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success);
  font-weight: 650;
}
.flash.error { border-color: #fecaca; background: var(--danger-soft); color: var(--danger); }
.flash-action { margin-top: -10px; margin-bottom: 14px; }
.flash-action[hidden] { display: none; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.project-card, .ticket-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.project-card:hover, .ticket-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .05);
  transform: translateY(-1px);
  text-decoration: none;
}
.project-card strong, .ticket-card strong { font-size: 15px; }
.project-card small, .ticket-card small, .ticket-num { color: var(--muted); }
.ticket-num { font-weight: 800; letter-spacing: .04em; }
.ticket-group { margin: 18px 0; }
.ticket-group h2 { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.ticket-card { margin-bottom: 10px; }
.user-ticket-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.user-ticket-card { position: relative; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.user-ticket-card:hover { border-color: #bfdbfe; box-shadow: 0 4px 12px rgba(15, 23, 42, .05); }
.user-ticket-card-main { display: grid; gap: 8px; padding-right: 42px; color: inherit; text-decoration: none; }
.user-ticket-card-main:hover { color: inherit; text-decoration: none; }
.user-ticket-card-main strong { overflow-wrap: anywhere; font-size: 16px; line-height: 1.35; }
.user-ticket-card-main small { color: var(--muted); }
.user-ticket-view { position: absolute; top: 14px; right: 14px; }
.user-due { min-height: 18px; font-weight: 700; }
.checklist-summary { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.checklist-bar { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--border); }
.checklist-bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.user-filter-actions { display: flex; align-items: end; gap: 8px; }
.work-section { margin-top: 20px; }
.completed-work {
  display: grid;
  gap: 10px;
}
.completed-card {
  grid-template-columns: minmax(90px, auto) 1fr auto;
  align-items: center;
}

.ticket-heading h1 { margin: 4px 0 0; }
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
}
.ticket-main, .ticket-side { display: grid; gap: 20px; }
.ticket-side { position: sticky; top: 98px; }
.detail-action-section { display: grid; gap: 14px; }
.detail-action-section + .detail-action-section { padding-top: 4px; border-top: 1px solid var(--border); }
.detail-action-section textarea { min-height: 130px; }
.description { color: #374151; white-space: normal; }
.details {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 13px 16px;
  margin: 0;
}
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
dd { min-width: 0; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.timeline-item { padding: 12px; margin-bottom: 10px; background: var(--surface-soft); }
.timeline-item strong { display: block; color: var(--text); }
.timeline-item time { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.timeline-item p { margin: 8px 0 0; color: #374151; }
.timeline-item .comment-body { color: #d97706; font-size: 14px; font-weight: 500; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.activity-extra[hidden] { display: none; }
.activity-toggle { justify-self: start; min-height: 36px; margin-top: 4px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-heading h2 { margin: 0; }
.work-progress-label { color: var(--muted); font-size: 12px; font-weight: 750; }
.work-progress { height: 6px; margin-bottom: 12px; overflow: hidden; border-radius: 999px; background: var(--border); }
.work-progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.work-item-list { display: grid; gap: 8px; }
.work-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.work-item-content { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.work-item-content strong { display: block; overflow-wrap: anywhere; white-space: pre-wrap; }
.work-item-check { display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 7px; background: #fff; color: #fff; flex: 0 0 auto; }
.work-item.is-completed .work-item-check { border-color: var(--success); background: var(--success); }
.work-item.is-completed strong { color: var(--muted); text-decoration: line-through; }
.work-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.work-item-meta small { color: var(--muted); }
.work-item-actions { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.work-item-actions form { margin: 0; }
.work-item-actions summary { min-height: 32px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; font-weight: 700; }
.compact-form { min-width: 230px; margin-top: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); }
.work-move-actions { display: flex; gap: 4px; }
.work-move-actions button.work-move-button { min-height: 32px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; box-shadow: none; }
.work-move-actions button.work-move-button:hover { border-color: var(--border-strong); background: var(--surface-soft); color: var(--text); box-shadow: none; }
.work-move-actions button.work-move-button:disabled { cursor: not-allowed; opacity: .4; }
.work-item-add { grid-template-columns: minmax(0, 1fr) 130px auto; align-items: center; margin-top: 12px; }
.work-item-add textarea, .work-item-create-row textarea { min-height: 70px; max-height: 220px; resize: vertical; }
.work-item-add select, .work-item-add button { align-self: center; }
.work-reorder-form { margin-top: 8px; color: var(--muted); }
.work-item-builder { display: grid; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.work-item-create-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 8px; align-items: center; }
.work-item-rows { display: grid; gap: 14px; }
.section-help { margin: -8px 0 0; color: var(--muted); font-size: 12px; }
.work-item-empty { padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; }
.work-item-empty span { font-size: 12px; }
.work-item-empty[hidden] { display: none; }
.work-item-add-another { justify-self: start; display: none; min-height: 34px; padding: 6px 10px; font-size: 12px; }
.work-item-rows:not(:empty) + .work-item-add-another { display: inline-flex; }
.work-item-rows:not(:empty) + .work-item-add-another { margin-top: 4px; }
.work-item-remove { min-height: 40px; padding: 7px 10px; color: var(--muted); }
.comment-role {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  font-weight: 850;
  vertical-align: middle;
}
.status-note-field[hidden] { display: none; }
.attachment-item, .notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.attachment-item:last-child, .notification-item:last-child { border-bottom: 0; }
.attachment-item small, .notification-item time {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.attachment-preview {
  width: 120px;
  height: 80px;
  flex: 0 0 120px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.attachment-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.attachment-meta strong {
  display: block;
  overflow-wrap: anywhere;
}
.attachment-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.attachment-actions {
  display: grid;
  gap: 8px;
  min-width: 220px;
}
.attachment-actions form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.attachment-upload { margin-top: 14px; }
.notification-item.unread {
  background: var(--primary-soft);
  margin: 0 -10px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.notification-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}
.notification-link svg {
  width: 20px;
  height: 20px;
}
.notification-link path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notification-link strong {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .72);
}
.image-lightbox.is-open { display: flex; }
.image-lightbox-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(86dvh, 760px);
  padding: 18px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .28);
}
.image-lightbox-dialog img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface-soft);
}
.image-lightbox-dialog p {
  margin: 10px 44px 0 0;
  overflow-wrap: anywhere;
}
.image-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 36px;
  padding: 7px 10px;
}

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(15, 23, 42, .38);
  }
  .content-shell { margin-left: 0; }
  .menu-button {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
  }
  .menu-button span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
  }
  .topbar { padding: 12px 18px; }
  .page { width: min(100% - 28px, 1180px); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-ticket-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-summary-grid .stat, .user-summary-grid .stat:nth-child(n + 5) { grid-column: span 1; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters button { grid-column: 1 / -1; }
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side { position: static; }
}

@media (max-width: 767px) {
  body { font-size: 14px; }
  .sidebar { width: min(300px, 86vw); }
  .topbar {
    min-height: 58px;
    align-items: center;
    padding: 8px 12px;
  }
  .topbar > div:not(.user-chip) { display: none; }
  .mobile-brand {
    display: block;
    color: var(--text);
    font-size: 16px;
    font-weight: 850;
  }
  .user-chip strong { display: none; }
  .user-chip {
    padding: 5px;
    border-color: transparent;
    background: transparent;
  }
  .user-chip span { width: 32px; height: 32px; }
  .page {
    width: 100%;
    max-width: 100%;
    margin: 14px 0 32px;
    padding: 0 16px;
  }
  .page-heading {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
  }
  .page-heading .button { width: 100%; }
  .page-heading h1 { font-size: 22px; }
  .stats, .stats.compact, .filters { grid-template-columns: 1fr; }
  .dashboard-overview { grid-template-columns: 1fr; }
  .user-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-summary-grid .stat:last-child { grid-column: 1 / -1; }
  .user-ticket-grid { grid-template-columns: 1fr; }
  .user-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-filters label:first-child, .user-filter-actions { grid-column: 1 / -1; }
  .user-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .user-filter-actions .button { width: 100%; }
  .admin-dashboard-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-dashboard-filters > input[type="search"], .admin-dashboard-filters > button { grid-column: 1 / -1; }
  .stats { gap: 10px; }
  .stat { min-height: 82px; }
  .title-row { flex-direction: column; align-items: stretch; }
  .title-row .button, .actions .button { width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .details { grid-template-columns: 1fr; gap: 5px 0; }
  .panel { padding: 15px; }
  .auth-card { margin-top: 18px; padding: 22px; }
  button, .button, input, select { min-height: 44px; }
  .toolbar { align-items: stretch; }
  .toolbar .button { width: 100%; }
  .filters {
    padding: 12px;
    gap: 10px;
  }
  .report-filters { grid-template-columns: 1fr; padding: 12px; }
  .report-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .report-filter-actions .button { width: 100%; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-grid { grid-template-columns: 1fr; gap: 10px; }
  .report-wide { grid-column: auto; }
  .report-bars { gap: 3px; }
  .report-bar-track i { width: 65%; }
  .report-horizontal-bars > div { grid-template-columns: minmax(92px, 1fr) 1.5fr 26px; gap: 6px; }
  .donut-layout { grid-template-columns: 130px 1fr; gap: 10px; }
  .report-donut { width: 130px; height: 130px; }
  .project-chart { grid-template-columns: repeat(10, 52px); }
  .dashboard-scope { flex-wrap: wrap; }
  .table-wrap.responsive-table {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .responsive-table table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .responsive-table thead { display: none; }
  .responsive-table tr {
    margin-bottom: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .responsive-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 0;
    height: auto;
    padding: 8px 0;
    border-bottom: 0;
    text-align: right;
  }
  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: left;
  }
  .responsive-table td:first-child {
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    padding-top: 0;
  }
  .responsive-table td:first-child::before { display: none; }
  .responsive-table td:last-child { padding-bottom: 0; }
  .users-table td:nth-child(2) { display: none; }
  .users-table .entity { width: 100%; }
  .users-table .entity span:last-child { min-width: 0; }
  .users-table .entity strong,
  .users-table .entity small {
    overflow-wrap: anywhere;
  }
  .tickets-table td:nth-child(3) {
    display: block;
    text-align: left;
    padding: 2px 0 8px;
  }
  .tickets-table td:nth-child(3)::before { display: none; }
  .tickets-table td:nth-child(2),
  .tickets-table td:nth-child(5),
  .tickets-table td:nth-child(6),
  .tickets-table td:nth-child(7) {
    display: flex;
  }
  .tickets-table td:nth-child(4) { display: flex; }
  .ticket-link {
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .04em;
  }
  .ticket-actions { display: flex; justify-content: flex-end; }
  .tickets-table th:last-child, .tickets-table td:last-child { width: auto; min-width: 0; }
  .user-tickets-table th:last-child, .user-tickets-table td:last-child { width: auto; min-width: 0; }
  .notification-actions { width: 100%; }
  .notification-actions .button { width: 100%; }
  .ticket-title-link {
    display: block;
    font-size: 15px;
    line-height: 1.35;
  }
  .icon-action {
    min-height: 40px;
    width: 100%;
  }
  .ticket-layout { gap: 12px; }
  .ticket-main, .ticket-side { gap: 12px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .work-item { flex-direction: column; }
  .work-item-actions { width: 100%; justify-content: flex-start; }
  .work-item-add, .work-item-create-row { grid-template-columns: 1fr; }
  .work-item-create-row { row-gap: 10px; }
  .work-item-add button, .work-item-create-row button { width: 100%; }
  .work-item-add-another { width: 100%; }
  .compact-form { min-width: 0; width: 100%; }
  .ticket-card {
    padding: 14px;
    gap: 8px;
  }
  .completed-card { grid-template-columns: 1fr; }
  .attachment-item, .notification-item, .attachment-actions form {
    display: grid;
    align-items: stretch;
  }
  .attachment-item {
    grid-template-columns: 96px 1fr;
  }
  .attachment-preview {
    width: 96px;
    height: 72px;
    flex-basis: 96px;
  }
  .attachment-meta { min-width: 0; }
  .attachment-actions {
    grid-column: 1 / -1;
  }
  .attachment-buttons .button {
    flex: 1 1 110px;
  }
  .attachment-actions { min-width: 0; }
  .project-card { padding: 14px; }
  textarea { min-height: 120px; }
  .image-lightbox {
    padding: 12px;
  }
  .image-lightbox-dialog {
    padding: 12px;
  }
  .image-lightbox-dialog img {
    max-height: 72dvh;
  }
  .custom-select select {
    position: static;
    opacity: 1;
    pointer-events: auto;
  }
  .custom-select-button {
    display: none;
  }
}
@media (max-width: 400px) {
  .user-filters, .admin-dashboard-filters { grid-template-columns: 1fr; }
  .user-filters label:first-child, .user-filter-actions, .admin-dashboard-filters > input[type="search"], .admin-dashboard-filters > button { grid-column: auto; }
  .user-filter-actions { grid-template-columns: 1fr 1fr; }
  .admin-dashboard-filters > input[type="search"], .admin-dashboard-filters > button { grid-column: 1; }
}

.custom-select-button:hover,
.custom-select-button:focus {
  background: #fff;
  color: var(--text);
}
.filters .custom-select-button:hover,
.filters .custom-select-button:focus {
  background: #fbfdff;
}
.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--surface-soft);
  color: var(--text);
}
.custom-select-option.is-selected,
.custom-select-option.is-selected:hover,
.custom-select-option.is-selected:focus {
  background: var(--primary-soft);
  color: var(--primary-dark);
}
