:root {
  color-scheme: light;
  --navy: #16324f;
  --navy-soft: #244f73;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --bg: #f2f6f8;
  --panel: #fff;
  --text: #17202a;
  --muted: #64748b;
  --line: #d8e1e8;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --shadow: 0 12px 32px rgba(20, 45, 68, .08);
  --app-header-height: 64px;
  --app-footer-height: 32px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  padding-bottom: 40px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
}
.board-body { height: 100vh; min-height: 0; padding-bottom: 0; overflow: hidden; }
.logs-body { height: 100vh; min-height: 0; padding-bottom: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #b8c7d2;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 650;
}
button:hover, .button:hover { border-color: #7f9db3; background: #f8fbfd; }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { border-color: var(--teal); background: var(--teal); color: #fff; }
.primary:hover { border-color: var(--teal-dark); background: var(--teal-dark); color: #fff; }
.danger { border-color: #f0b4ae; color: var(--danger); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.03em; }
h2 { margin-bottom: 10px; font-size: 18px; }
label { display: grid; gap: 5px; color: #34495e; font-weight: 650; }
input, select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #bccbd6;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 86px; resize: vertical; font-family: Consolas, monospace; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .22);
  outline-offset: 1px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 4px 18px rgba(9, 30, 51, .2);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 205px;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand small { margin-top: 4px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; opacity: .72; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(135deg, #31b3a8, #daf8f5);
  color: var(--navy);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -.05em;
}
.brand-mark.large { width: 62px; height: 62px; border-radius: 16px; font-size: 21px; }
.app-header nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.app-header nav a {
  padding: 9px 11px;
  border-radius: 7px;
  color: #dce9f3;
  text-decoration: none;
  font-weight: 700;
}
.app-header nav a:hover, .app-header nav a.active { background: rgba(255, 255, 255, .12); color: #fff; }
.alerts-area {
  width: 420px;
  min-width: 420px;
  flex: 0 0 420px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.topbar-messages {
  width: 0;
  min-width: 0;
  max-width: 520px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  overflow: hidden;
}
.topbar-message {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 7px 8px;
  color: var(--navy);
  font-size: 12px;
  white-space: nowrap;
}
.topbar-message span {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  display: block;
  overflow: hidden;
  color: var(--navy);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alerts-button, .user-menu-button { border-color: transparent; background: transparent; color: #fff; }
.alerts-button { flex: 0 0 auto; }
.alerts-button:hover, .user-menu-button:hover, .user-menu.open .user-menu-button {
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
}
.user-menu { position: relative; }
.user-menu-button { display: flex; align-items: center; gap: 8px; }
.menu-chevron {
  width: 8px;
  height: 8px;
  margin: -3px 2px 0 3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.user-menu.open .menu-chevron { margin-top: 3px; transform: rotate(225deg); }
.avatar {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d8f3f0;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  width: 185px;
  padding: 7px;
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.user-menu.open .user-dropdown { display: grid; }
.user-dropdown a, .user-dropdown form button, .user-role { padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.user-dropdown form { margin: 0; }
.user-dropdown form button { width: 100%; min-height: 0; justify-content: flex-start; border: 0; background: transparent; font-weight: 400; }
.user-dropdown a:hover, .user-dropdown form button:hover { background: #edf5f7; }
.user-role { margin-bottom: 4px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.app-main {
  width: 100%;
  min-height: calc(100vh - 104px);
  margin: 0;
  padding: 12px 14px 38px;
}
.main-board-page {
  height: calc(100vh - var(--app-header-height) - var(--app-footer-height));
  min-height: 0;
  padding: 7px 12px 3px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.logs-page {
  height: calc(100vh - var(--app-header-height) - var(--app-footer-height));
  min-height: 0;
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page-head { margin-bottom: 10px; }
.page-head.split, .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.eyebrow {
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-weight: 450; }
.panel {
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.summary-card {
  min-height: 112px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.summary-card:hover { border-color: #95b9b6; transform: translateY(-1px); }
.summary-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e1f3f1;
  color: var(--teal);
  font-size: 24px;
  font-weight: 900;
}
.summary-card strong, .summary-card small { display: block; }
.summary-card strong { font-size: 25px; }
.summary-card small { color: var(--muted); }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-list li { padding: 10px 2px; border-bottom: 1px solid #edf1f4; font-family: Consolas, monospace; font-size: 12px; }
.activity-list li:last-child { border-bottom: 0; }
.empty-state { padding: 25px; border: 1px dashed #c8d4dc; border-radius: 9px; color: var(--muted); text-align: center; }
.starter-panel { min-height: 150px; background: linear-gradient(135deg, #fff, #edf8f7); }

.flash-list {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  width: min(460px, calc(100vw - 36px));
  display: grid;
  gap: 8px;
}
.flash {
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #9fc8c3;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #ecfdf9;
  box-shadow: var(--shadow);
}
.flash.error { border-color: #f1aaa3; border-left-color: var(--danger); background: #fff1f0; }
.flash.warning { border-color: #f5c48f; border-left-color: var(--warning); background: #fff8ed; }
.flash.success { border-left-color: var(--success); }
.flash span { flex: 1; }
.flash-close { min-width: 26px; min-height: 26px; padding: 0; border: 0; background: transparent; font-size: 19px; }

.toolbar, .inline-form, .inline-control, .actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.toolbar label { min-width: 150px; }
.add-user-form { display: grid; grid-template-columns: 1fr 1.3fr .65fr 1fr auto; align-items: end; gap: 12px; }
.profile-form { width: 100%; max-width: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; }
.profile-form .actions { justify-content: flex-end; }
.table-panel { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f5f8fa; color: #435568; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: 0; }
.inline-control { flex-wrap: nowrap; }
.inline-control input, .inline-control select { min-width: 115px; }
.check-control { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.check-control input { width: 17px; min-height: 17px; margin: 0; }
.you-badge { margin-left: 6px; padding: 2px 6px; border-radius: 9px; background: #e1f3f1; color: var(--teal); }
.icon-button { min-width: 36px; padding: 0; font-size: 20px; }

.logs-page-head {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.logs-page-head h1 { margin: 0; }
.logs-toolbar { justify-self: center; align-items: center; flex-wrap: nowrap; }
.logs-day-control { min-width: 0 !important; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.logs-day-control input { width: 150px; }
.logs-panel { min-height: 0; flex: 1 1 auto; margin-bottom: 0; padding: 0; overflow: hidden; }
.log-text {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 15px;
  overflow: auto;
  border: 0;
  background: #101b26;
  color: #d8e6ef;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.55 Consolas, "Courier New", monospace;
}

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.settings-group { display: grid; align-content: start; gap: 11px; margin: 0; }
.settings-group .panel-head { align-items: start; }
.settings-group .panel-head h2 { margin: 7px 0 0; }
.settings-group .actions { margin-top: 4px; }
.message-test-control { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; }
.message-test-control button { white-space: nowrap; }
.status-visibility-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.board-toolbar {
  flex: 0 0 auto;
  margin-bottom: 7px;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(260px, 440px) minmax(max-content, 1fr);
  align-items: end;
  gap: 12px;
}
.board-title { margin: 0 0 3px; font-size: 22px; white-space: nowrap; }
.board-title-tools { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.card-options-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-size: 11px;
  text-decoration: underline;
}
.card-options-link:hover { border: 0; background: transparent; color: var(--teal-dark); }
.jobs-search-tools { display: flex; align-items: center; justify-content: center; gap: 12px; }
.jobs-search-field {
  min-width: 220px;
  max-width: 330px;
  flex: 1 1 280px;
  position: relative;
}
.jobs-search-field > span {
  position: absolute;
  left: 10px;
  top: 50%;
  z-index: 1;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transform: translateY(-52%);
  pointer-events: none;
}
.jobs-search-field input {
  min-height: 34px;
  height: 34px;
  padding: 5px 10px 5px 34px;
  border-radius: 9px;
}
.clear-filters { color: var(--navy); font-size: 12px; font-weight: 700; white-space: nowrap; }
.board-filter-tools { display: flex; align-items: end; justify-content: flex-end; gap: 12px; }
.jobs-sync-tools { display: grid; grid-template-rows: 12px 32px; justify-items: stretch; gap: 2px; }
.jobs-sync-tools .primary { min-height: 32px; height: 32px; }
.jobs-sync-tools .primary.holding { box-shadow: inset 0 -3px 0 #f4c84b, 0 0 0 2px rgba(244, 200, 75, .3); }
.toolbar-caption {
  height: 12px;
  min-height: 12px;
  margin: 0;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  font-size: 10px;
  font-weight: 750;
  line-height: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.sync-status-link {
  border: 0;
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
}
.sync-status-link:hover { border: 0; background: transparent; color: var(--teal-dark); }
.jobs-date-filter { display: flex; align-items: end; gap: 7px; }
.jobs-date-filter label { grid-template-rows: 12px 32px; gap: 2px; font-size: 10px; line-height: 12px; text-transform: uppercase; letter-spacing: .04em; }
.jobs-date-filter select, .jobs-date-filter input { min-height: 32px; height: 32px; padding: 4px 7px; font-size: 12px; text-transform: none; letter-spacing: normal; }
.jobs-date-filter select { width: 106px; }
.jobs-date-filter input { width: 130px; }
.jobs-date-filter button, .board-filter-tools > button { min-height: 32px; height: 32px; }
.jobs-date-filter [hidden] { display: none !important; }
.jobs-status-filter { position: relative; display: grid; grid-template-rows: 12px 32px; gap: 2px; }
.jobs-filter-label {
  padding: 0 3px;
  color: #34495e;
  font-size: 10px;
  font-weight: 650;
  line-height: 12px;
  letter-spacing: .04em;
}
.jobs-status-filter-button {
  width: 154px;
  min-height: 32px;
  height: 32px;
  padding: 4px 9px;
  justify-content: space-between;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
}
.jobs-status-filter-button > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jobs-status-chevron {
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 5px;
  flex: 0 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.jobs-status-filter-button[aria-expanded="true"] .jobs-status-chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}
.jobs-status-options {
  position: fixed;
  z-index: 95;
  width: 230px;
  max-height: min(360px, 60vh);
  padding: 9px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(9, 25, 40, .22);
}
.jobs-status-options[hidden] { display: none; }
.jobs-status-options .check-control {
  min-height: 28px;
  padding: 4px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
.jobs-status-options .check-control:hover { background: #f2f7f8; }
.jobs-status-options input { width: 15px; min-height: 15px; height: 15px; margin: 0; padding: 0; flex: 0 0 auto; }

.jobs-board-scroll { width: 100%; min-height: 0; flex: 1 1 auto; overflow-x: auto; overflow-y: hidden; }
.jobs-board {
  width: 100%;
  height: 100%;
  min-width: max(100%, calc(var(--column-count, 9) * 175px));
  display: grid;
  grid-template-columns: repeat(var(--column-count, 9), minmax(167px, 1fr));
  gap: 8px;
  align-items: stretch;
}
.job-column {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #e8eef2;
  box-shadow: var(--shadow);
}
.job-column-head {
  min-height: 62px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 3px solid var(--teal);
  background: #fff;
}
.job-column-head h2 { margin: 0; font-size: 15px; }
.job-count {
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #dcecea;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}
.job-column-body {
  height: calc(100% - 62px);
  min-height: 180px;
  padding: 8px;
  counter-reset: visible-job-card;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.job-column-body.drag-over { background: #d4e9e6; box-shadow: inset 0 0 0 2px var(--teal); }
.job-column-empty {
  margin: 0;
  padding: 20px 8px;
  border: 1px dashed #bdcbd4;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}
.job-column-unassigned .job-column-head { border-bottom-color: #94a3b8; }
.job-card {
  position: relative;
  margin-bottom: 5px;
  padding: 7px 9px;
  border: 1px solid #cbd7df;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(20, 45, 68, .07);
  cursor: grab;
}
.job-card[data-card-color="yellow"] { background: #fff3b8; border-color: #e4c95c; }
.job-card[data-card-color="orange"] { background: #ffd9b3; border-color: #e7a35e; }
.job-card[data-card-color="red"] { background: #ffd0d0; border-color: #df8888; }
.job-card[data-card-color="green"] { background: #cef0d5; border-color: #7fc590; }
.job-card[data-card-color="blue"] { background: #cfe8ff; border-color: #83b9e5; }
.job-card[data-card-color="purple"] { background: #e5d7ff; border-color: #ae91dd; }
.job-card[data-card-color="gray"] { background: #dfe5ea; border-color: #aebbc5; }
.job-card:last-child { margin-bottom: 0; }
.job-card.dragging { opacity: .45; }
.job-card.saving { opacity: .65; cursor: progress; }
.job-card:not([hidden]) { counter-increment: visible-job-card; }
.job-card[hidden] { display: none; }
.job-card-client { padding-right: 27px; display: block; color: var(--navy); line-height: 1.2; overflow-wrap: anywhere; }
.job-card-position {
  position: absolute;
  top: 5px;
  right: 7px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #9dcac5;
  border-radius: 10px;
  background: #e9f7f5;
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}
.job-card-position::before { content: counter(visible-job-card); }
.job-card-link { text-decoration: none; }
.job-card-link:hover { border-color: var(--teal); background: #d8f2ef; color: var(--teal-dark); }
.job-card p { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 12px; line-height: 1.18; }
.job-card-label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.column-context-menu {
  position: fixed;
  z-index: 90;
  width: 245px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(9, 25, 40, .25);
}
.column-context-menu[hidden] { display: none; }
.column-context-options { margin: 9px 0; display: grid; gap: 7px; }
#sync-status-menu .column-context-options { max-height: min(330px, 60vh); overflow-y: auto; }
.column-context-actions { display: flex; gap: 7px; }
.column-context-error { min-height: 0; margin-top: 7px; display: block; color: var(--danger); font-size: 11px; }
.card-options-menu { width: 320px; }
.context-menu-hint { margin: 4px 0 8px; color: var(--muted); font-size: 11px; }
.card-option-list { margin-bottom: 10px; display: grid; gap: 4px; }
.card-option-row {
  min-height: 34px;
  padding: 3px 4px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f6f9fb;
}
.card-option-row.dragging { opacity: .45; }
.card-option-row.drag-over { border-color: var(--teal); }
.card-option-handle { color: var(--muted); cursor: grab; font-weight: 900; letter-spacing: -3px; }
.card-option-move { display: flex; gap: 3px; }
.card-option-move button { width: 27px; min-width: 27px; height: 27px; min-height: 27px; padding: 0; }
.job-color-menu {
  position: fixed;
  z-index: 95;
  width: 310px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(9, 25, 40, .25);
}
.job-color-menu[hidden] { display: none; }
.job-copy-options { max-height: min(330px, 55vh); display: grid; gap: 2px; overflow-y: auto; }
.job-copy-row {
  width: 100%;
  min-height: 29px;
  padding: 5px 7px;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-copy-row:first-child { color: var(--navy); font-weight: 800; }
.job-copy-row:hover { border: 0; background: #edf5f7; }
.job-copy-label { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .04em; }
.job-card-menu-separator { height: 1px; margin: 9px 0; background: var(--line); }
.job-color-options { width: max-content; margin-top: 9px; display: grid; grid-template-columns: repeat(4, 28px); gap: 9px; }
.job-color-choice {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 2px solid rgba(22, 50, 79, .18);
  border-radius: 50%;
  background: var(--card-choice-color, #fff);
}
.job-color-choice:hover, .job-color-choice.selected {
  border-color: var(--navy);
  background: var(--card-choice-color, #fff);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(22, 50, 79, .22);
}
.job-color-choice[data-card-color="yellow"] { --card-choice-color: #f4d84d; }
.job-color-choice[data-card-color="orange"] { --card-choice-color: #ef9b45; }
.job-color-choice[data-card-color="red"] { --card-choice-color: #df6868; }
.job-color-choice[data-card-color="green"] { --card-choice-color: #63b879; }
.job-color-choice[data-card-color="blue"] { --card-choice-color: #5da8e5; }
.job-color-choice[data-card-color="purple"] { --card-choice-color: #9672ce; }
.job-color-choice[data-card-color="gray"] { --card-choice-color: #96a4ae; }
.job-color-choice.no-color { position: relative; }
.job-color-choice.no-color::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: #c34c4c;
  transform: rotate(-45deg);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 25, 40, .58);
}
.dialog-backdrop.open { display: flex; }
.dialog {
  position: relative;
  width: min(560px, 95vw);
  max-height: 88vh;
  padding: 22px;
  display: grid;
  gap: 13px;
  overflow: auto;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}
.dialog-close-x { position: absolute; top: 9px; right: 9px; min-width: 30px; min-height: 30px; padding: 0; border: 0; font-size: 22px; }
.dialog-head { padding-right: 32px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; }
.alerts-dialog { width: min(900px, 95vw); height: min(700px, 88vh); grid-template-rows: auto auto 1fr auto; }
.alerts-dialog-head { grid-template-columns: 1fr auto 1fr; align-items: center; }
.alerts-dialog-head h2 { grid-column: 1; }
.alerts-day-control {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 9px;
}
.alerts-day-control input { width: 142px; }
.alerts-dialog .alerts-text {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 8px;
  white-space: pre;
  word-break: normal;
}
.alerts-actions { align-items: center; justify-content: center; }
.alerts-close-button { min-width: 125px; }
.confirm-dialog { width: min(440px, 94vw); padding-top: 26px; }
.confirm-dialog h2 { margin: 0; padding-right: 32px; }
.confirm-dialog p { min-height: 42px; margin: 0; color: #435568; }
.confirm-actions { justify-content: flex-end; }
.confirm-actions button { min-width: 92px; }

.login-main {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(40, 167, 155, .18), transparent 30%),
    linear-gradient(135deg, #eaf2f7, #f7fbfb 52%, #e8f4f3);
}
.login-box {
  width: min(430px, 94vw);
  padding: 30px;
  display: grid;
  gap: 17px;
  border: 1px solid rgba(123, 153, 172, .3);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 25px 70px rgba(20, 45, 68, .16);
}
.login-brand { margin-bottom: 4px; display: flex; align-items: center; gap: 15px; }
.login-brand h1 { margin: 0; color: var(--navy); }
.login-brand div > span { color: var(--teal); font-size: 11px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.login-box button { min-height: 42px; }
.error-panel { width: min(560px, 94vw); margin: 0; }
.app-footer {
  position: fixed;
  bottom: 0;
  z-index: 15;
  width: 100%;
  min-height: 32px;
  padding: 6px 18px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  color: var(--muted);
  font-size: 11px;
}
.jobs-sync-footer {
  min-width: 0;
  max-width: 58vw;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: #475569;
}
.jobs-sync-footer > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs-sync-footer progress { width: 90px; height: 9px; accent-color: var(--teal); }
.jobs-sync-footer progress[hidden] { display: none; }
.login-footer { justify-content: center; }

@supports (height: 100dvh) {
  .app-main { min-height: calc(100dvh - 104px); }
  .main-board-page { height: calc(100dvh - var(--app-header-height) - var(--app-footer-height)); min-height: 0; }
  .logs-page { height: calc(100dvh - var(--app-header-height) - var(--app-footer-height)); min-height: 0; }
  .board-body { height: 100dvh; }
}

@media (max-width: 1050px) {
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .add-user-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .add-user-form button { min-height: 38px; }
  .app-header { gap: 8px; }
  .brand { min-width: auto; }
}

@media (max-width: 1000px) {
  .app-header { align-items: flex-start; flex-wrap: wrap; }
  .app-header nav, .alerts-area, .user-menu { flex-wrap: wrap; }
  .alerts-area { order: 5; width: 100%; min-width: 0; flex: 1 1 100%; margin-left: 0; }
  .topbar-messages { max-width: calc(100vw - 70px); }
  .topbar-message { width: 100%; min-width: 0; }
  .topbar-message span { max-width: none; }
}

@media (max-width: 720px) {
  body { padding-bottom: 0; }
  .app-header { position: relative; padding: 9px; flex-wrap: wrap; }
  .brand { flex: 1; }
  .app-header nav { order: 3; width: 100%; overflow-x: auto; }
  .alerts-button span:last-child, .user-menu-button > span:nth-child(2) { display: none; }
  .app-main { width: 100%; padding: 8px 8px 12px; }
  .main-board-page { padding: 6px 7px 2px; }
  .summary-grid, .settings-grid, .add-user-form, .profile-form { grid-template-columns: 1fr; }
  .page-head.split, .panel-head { align-items: flex-start; flex-direction: column; }
  .page-head.split > button { width: 100%; }
  .toolbar { width: 100%; align-items: stretch; }
  .toolbar > * { flex: 1 1 100%; }
  .app-footer { position: static; }
  .app-footer.login-footer { position: fixed; }
  .inline-control { flex-wrap: wrap; }
  .message-test-control { grid-template-columns: 1fr; }
  .status-visibility-grid { grid-template-columns: 1fr; }
  .logs-body { height: auto; min-height: 100dvh; overflow: auto; }
  .logs-page { height: auto; min-height: calc(100dvh - var(--app-header-height)); overflow: visible; }
  .logs-page-head { grid-template-columns: 1fr; }
  .logs-page-head > span { display: none; }
  .logs-toolbar { width: 100%; justify-self: stretch; flex-wrap: wrap; }
  .logs-panel { min-height: 65vh; }
  .board-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .board-title { width: 100%; }
  .jobs-search-tools { justify-content: flex-start; }
  .board-filter-tools { justify-content: flex-start; overflow-x: auto; }
  .jobs-date-filter { max-width: 100%; overflow-x: auto; }
  .main-board-page .job-column { height: 100%; min-height: 0; }
  .board-body .app-footer { position: fixed; }
  .jobs-sync-footer { max-width: 70vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
