:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page: #f3f5f7;
  --surface: #ffffff;
  --panel: #fbfcfd;
  --ink: #17202a;
  --muted: #687485;
  --line: #dde3ea;
  --sidebar: #182532;
  --sidebar-soft: #223243;
  --sidebar-text: #dbe4ee;
  --accent: #0f6b7a;
  --accent-dark: #0b4f5a;
  --danger: #a34135;
  --shadow: 0 18px 46px rgba(31, 41, 55, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p {
  margin: 0;
}

.crm-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
}

.crm-sidebar {
  position: relative;
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  width: 260px;
  min-height: 100vh;
  padding: 18px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  transition: flex-basis 160ms ease, width 160ms ease, padding 160ms ease;
}

.crm-logo,
.crm-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-logo {
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 12px 0 0 auto;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #c8d4e0;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-toggle .toggle-icon-collapsed {
  display: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f5c542;
  color: #1c2630;
  font-weight: 800;
  letter-spacing: 0;
}

.crm-logo strong,
.crm-user strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.crm-logo small,
.crm-user small {
  display: block;
  margin-top: 3px;
  color: #9fb0c3;
  font-size: 12px;
}

.crm-nav {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #c6d2df;
  font-size: 14px;
  font-weight: 650;
}

.nav-text,
.crm-logo-text,
.crm-user-info {
  min-width: 0;
}

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0 7px;
  border-radius: 999px;
  background: #f5c542;
  color: #1c2630;
  font-size: 11px;
  font-weight: 900;
}

.nav-badge.inline {
  position: static;
  margin-left: 2px;
}

.nav-link svg,
.icon-button svg,
.sidebar-toggle svg,
.primary-action svg,
.file-drop svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.nav-link.active {
  background: var(--sidebar-soft);
  color: #ffffff;
}

.nav-link.disabled {
  cursor: default;
  opacity: 0.58;
}

.crm-user {
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.crm-sidebar.is-collapsed {
  flex-basis: 78px;
  width: 78px;
  padding: 14px 10px;
}

.crm-sidebar.is-collapsed .crm-logo {
  justify-content: center;
  padding: 6px 0 14px;
}

.crm-sidebar.is-collapsed .brand-mark {
  width: 42px;
  height: 42px;
}

.crm-sidebar.is-collapsed .crm-logo-text,
.crm-sidebar.is-collapsed .nav-text,
.crm-sidebar.is-collapsed .crm-user-info {
  display: none;
}

.crm-sidebar.is-collapsed .sidebar-toggle {
  margin: 12px auto 0;
}

.crm-sidebar.is-collapsed .sidebar-toggle .toggle-icon-expanded {
  display: none;
}

.crm-sidebar.is-collapsed .sidebar-toggle .toggle-icon-collapsed {
  display: block;
}

.crm-sidebar.is-collapsed .crm-nav {
  justify-items: center;
  padding-right: 0;
}

.crm-sidebar.is-collapsed .nav-link {
  justify-content: center;
  width: 48px;
  min-height: 44px;
  padding: 0;
}

.crm-sidebar.is-collapsed .nav-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 10px;
}

.crm-sidebar.is-collapsed .crm-user {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 10px 6px;
}

.crm-sidebar.is-collapsed .user-avatar {
  width: 36px;
  height: 36px;
}

.crm-sidebar.is-collapsed .icon-button {
  margin-left: 0;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e6eef7;
  color: #1d2a37;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  border-radius: 8px;
  color: #c8d4e0;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.crm-main {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  max-width: calc(100% - 260px);
}

.crm-sidebar.is-collapsed + script + .crm-main,
.crm-sidebar.is-collapsed + .crm-main {
  max-width: calc(100% - 78px);
}

.crm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: #334155;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.ghost-button.active {
  border-color: rgba(15, 107, 122, 0.45);
  background: #e8f4f6;
  color: var(--accent-dark);
}

.ghost-button svg {
  width: 15px;
  height: 15px;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-action.full {
  width: 100%;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 376px;
  gap: 18px;
  min-height: 0;
  padding: 18px;
}

.workspace {
  min-width: 0;
  min-height: 0;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  overflow: auto;
  min-height: calc(100vh - 118px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe5eb;
}

.preview-frame.selecting {
  cursor: crosshair;
}

#pdfCanvas {
  display: block;
  max-width: min(100%, 980px);
  height: auto;
  margin: 28px;
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.preview-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.overlay-fill {
  position: absolute;
  inset: 0 auto auto 0;
  height: 100%;
}

.selection-box {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  border: 2px solid #0f6b7a;
  background: rgba(15, 107, 122, 0.13);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
}

.overlay-logo {
  position: absolute;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-color: rgba(241, 245, 249, 0.85);
  border: 1px dashed rgba(15, 107, 122, 0.4);
}

.overlay-text {
  position: absolute;
  right: 18px;
  top: 16px;
  max-width: 42%;
  text-align: right;
  white-space: pre-wrap;
  line-height: 1.32;
}

.overlay-custom-text {
  position: absolute;
  left: 18px;
  top: 16px;
  max-width: 62%;
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.32;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 54px;
  height: 54px;
  color: var(--accent);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  max-height: calc(100vh - 118px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.panel-section {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-of-type {
  border-bottom: 0;
}

label {
  display: grid;
  gap: 8px;
  color: #344252;
  font-size: 13px;
  font-weight: 650;
}

.file-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px;
  border: 1px dashed #a7b3c0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.file-drop.compact {
  min-height: 46px;
}

.file-drop input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-row,
.color-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px 28px;
  align-items: center;
  gap: 10px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.color-row {
  grid-template-columns: 52px minmax(0, 1fr);
}

.template-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

input[type="number"],
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
  min-height: 78px;
}

input[type="color"] {
  width: 52px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.status {
  margin-top: auto;
  padding-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.history-section {
  gap: 12px;
}

.history-empty {
  padding: 12px;
  border: 1px dashed #c5ced8;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.history-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.history-meta strong {
  display: block;
  overflow: hidden;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.history-files {
  display: grid;
  gap: 8px;
}

.history-files a {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: #eef5f7;
  color: var(--accent-dark);
}

.history-files span {
  font-size: 12px;
  font-weight: 750;
}

.history-files strong {
  overflow: hidden;
  color: #1f2937;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
}

.settings-alert {
  padding: 0 18px;
}

.settings-layout.single {
  grid-template-columns: minmax(280px, 760px);
}

.settings-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.settings-card.wide {
  min-width: 0;
}

.logo-upload-form {
  display: grid;
  gap: 12px;
}

.logo-library {
  display: grid;
  gap: 10px;
}

.logo-library-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.logo-preview {
  display: grid;
  place-items: center;
  height: 58px;
  border: 1px dashed #cbd5df;
  border-radius: 8px;
  background: #f8fafc;
}

.logo-preview img {
  display: block;
  max-width: 84px;
  max-height: 46px;
  object-fit: contain;
}

.logo-preview span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.logo-library-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.logo-library-meta strong {
  overflow: hidden;
  color: #1f2937;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo-library-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button.danger {
  color: #a32929;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

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

.user-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.user-row form {
  display: grid;
  gap: 12px;
}

.user-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-row-head strong {
  display: block;
  color: #1f2937;
  font-size: 14px;
}

.user-row-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.inline-checks,
.password-reset-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.password-reset-form label {
  min-width: 220px;
  flex: 1 1 220px;
}

.role-guide {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.role-guide div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.role-guide strong {
  color: #1f2937;
  font-size: 13px;
}

.role-guide span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status.error,
.hint-text.error,
.form-error {
  color: var(--danger);
}

.inline-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.inline-help.is-error {
  color: var(--danger);
}

.form-success {
  padding: 10px 12px;
  border: 1px solid #a8d7bf;
  border-radius: 8px;
  background: #effaf4;
  color: #166534;
  font-size: 13px;
  font-weight: 650;
}

.muted-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.announcement-item {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.announcement-item.pinned {
  border-color: rgba(15, 107, 122, 0.38);
  background: #f2f8f9;
}

.announcement-content {
  display: grid;
  gap: 8px;
}

.announcement-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.announcement-title-row h3 {
  margin: 0;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.25;
}

.announcement-content p,
.module-intro {
  color: #334155;
  font-size: 14px;
  line-height: 1.55;
}

.announcement-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dceff2;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.badge.success {
  background: #e5f6ec;
  color: #166534;
}

.inline-editor {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.inline-editor summary {
  width: max-content;
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.inline-editor form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.dashboard-layout {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-stat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-stat svg {
  grid-row: span 2;
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.dashboard-stat strong {
  color: #1f2937;
  font-size: 24px;
  line-height: 1;
}

.dashboard-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

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

.dashboard-card {
  align-content: start;
}

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

.dashboard-list-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-list-item:hover,
.dashboard-stat:hover {
  border-color: rgba(15, 107, 122, 0.35);
  background: #f7fbfc;
}

.dashboard-date {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  background: #eef5f7;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
}

.dashboard-date svg {
  width: 17px;
  height: 17px;
}

.dashboard-list-item strong {
  display: block;
  overflow: hidden;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-list-item span:not(.dashboard-date) {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-role-card {
  margin-top: 18px;
}

.role-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.role-chip-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6fafb;
  color: #31525b;
  font-size: 12px;
  font-weight: 750;
}

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

.dashboard-announcements {
  padding: 0;
}

.dashboard-announcements.single {
  grid-template-columns: minmax(0, 1fr);
}

.module-card {
  max-width: 760px;
}

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

.module-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  font-weight: 650;
}

.module-list-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--accent);
}

.duplicate-warning {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 16px;
  border: 1px solid #e2b86f;
  border-radius: 8px;
  background: #fff8e8;
}

.duplicate-warning h2 {
  margin-bottom: 6px;
  color: #7c4f12;
}

.duplicate-warning p {
  color: #5d4630;
  font-size: 14px;
  line-height: 1.5;
}

.duplicate-list,
.job-list {
  display: grid;
  gap: 12px;
}

.job-title-link {
  color: inherit;
  text-decoration: none;
}

.job-title-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.duplicate-item,
.job-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.job-item.is-closed {
  background: #f8fafc;
  border-color: #d8e1ea;
}

.job-item.is-closed .job-title-link {
  color: #475569;
}

.job-overview {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.job-filter {
  margin-top: 0;
}

.job-detail-grid {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.job-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.job-detail-head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-meta {
  padding-top: 2px;
}

.job-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.file-upload-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

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

.job-file-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.job-file-item > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.job-file-item strong,
.job-file-item span,
.job-file-item p {
  overflow-wrap: anywhere;
}

.job-file-item span,
.job-file-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.duplicate-item {
  gap: 4px;
  border-color: #ead39a;
}

.duplicate-item strong,
.job-head strong {
  display: block;
  color: #1f2937;
  font-size: 14px;
}

.duplicate-item span,
.duplicate-item small,
.job-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.job-meta a,
.job-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.job-meta a {
  color: inherit;
  text-decoration: none;
}

.job-meta svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--accent);
}

.job-description {
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

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

.task-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  background: #ffffff;
}

.task-item.is-closed {
  background: #f8fafc;
  border-left-color: #94a3b8;
}

.task-item.is-overdue {
  border-color: #e6b7b0;
  border-left-color: #dc2626;
  background: #fffafa;
}

.task-item.priority-high,
.calendar-task.priority-high {
  border-left-color: #b33a30;
}

.task-item.priority-normal,
.calendar-task.priority-normal {
  border-left-color: var(--accent);
}

.task-item.priority-low,
.calendar-task.priority-low {
  border-left-color: #7a8a99;
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-head strong {
  display: block;
  color: #1f2937;
  font-size: 14px;
}

.task-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.task-status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-wrap {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.calendar-wrap.with-form {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  align-items: start;
}

.calendar-form {
  position: sticky;
  top: 18px;
}

.calendar-card {
  gap: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.calendar-weekdays {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.calendar-weekdays span {
  padding: 0 8px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 128px;
  padding: 9px;
  background: #ffffff;
}

.calendar-day.outside {
  background: #f3f5f7;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(15, 107, 122, 0.42);
}

.calendar-day-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: #243140;
  font-size: 12px;
  font-weight: 800;
}

.calendar-day.today .calendar-day-number {
  background: var(--accent);
  color: #ffffff;
}

.calendar-events {
  display: grid;
  gap: 6px;
}

.calendar-task {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: #eef5f7;
}

details.calendar-task summary {
  display: grid;
  gap: 2px;
  cursor: pointer;
  list-style: none;
}

details.calendar-task summary::-webkit-details-marker {
  display: none;
}

.calendar-task p {
  margin: 6px 0 0;
  color: #334155;
  font-size: 11px;
  line-height: 1.35;
}

.calendar-event.type-service {
  background: #eef7f8;
}

.calendar-event.type-meeting {
  background: #f3f7ef;
}

.calendar-event.type-deadline {
  background: #fff4ee;
}

.calendar-event.type-absence {
  background: #f6f2fb;
}

.calendar-event-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.compact-editor {
  margin-top: 8px;
}

.compact-editor label,
.compact-editor input,
.compact-editor select,
.compact-editor textarea {
  font-size: 12px;
}

.calendar-task strong {
  overflow: hidden;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-task span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-wrap {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.attendance-summary {
  gap: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-grid a,
.summary-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
}

.summary-grid a.active {
  border-color: var(--accent);
  background: #eef5f7;
}

.job-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.task-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-grid strong {
  color: #1f2937;
  font-size: 20px;
  line-height: 1.2;
}

.summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.attendance-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.attendance-filter label {
  min-width: 180px;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.checkbox-line input {
  width: auto;
  margin-top: 2px;
}

.attendance-missing {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #e6b7b0;
  border-radius: 8px;
  background: #fff2f0;
  color: #7f2b22;
  font-size: 13px;
}

.attendance-days {
  display: grid;
  gap: 12px;
}

.attendance-day {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.attendance-day.free-day {
  background: #f8fafc;
}

.attendance-day.missing {
  border-color: #e6b7b0;
  box-shadow: inset 4px 0 0 #b33a30;
}

.attendance-day-head,
.attendance-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.attendance-day-head strong,
.attendance-entry strong {
  display: block;
  color: #1f2937;
  font-size: 14px;
}

.attendance-day-head span,
.attendance-entry span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.attendance-entry-list {
  display: grid;
  gap: 8px;
}

.attendance-entry {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.attendance-entry.pending {
  border-color: #e2b86f;
  background: #fff8e8;
}

.history-empty.compact {
  padding: 9px 10px;
}

.danger-inline {
  color: #a32929;
}

.attendance-add {
  padding-top: 0;
  border-top: 0;
}

.attendance-approve {
  margin-top: -4px;
  padding: 10px;
  border: 1px solid #e2b86f;
  border-radius: 8px;
  background: #fffaf0;
}

.report-filter {
  align-items: end;
}

.report-filter-card {
  margin: 18px;
}

.report-list {
  display: grid;
  gap: 18px;
  padding: 0 18px 18px;
}

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

.report-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.report-table.compact {
  min-width: 620px;
}

.report-summary-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.report-columns h3 {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.25;
}

.report-job-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.section-heading.compact {
  gap: 10px;
}

.section-heading h3 {
  margin: 0;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.25;
}

.report-table th,
.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f8fafc;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
}

.report-table td strong,
.report-table td span {
  display: block;
}

.report-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.messages-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 18px;
}

.message-compose form,
.message-reply {
  display: grid;
  gap: 12px;
}

.message-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.message-compose select[multiple] {
  min-height: 150px;
}

.message-list-card,
.message-detail-card {
  min-width: 0;
}

.message-thread-list {
  display: grid;
  gap: 8px;
}

.message-thread {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.message-thread.active {
  border-color: rgba(15, 107, 122, 0.45);
  background: #eef7f8;
}

.message-thread.unread {
  border-color: rgba(15, 107, 122, 0.42);
  box-shadow: inset 4px 0 0 var(--accent);
}

.message-thread-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.message-thread strong {
  overflow: hidden;
  color: #1f2937;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-thread span,
.message-thread p,
.message-detail-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.message-thread p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.message-flow {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 310px);
  overflow-y: auto;
  padding-right: 4px;
}

.message-bubble {
  display: grid;
  gap: 8px;
  max-width: 78%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.message-bubble.own {
  justify-self: end;
  border-color: rgba(15, 107, 122, 0.35);
  background: #eef7f8;
}

.message-bubble div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-bubble strong {
  color: #1f2937;
  font-size: 13px;
}

.message-bubble span {
  color: var(--muted);
  font-size: 11px;
}

.message-bubble p {
  color: #334155;
  font-size: 14px;
  line-height: 1.5;
}

.contact-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.contact-filter label {
  min-width: 200px;
  flex: 1 1 220px;
}

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

.contact-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.contact-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.contact-head strong {
  display: block;
  color: #1f2937;
  font-size: 15px;
}

.contact-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.contact-meta a,
.contact-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.contact-meta svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--accent);
}

.contact-note {
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

.linked-records {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.compact-heading {
  align-items: center;
  margin-bottom: 0;
}

.compact-heading h3 {
  margin: 0;
  color: #1f2937;
  font-size: 14px;
}

.linked-record-list {
  display: grid;
  gap: 8px;
}

.linked-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: inherit;
  text-decoration: none;
}

.linked-record-item strong,
.linked-record-item small {
  display: block;
}

.linked-record-item strong {
  color: #1f2937;
  font-size: 13px;
}

.linked-record-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.external-badge {
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 8px;
  background: #eef5f7;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.permission-matrix {
  overflow-x: auto;
}

.permission-matrix table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.permission-matrix th,
.permission-matrix td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 12px;
  text-align: left;
}

.permission-matrix th {
  background: #f8fafc;
  color: #1f2937;
  font-weight: 800;
}

.permission-matrix td:not(:first-child),
.permission-matrix th:not(:first-child) {
  text-align: center;
}

.notification-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.push-diagnostics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.push-diagnostics h3,
.push-devices h3 {
  margin: 0 0 8px;
  color: #1f2937;
  font-size: 13px;
}

.diagnostic-list,
.push-devices {
  display: grid;
  gap: 8px;
}

.push-devices {
  margin-top: 16px;
}

.diagnostic-item,
.device-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.diagnostic-item.ok {
  border-color: #b7d8c4;
  background: #f0faf3;
}

.diagnostic-item.error {
  border-color: #e7b7ad;
  background: #fff3f1;
}

.diagnostic-item strong,
.device-row strong {
  color: #1f2937;
  font-size: 13px;
}

.diagnostic-item span,
.device-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.device-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.notification-item.unread {
  border-color: rgba(15, 107, 122, 0.42);
  box-shadow: inset 4px 0 0 var(--accent);
}

.notification-content {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.notification-content strong {
  color: #1f2937;
  font-size: 14px;
}

.notification-content p {
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.notification-content span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.audit-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.audit-item strong {
  color: #1f2937;
  font-size: 14px;
}

.audit-item span,
.audit-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--sidebar);
}

.login-shell {
  display: grid;
  grid-template-columns: 320px 360px;
  overflow: hidden;
  width: min(100%, 680px);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.login-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 28px;
  background: #203043;
  color: white;
}

.login-brand h1 {
  margin-top: 0;
  font-size: 22px;
}

.login-brand p {
  margin-top: 6px;
  color: #b8c6d5;
}

.login-box {
  display: grid;
  gap: 16px;
  padding: 28px;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid #e6b7b0;
  border-radius: 8px;
  background: #fff2f0;
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 1120px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .role-guide {
    grid-template-columns: 1fr;
  }

  .dashboard-stats,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .logo-library-item {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .logo-library-item form {
    grid-column: 1 / -1;
  }

  .panel {
    max-height: none;
  }

  .preview-frame {
    min-height: 540px;
  }

  .calendar-grid {
    min-width: 860px;
  }

  .calendar-wrap.with-form {
    grid-template-columns: 1fr;
  }

  .calendar-form {
    position: static;
  }

  .calendar-card {
    overflow-x: auto;
  }

  .report-columns {
    grid-template-columns: 1fr;
  }

  .messages-layout {
    grid-template-columns: 1fr;
  }

  .message-flow {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .crm-topbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .crm-shell {
    min-width: 0;
  }

  .crm-sidebar,
  .crm-sidebar:not(.is-collapsed) {
    position: sticky;
    top: 0;
    flex-basis: 72px;
    width: 72px;
    min-height: 100vh;
    height: 100vh;
    padding: 12px 8px;
    overflow: hidden;
  }

  .crm-sidebar .crm-logo,
  .crm-sidebar:not(.is-collapsed) .crm-logo {
    justify-content: center;
    padding: 6px 0 12px;
  }

  .crm-sidebar .crm-logo-text,
  .crm-sidebar .nav-text,
  .crm-sidebar .crm-user-info,
  .crm-sidebar:not(.is-collapsed) .crm-logo-text,
  .crm-sidebar:not(.is-collapsed) .nav-text,
  .crm-sidebar:not(.is-collapsed) .crm-user-info {
    display: none;
  }

  .crm-sidebar .crm-nav,
  .crm-sidebar:not(.is-collapsed) .crm-nav {
    justify-items: center;
    padding-right: 0;
  }

  .crm-sidebar .nav-link,
  .crm-sidebar:not(.is-collapsed) .nav-link {
    justify-content: center;
    width: 46px;
    min-height: 44px;
    padding: 0;
  }

  .crm-sidebar .nav-badge,
  .crm-sidebar:not(.is-collapsed) .nav-badge {
    position: absolute;
    top: 2px;
    right: 1px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 10px;
  }

  .crm-sidebar .sidebar-toggle {
    margin: 10px auto 0;
  }

  .crm-sidebar .crm-user,
  .crm-sidebar:not(.is-collapsed) .crm-user {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 10px 6px;
  }

  .crm-main,
  .crm-sidebar.is-collapsed + script + .crm-main,
  .crm-sidebar.is-collapsed + .crm-main {
    max-width: calc(100% - 72px);
  }

  .editor-layout,
  .crm-topbar,
  .job-detail-grid,
  .report-list {
    padding: 14px;
  }

  .crm-nav,
  .login-shell,
  .form-grid,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .primary-action {
    width: 100%;
  }

  .ghost-button,
  .job-detail-actions .ghost-button {
    justify-content: center;
  }

  .tool-row > .ghost-button,
  .tool-row > .primary-action {
    flex: 1 1 100%;
  }

  .settings-card {
    padding: 14px;
  }

  .report-filter-card {
    margin: 14px;
  }

  .calendar-grid {
    min-width: 720px;
  }

  .push-diagnostics {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr) 62px 24px;
  }
}
