:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --done: #15803d;
  --shadow: 0 8px 28px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Segoe UI, Roboto, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: #20343f;
  color: white;
  border-bottom: 4px solid var(--accent);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar h1,
.topbar p,
.section-title h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 23px;
  font-weight: 700;
}

.topbar p {
  margin-top: 2px;
  font-size: 13px;
  color: #c9d6df;
}

.shell {
  display: grid;
  grid-template-columns: minmax(520px, 710px) minmax(500px, 1fr) minmax(150px, 190px);
  gap: 18px;
  padding: 18px;
}

.shell.no-side-stats {
  grid-template-columns: minmax(500px, 700px) minmax(460px, 1fr);
}

.hidden {
  display: none !important;
}

.ticket-form-section,
.tickets-section {
  min-width: 0;
}

.ticket-form,
.tickets-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ticket-form {
  background: #f2fbf8;
  padding: 22px;
}

.tickets-section {
  background: #f5f8ff;
  padding: 18px;
}

.task-stats {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  box-shadow: var(--shadow);
  padding: 12px;
  font-size: 11px;
}

.task-stats h3 {
  margin: 0 0 10px;
  font-size: 13px;
  cursor: pointer;
}

.task-stats-list {
  display: grid;
  gap: 8px;
}

.task-stat-card {
  border-top: 1px solid #ece3cf;
  padding-top: 8px;
}

.task-stat-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.task-stat-card strong {
  display: block;
  margin-bottom: 5px;
}

.task-stat-user {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.task-stat-user:hover {
  background: transparent;
  color: var(--accent-strong);
  text-decoration: underline;
}

.task-stat-user strong {
  margin: 0;
  text-align: right;
  display: inline-block;
}

.task-stat-lastname {
  font-weight: 850;
  text-transform: uppercase;
  display: inline;
}

.task-stat-counts {
  display: grid;
  gap: 2px;
}

.task-stat-counts span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.task-stat-counts .status-label {
  min-width: 0;
}

.task-stat-counts .status-count {
  margin-left: auto;
  text-align: right;
  font-weight: 700;
}

.task-stat-counts [data-status="nowe"],
.my-task-summary [data-status="nowe"] {
  color: #166534;
}

.task-stat-counts [data-status="przyjęte do realizacji"],
.my-task-summary [data-status="przyjęte do realizacji"] {
  color: #1d4ed8;
}

.task-stat-counts [data-status="w trakcie realizacji"],
.my-task-summary [data-status="w trakcie realizacji"] {
  color: #c2410c;
}

.task-stat-counts [data-status="zawieszone"],
.my-task-summary [data-status="zawieszone"] {
  color: #374151;
}

.task-stat-counts [data-status="zrealizowane"],
.my-task-summary [data-status="zrealizowane"] {
  color: #b91c1c;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 20px;
}

.section-title span {
  color: var(--muted);
  font-size: 14px;
}

.section-title .form-message {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  max-width: min(360px, 55%);
  text-align: right;
  font-size: 13px;
  font-weight: 750;
}

.section-title .form-message.error {
  color: #b42318;
}

.section-title .form-message.success {
  color: #027a48;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #344054;
  position: relative;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cfd7e3;
  border-radius: 6px;
  padding: 6px 9px;
  background: white;
  color: var(--ink);
}

input:focus,
select:focus,
.editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}

.combo-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 230px;
  overflow-y: auto;
  display: grid;
  gap: 0;
  padding: 4px;
  border: 1px solid #b7c7d6;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
}

.combo-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  background: #ffffff;
  color: #102a43;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-menu button:hover {
  background: #e0f2fe;
}

.ticket-form .form-grid label {
  font-weight: 700;
}

.ticket-form .form-grid input,
.ticket-form .form-grid select {
  font-weight: 400;
}

.description-label {
  display: block;
  margin-top: 16px;
}

.field-caption {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #344054;
}

.editor-toolbar {
  position: relative;
  display: flex;
  gap: 1px;
  flex-wrap: wrap;
  align-items: center;
  padding: 4px;
  border: 1px solid #cfd7e3;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #d9dde2;
}

.editor-toolbar button,
.tool-button {
  min-width: 24px;
  min-height: 26px;
  padding: 2px 6px;
  border-radius: 2px;
  background: transparent;
  color: #263442;
  font-size: 13px;
  font-weight: 700;
  border-right: 1px solid #b7c0ca;
}

.editor-toolbar button:hover,
.tool-button:hover {
  background: #d8e1ea;
}

.toolbar-select,
.toolbar-size {
  width: auto;
  min-height: 25px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  background: #eef1f4;
}

.toolbar-select {
  max-width: 95px;
}

.toolbar-size {
  max-width: 50px;
}

.italic {
  font-style: italic;
}

.underline {
  text-decoration: underline;
}

.color-tool {
  position: relative;
}

.text-color-tool {
  color: #263442;
  border-bottom: 3px solid #d92d20;
}

.highlight-tool {
  border-bottom: 3px solid #fff200;
}

.color-palette {
  position: absolute;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 20px);
  gap: 4px;
  padding: 6px;
  margin-top: 32px;
  background: white;
  border: 1px solid #9aa6b2;
  border-radius: 4px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
}

.color-palette button {
  min-width: 20px;
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #667085;
  border-radius: 2px;
}

.editor {
  min-height: 300px;
  max-height: 620px;
  overflow: auto;
  border: 1px solid #cfd7e3;
  border-radius: 0 0 6px 6px;
  padding: 14px;
  background: white;
  line-height: 1.45;
}

.editor:empty::before {
  content: "Wpisz opis problemu...";
  color: #98a2b3;
  font-weight: 400;
}

.editor img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 8px 0;
}

.editor ol {
  margin: 8px 0 8px 24px;
  padding-left: 18px;
}

.editor p {
  margin: 8px 0;
}

.image-block {
  display: block;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
}

.image-block.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.image-block img {
  display: block;
  height: auto;
  margin: 0 0 8px 0;
  resize: both;
}

.image-tools {
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.image-tools input {
  min-height: 26px;
  padding: 0;
}

.attachments-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  color: var(--accent-strong);
  cursor: pointer;
}

.file-button input {
  display: none;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #f9fafb;
  color: #344054;
  font-size: 13px;
}

.attachment-pill img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 4px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 5px 9px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #e7edf3;
  color: #20343f;
}

button.secondary:hover {
  background: #d8e1ea;
}

.icon-button,
.close-button {
  width: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
}

.tab-button {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.tab-button.active {
  background: white;
  color: #20343f;
}

.compact-button {
  min-height: 30px;
  padding: 4px 8px;
}

button.danger {
  background: #b42318;
}

button.danger:hover {
  background: #912018;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.filters {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 112px 112px 170px minmax(210px, auto);
  gap: 8px;
  margin-bottom: 14px;
}

.filters input,
.filters select {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
  min-width: 0;
}

#assigneeFilter {
  grid-column: 3 / span 1;
  min-width: 170px;
}

#priorityFilter {
  grid-column: 1 / span 2;
}

.overdue-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  grid-column: 4 / span 2;
  width: fit-content;
  min-width: 250px;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.overdue-filter-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
}

.status-checkbox-filters {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

.status-checkbox-filters label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
  white-space: nowrap;
}

.status-checkbox-filters input {
  width: 14px;
  height: 14px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.my-task-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 24px;
  margin: -6px 0 10px;
  font-size: 12px;
}

.my-task-summary:empty {
  display: none;
}

.my-task-summary span {
  font-weight: 700;
}

.tickets-list {
  display: grid;
  gap: 10px;
}

.ticket-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid #94a3b8;
  border-radius: 8px;
  background: #ffffff;
}

.ticket-card-urgent {
  background: #fff5f5;
  border-color: #fecaca;
}

.ticket-card[data-status="nowe"] {
  border-left-color: #2563eb;
}

.ticket-card[data-status="przyjęte do realizacji"] {
  border-left-color: #7c3aed;
}

.ticket-card[data-status="w trakcie realizacji"] {
  border-left-color: var(--warn);
}

.ticket-card[data-status="zawieszone"] {
  border-left-color: #64748b;
}

.ticket-card[data-status="zakończone"],
.ticket-card[data-status="zrealizowane"] {
  border-left-color: var(--done);
}

.ticket-main {
  min-width: 0;
}

.ticket-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.ticket-id {
  color: var(--muted);
  font-weight: 750;
}

.ticket-system {
  font-weight: 800;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 750;
}

.priority-badge[data-priority="Niski"] {
  background: #ecfdf3;
  color: #027a48;
}

.priority-badge[data-priority="Normalny"] {
  background: #eff8ff;
  color: #175cd3;
}

.priority-badge[data-priority="Wysoki"] {
  background: #fff6ed;
  color: #c4320a;
}

.priority-badge[data-priority="Pilne"] {
  background: #fef3f2;
  color: #b42318;
}

.ticket-card[data-status="nowe"] .status-badge {
  background: #dcfce7;
  color: #166534;
}

.ticket-card[data-status="przyjęte do realizacji"] .status-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.ticket-card[data-status="w trakcie realizacji"] .status-badge {
  background: #ffedd5;
  color: #c2410c;
}

.ticket-card[data-status="zawieszone"] .status-badge {
  background: #e5e7eb;
  color: #374151;
}

.ticket-card[data-status="zrealizowane"] .status-badge {
  background: #fee2e2;
  color: #b91c1c;
}

.ticket-meta,
.ticket-excerpt {
  color: var(--muted);
  font-size: 13px;
}

.ticket-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.ticket-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #eef7fb;
  color: #344054;
}

.ticket-meta strong {
  margin-right: 4px;
}

.ticket-meta + .ticket-meta span {
  background: #fff7ed;
  color: #7c2d12;
}

.ticket-meta .read-status-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  color: #475467;
}

.read-status-label {
  display: inline-block;
  margin-right: 8px;
}

.read-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.read-icon.read-ok {
  background: #dcfce7;
  color: #039855;
  border: 1px solid #22c55e;
}

.read-icon.read-no {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.ticket-excerpt {
  margin-top: 10px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.ticket-controls {
  display: grid;
  gap: 6px;
  align-content: start;
}

.ticket-controls .details-button {
  background: #bae6fd;
  color: #075985;
}

.ticket-controls .details-button:hover {
  background: #7dd3fc;
}

.ticket-controls .accept-button {
  background: #16a34a;
  color: #ffffff;
}

.ticket-controls .accept-button:hover {
  background: #15803d;
}

.ticket-attachment-count {
  justify-self: end;
  padding: 2px 8px;
  border-radius: 5px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

dialog {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

dialog article {
  position: relative;
  padding: 22px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #e7edf3;
  color: #20343f;
}

#ticketDialog .close-button {
  position: sticky;
  top: 0;
  float: right;
  z-index: 50;
  margin: -8px -8px 8px 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
}

body.dialog-open {
  overflow: hidden;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.details-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 700;
  color: #344054;
  font-size: 13px;
}

.details-grid input,
.details-grid select {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 400;
}

.details-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f9fafb;
}

.details-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.details-description {
  padding-top: 8px;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #b8c2cc;
  border-radius: 8px;
  background: #ffffff;
}

.details-data-panel {
  background: #f4fbf7;
}

.details-content-panel {
  background: #ffffff;
}

.details-attachments-panel {
  background: #f7f5ff;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-section-header > h3 {
  display: none;
}

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-title h3 {
  margin: 0;
}

.collapse-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  background: #e8eef5;
  color: #263948;
}

.detail-section.collapsed > :not(.detail-section-header),
.ticket-updates.collapsed > :not(.section-title) {
  display: none;
}

.detail-section-header h3 {
  margin: 0;
  font-size: 16px;
}

.details-edit-form {
  margin: 10px 0 16px;
}

.details-edit-form label {
  font-size: 12px;
}

.details-edit-form input,
.details-edit-form select {
  min-height: 36px;
  padding: 6px 9px;
}

.compact-actions {
  margin-top: 10px;
}

.inline-message {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.assignees-editor {
  margin-top: 12px;
}

.assignee-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.assignee-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 6px;
}

.details-attachments-row {
  margin-top: 14px;
}

.description-edit-area {
  margin-top: 10px;
}

.ticket-description-editor {
  min-height: 220px;
}

.details-description .image-block {
  margin: 10px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.details-description .image-block img,
.details-description > img {
  display: block;
  max-width: 320px;
  height: auto;
  border: 1px solid #111111;
  border-radius: 0;
  margin: 8px 0;
  cursor: zoom-in;
}

.details-description .image-tools {
  display: none;
}

.details-attachments img {
  max-width: 100%;
  border: 1px solid #111111;
  border-radius: 0;
}

.details-attachments {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.existing-attachments {
  display: grid;
  gap: 8px;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.image-attachment-link {
  display: grid;
  gap: 6px;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  margin-right: 6px;
  border: 1px solid #ccd6e0;
  border-radius: 4px;
  background: #ffffff;
  color: #263948;
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
}

.image-preview-dialog {
  width: min(1100px, calc(100vw - 28px));
  background: #0b1220;
  padding: 22px;
}

.image-preview-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 90px);
  margin: 0 auto;
}

.small-dialog {
  width: min(420px, calc(100vw - 28px));
}

.small-dialog form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.image-attachment-link img {
  max-width: min(420px, 100%);
}

.panel-save-actions,
.details-bottom-actions {
  justify-content: flex-end;
}

.details-bottom-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ticket-updates {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #c4d7e7;
  border-radius: 8px;
  background: #eef7fb;
}

.ticket-updates .section-title {
  align-items: center;
}

.ticket-updates h3 {
  margin: 0;
}

.updates-list {
  display: grid;
  gap: 12px;
}

.update-item {
  padding: 12px;
  border: 1px solid #c9d2dc;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
}

.notification-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.notification-card {
  border: 1px solid #b7d8cf;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f0fdfa;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.18);
  padding: 12px;
}

.notification-card.warning {
  border-color: #fed7aa;
  border-left-color: #f97316;
  background: #fff7ed;
}

.notification-card.warning strong {
  color: #c2410c;
}

.notification-card.danger {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: #fef2f2;
}

.notification-card.danger strong {
  color: #991b1b;
}

.notification-bang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  font-weight: 900;
}

.notification-card p {
  margin: 6px 0;
  color: #475467;
  font-size: 13px;
}

.notification-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.app-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 16px;
  border: 1px solid #86efac;
  border-left: 5px solid #16a34a;
  border-radius: 8px;
  background: #f0fdf4;
  color: #14532d;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.18);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.error {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}

#mailSettingsMessage {
  font-weight: 700;
}

#mailSettingsMessage.success {
  color: #15803d;
}

#mailSettingsMessage.error {
  color: #b91c1c;
}

.update-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.update-header strong {
  color: var(--ink);
}

.stage-form {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.stage-editor {
  min-height: 180px;
  max-height: 460px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--paper);
}

.login-form {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-form h1 {
  margin: 0;
}

.current-user-badge {
  color: #dbe7ef;
  font-size: 13px;
}

.user-grid {
  display: grid;
  grid-template-columns: 76px repeat(7, minmax(0, 1fr)) auto auto;
  gap: 6px;
  align-items: center;
}

.user-form {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.user-grid input,
.user-grid select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 13px;
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-nav button {
  min-height: 32px;
  padding: 6px 10px;
  background: #eef2f7;
  color: #20343f;
  font-size: 13px;
}

.admin-nav button.active {
  background: var(--accent);
  color: #ffffff;
}

.admin-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: none;
}

.admin-section.active {
  display: block;
}

.dictionary-panels {
  display: block;
}

.dictionary-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dictionary-tab {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px 6px 0 0;
  background: #eef2f7;
  color: #20343f;
  font-size: 13px;
}

.dictionary-tab.active {
  background: var(--accent);
  color: white;
}

.dictionary-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.dictionary-panel h3 {
  margin: 0 0 10px 0;
  font-size: 15px;
}

.dictionary-add-form,
.dictionary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 6px;
}

.dictionary-add-form input,
.dictionary-item input {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.dictionary-add-form button,
.dictionary-item button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.dictionary-item {
  grid-template-columns: minmax(0, 1fr) 72px 64px;
  margin-top: 6px;
}

.unit-form {
  grid-template-columns: 120px minmax(0, 1fr) 78px;
}

.unit-item {
  grid-template-columns: 120px minmax(0, 1fr) 72px 64px;
}

.dictionary-search {
  margin-bottom: 8px;
}

.dictionary-import {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.compact-file-button {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.backup-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.ticket-controls .compact-button {
  width: 78%;
  justify-self: end;
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
  margin-top: 2px;
}

.ticket-controls .details-button + .compact-button {
  margin-top: 8px;
}

.admin-dashboard,
.admin-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.admin-dashboard article,
.admin-report-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.admin-dashboard article > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.admin-dashboard article > strong {
  font-size: 24px;
}

.admin-dashboard p,
.admin-report-grid p {
  margin: 4px 0;
  font-size: 13px;
}

.admin-table {
  overflow-x: auto;
}

.admin-table-filters,
.report-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.report-actions button {
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
  white-space: nowrap;
}

.admin-table-filters input,
.admin-table-filters select,
.column-filter-row input {
  width: min(360px, 100%);
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.column-filter-row th {
  background: #f8fafc;
  padding-top: 4px;
}

.column-filter-row input,
.column-filter-row select {
  width: 100%;
  min-height: 28px;
  font-size: 12px;
}

.date-range-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.report-print-header {
  display: none;
  margin-bottom: 14px;
  padding: 0 0 12px;
  color: #111827;
  border-bottom: 4px solid #0f766e;
}

.report-print-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 900;
  color: #111827;
}

.report-print-header p {
  margin: 0;
  color: #344054;
}

.report-actions label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.report-actions input {
  width: 130px;
  min-height: 32px;
}

.report-actions .checkbox-line {
  gap: 3px;
}

.report-actions .checkbox-line input {
  width: 13px;
  height: 13px;
  min-height: 0;
  margin: 0 2px 0 0;
  padding: 0;
}

.report-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.report-card-header h3 {
  margin: 0;
}

.report-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2e90fa;
}

.report-green .report-dot {
  background: #12b76a;
}

.report-amber .report-dot {
  background: #f79009;
}

.admin-report-grid article {
  border-top: 4px solid #2e90fa;
  overflow-x: auto;
}

.admin-report-grid article.report-green {
  border-top-color: #12b76a;
}

.admin-report-grid article.report-amber {
  border-top-color: #f79009;
}

.admin-table table,
.admin-report-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.admin-table th,
.admin-table td,
.admin-report-grid th,
.admin-report-grid td {
  padding: 6px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.admin-report-grid td:first-child,
.admin-report-grid th:first-child {
  min-width: max-content;
}

.backup-list {
  margin-top: 14px;
}

.backup-table {
  display: grid;
  gap: 8px;
}

.backup-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 2fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.backup-row div {
  display: grid;
  gap: 2px;
}

.backup-row span {
  color: var(--muted);
  font-size: 12px;
}

.backup-row button {
  width: auto;
  min-width: 78px;
  padding: 6px 10px;
  white-space: nowrap;
}

.backup-row [data-restore-existing-backup] {
  background: var(--accent);
  color: #ffffff;
}

.backup-row [data-restore-existing-backup]:hover {
  background: var(--accent-strong);
}

.backup-row .subtle-danger {
  background: #b42318;
  color: #ffffff;
}

.settings-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.settings-form label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-form input {
  width: 90px;
}

.params-form {
  display: grid;
  gap: 10px;
  max-width: 760px;
}

.param-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.param-row label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.param-row label span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}

.param-row input {
  width: 110px;
}

.mail-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  max-width: 980px;
}

.mail-settings-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 700;
  font-size: 13px;
}

.mail-settings-form input {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.mail-settings-form .checkbox-line {
  flex-direction: row;
  align-items: center;
  font-weight: 700;
}

.mail-settings-form .checkbox-line input {
  width: auto;
  min-height: auto;
}

.mail-settings-form .actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.muted-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state.compact {
  padding: 12px;
}

@media (max-width: 1020px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .dictionary-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .shell {
    padding: 14px;
  }

  .form-grid,
  .filters,
  .ticket-card,
  .details-grid,
  .assignee-rows,
  .assignee-row,
  .user-grid,
  .dictionary-add-form,
  .dictionary-item,
  .image-tools {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }
}

@media print {
  @page {
    margin: 12mm 10mm 14mm;
    @bottom-center {
      content: "str. " counter(page) "/" counter(pages);
      font-size: 10px;
      color: #475467;
    }
  }

  body.printing-report * {
    visibility: hidden !important;
  }

  body.printing-report #adminReports,
  body.printing-report #adminReports * {
    visibility: visible !important;
  }

  body.printing-report #adminReports {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    padding: 24px;
    background: #ffffff;
  }

  body.printing-report .report-actions {
    display: none !important;
  }

  body.printing-report .report-print-header {
    display: block;
  }

  body.printing-report .admin-report-grid {
    display: block;
  }

  body.printing-report .admin-report-grid article {
    break-inside: avoid;
    margin-bottom: 18px;
    box-shadow: none;
    border-radius: 10px;
    border: 1px solid #d0d5dd;
    border-top-width: 6px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  }

  body.printing-report .admin-report-grid table {
    font-size: 11px;
  }

  body.printing-report .admin-report-grid th {
    background: #eff6ff;
    color: #101828;
    padding: 5px 6px;
  }

  body.printing-report .admin-report-grid td {
    padding: 5px 6px;
  }

  body.printing-report .admin-report-grid td:last-child {
    font-weight: 800;
    color: #0f766e;
  }

  body.printing-report .report-blue .report-card-header {
    color: #1d4ed8;
  }

  body.printing-report .report-green .report-card-header {
    color: #047857;
  }

  body.printing-report .report-amber .report-card-header {
    color: #b45309;
  }
}
