:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --danger: #dc2626;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --header-bg: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --header-bg: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --header-bg: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
.hidden { display: none !important; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  background: var(--header-bg);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 180px;
}

.brand-icon {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.brand-title { font-weight: 700; font-size: 1.1rem; }
.brand-sub { font-size: 0.85rem; opacity: 0.85; }

.main-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.nav-link[href*="admin"] {
  cursor: pointer;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.header-name { font-size: 0.9rem; }

.btn-header {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.btn-header:hover { background: rgba(255, 255, 255, 0.25); }

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-quality { background: #3b82f6; color: #fff; }
.badge-manager { background: #f97316; color: #fff; }
.badge-executor { background: #22c55e; color: #fff; }
.badge-admin { background: #ef4444; color: #fff; }

.notif-wrap { position: relative; }

.notif-bell {
  position: relative;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
}

.notif-bell:hover { background: rgba(255, 255, 255, 0.25); }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
}

.notif-dropdown.open { display: block; }

.notif-item, .notif-list-item {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.notif-item:hover, .notif-list-item:hover { background: var(--bg); }
.notif-item.read, .notif-list-item.read { opacity: 0.65; }

.notif-icon { font-size: 1.25rem; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-body p { margin: 0.25rem 0; font-size: 0.85rem; }
.notif-time { font-size: 0.75rem; color: var(--muted); }
.notif-empty { padding: 1rem; text-align: center; }

.notif-all {
  display: block;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
}

.notif-group-title {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.25rem 0 0.5rem;
}

.notif-group-title:first-child { margin-top: 0; }

.main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-narrow { max-width: 420px; margin: 2rem auto; }

h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
h2 { margin: 1.25rem 0 0.75rem; font-size: 1.15rem; }

.data-table th.num,
.data-table td.num {
  text-align: right;
  white-space: nowrap;
}

.admin-stats {
  margin: 0.5rem 0 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  border-radius: 8px;
}

.admin-tabel-form .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tabel-user-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.35rem 1rem;
  max-height: 220px;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.tabel-user-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.tabel-results {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tabel-user-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card, #fff);
}

.tabel-user-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: var(--bg);
  padding: 0.75rem 1rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.tabel-user-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

.tabel-chevron {
  width: 1rem;
  flex-shrink: 0;
  color: var(--muted);
}

.tabel-user-meta {
  margin-left: auto;
  font-size: 0.85rem;
}

.tabel-user-entries {
  padding: 0.75rem 1rem 1rem;
  display: grid;
  gap: 0.75rem;
}

.tabel-user-entries[hidden] {
  display: none !important;
}

.tabel-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.tabel-entry:last-child {
  border-bottom: 0;
}

.tabel-entry-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tabel-photo-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: block;
}

.tabel-photo-btn {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 6px;
}

.tabel-photo-btn:hover .tabel-photo-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.tabel-photo-link {
  display: inline-block;
}

.tabel-photo-modal {
  max-width: min(96vw, 920px);
  padding: 1rem 1.25rem 1.25rem;
}

.tabel-photo-full {
  max-width: 100%;
  max-height: min(80vh, 900px);
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.tabel-photo-full.hidden {
  display: none;
}

.tabel-photo-loading {
  text-align: center;
  margin: 2rem 0;
}

.admin-tabel-upload {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.admin-tabel-upload-row {
  align-items: flex-end;
  gap: 1rem;
}

.tabel-night-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.tabel-upload-files-label input[type="file"] {
  display: block;
  margin-top: 0.35rem;
}

.tabel-upload-results {
  margin-top: 0.75rem;
}

.tabel-upload-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.etna-report-details {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
}
.etna-report-details dt { color: var(--muted); margin: 0; }
.etna-report-details dd { margin: 0; }
.etna-report-modal { max-width: 720px; max-height: 90vh; overflow: auto; }
.etna-report-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.muted { color: var(--muted); }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 0.75rem; }
.mt-1 { margin-top: 1rem; }
.text-danger { color: var(--danger); font-weight: 600; }

.form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.form input, .form select, .form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}

.btn:hover:not(:disabled) { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.stat-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.stat-alert .stat-value { color: #ef4444; }
.stat-warn .stat-value { color: #f97316; }
.stat-ok .stat-value { color: #22c55e; }

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th, .data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  background: var(--bg);
}

.data-table th.sortable {
  padding: 0;
}

.sort-th {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}

.data-table th.num .sort-th {
  justify-content: flex-end;
  text-align: right;
}

.sort-th:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .sort-th:hover {
  background: rgba(255, 255, 255, 0.06);
}

.data-table th.sort-active .sort-th {
  color: var(--primary);
}

.data-table tbody tr:hover { background: var(--bg); }
.task-row { cursor: pointer; }
.row-overdue { background: rgba(239, 68, 68, 0.08); }

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status-registered { background: #e0e7ff; color: #3730a3; }
.status-unassigned { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-closed { background: #d1fae5; color: #065f46; }

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.toolbar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.field .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field.block p { margin: 0.25rem 0 0; }
.stub-note { padding: 1rem; background: var(--bg); border-radius: 8px; }

.profile-card .profile-top {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}

.avatar.placeholder {
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

.search-block { margin-bottom: 1rem; }

.search-results {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.search-hit {
  display: block;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.search-hit:last-child { border-bottom: none; }
.search-hit small { display: block; color: var(--muted); font-size: 0.8rem; }
.search-hit:hover { background: var(--bg); }

.profile-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.profile-tabel-upload {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  width: 100%;
}

.profile-tabel-upload h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.profile-tabel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.theme-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.radio-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.radio-pill:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

.switch { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(22px); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }

.modal-box {
  position: relative;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  min-width: 300px;
  max-width: 90vw;
  box-shadow: var(--shadow);
  z-index: 1;
  flex-shrink: 0;
  margin: auto;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Длинные формы: прокрутка внутри, кнопки закреплены внизу */
.modal-box.modal-scroll {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: min(560px, 92vw);
}

.modal-scroll .modal-header {
  flex-shrink: 0;
  padding: 1.25rem 2.75rem 0.5rem 1.5rem;
}

.modal-scroll .modal-header h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.modal-scroll .modal-header .muted {
  margin: 0;
  font-size: 0.88rem;
}

.modal-scroll .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0.5rem 1.5rem 1rem;
  scrollbar-gutter: stable;
}

.modal-scroll .modal-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 400;
  transition: transform 0.25s;
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast-error { border-color: var(--danger); color: var(--danger); }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.admin-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-tab:hover { color: var(--text); background: var(--bg); }
.admin-tab.active { background: var(--primary); color: #fff; }

.admin-panel {
  background: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 0.5rem;
}

.admin-panel h2 { margin-top: 0; font-size: 1.1rem; }
.admin-panel h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.form-inline label { margin: 0; flex: 1; min-width: 200px; }

.actions-cell { white-space: nowrap; }

.modal-wide:not(.modal-scroll) { min-width: 420px; max-width: 560px; }

.empty { text-align: center; color: var(--muted); padding: 2rem; }
.login-error { color: var(--danger); font-size: 0.9rem; margin-top: 0.75rem; }
.boot-msg { text-align: center; color: var(--muted); padding: 3rem 1rem; }

.form-wide { max-width: 900px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 1rem;
}

.service-fields {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, var(--bg));
}

.service-fields legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-row select,
.filter-row input {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  min-width: 160px;
}

.filter-row input[name="search"] { flex: 1; min-width: 200px; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.center { text-align: center; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin: 0.5rem 0 1rem;
  transition: border-color 0.15s, background 0.15s;
}

.upload-zone.drag {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}

.file-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.preview-item {
  position: relative;
  width: 100px;
}

.preview-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.preview-item.file-only {
  width: auto;
  min-width: 120px;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.8rem;
}

.preview-item button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.timeline {
  border-left: 3px solid var(--primary);
  margin: 1rem 0 1.5rem;
  padding-left: 1.25rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.25rem;
}

.timeline-dot {
  position: absolute;
  left: -1.6rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.timeline-note {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.assign-panel {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.report-form-panel,
.report-panel,
.act-panel,
.letter-panel {
  background: var(--bg);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 1.25rem;
}

.report-form-panel h2,
.report-panel h2,
.letter-panel h2 { margin-top: 0; }

.act-panel {
  margin-top: 1rem;
  border: 1px solid var(--border);
}

.act-panel h3 { margin: 0 0 0.5rem; font-size: 1rem; }

.letter-panel .form-actions { margin-top: 0.5rem; }

.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.attach-thumb-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
  max-width: 120px;
  text-align: center;
}

.attach-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.file-chip {
  font-size: 0.85rem;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  display: inline-block;
}

@media (max-width: 640px) {
  .header { flex-direction: column; align-items: stretch; }
  .main-nav { justify-content: center; }
  .header-actions { justify-content: center; }
  .notif-dropdown { right: -40px; width: 280px; }
}
