:root {
  --bg: #07090d;
  --surface: #121720;
  --surface-2: #18212c;
  --surface-3: #0d1118;
  --line: rgba(236, 231, 222, 0.13);
  --line-strong: rgba(236, 231, 222, 0.26);
  --text: #f6f1e8;
  --muted: #9aa5b5;
  --teal: #17d6c6;
  --teal-dark: #7ff7ed;
  --blue: #78a7ff;
  --green: #6ee7a8;
  --amber: #d7b56d;
  --red: #ff5c8a;
  --red-bg: rgba(255, 92, 138, 0.14);
  --amber-bg: rgba(215, 181, 109, 0.14);
  --green-bg: rgba(110, 231, 168, 0.14);
  --blue-bg: rgba(120, 167, 255, 0.14);
  --glass: rgba(18, 23, 32, 0.84);
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 28px),
    linear-gradient(90deg, rgba(23, 214, 198, 0.055), transparent 38%, rgba(215, 181, 109, 0.04)),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(246, 241, 232, 0.018) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, rgba(7, 9, 13, 0), rgba(7, 9, 13, 0.82));
}

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

button {
  cursor: pointer;
}

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

svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-sprite {
  display: none;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(23, 214, 198, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(215, 181, 109, 0.12), transparent 34%),
    var(--bg);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(24, 33, 44, 0.94), rgba(13, 17, 24, 0.98)),
    var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    var(--shadow);
}

.login-card h1 {
  font-size: clamp(26px, 7vw, 30px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.login-subtitle,
.login-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-message:not(:empty) {
  min-height: 36px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 92, 138, 0.46);
  border-radius: var(--radius);
  background: var(--red-bg);
  color: var(--red);
  font-weight: 750;
}

.form-message {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 92, 138, 0.46);
  border-radius: var(--radius);
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
  font-weight: 780;
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 214, 198, 0.11), transparent 36%),
    linear-gradient(180deg, rgba(24, 33, 44, 0.88), rgba(13, 17, 24, 0.94));
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.26);
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  font-size: 15px;
  line-height: 1.35;
}

.topbar-actions,
.board-tools,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Shared modal footer contract: actions live in their own protected row. */
.task-dialog .dialog-actions {
  position: relative;
  z-index: 2;
  min-height: 70px;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 22px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(248, 251, 250, 0.98);
  box-shadow: 0 -8px 24px rgba(35, 58, 61, 0.06);
}

.task-dialog .dialog-actions > .btn {
  width: auto;
  min-width: 112px;
  flex: 0 0 auto;
  justify-content: center;
}

.task-dialog .dialog-actions > .btn.primary {
  min-width: 164px;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.06);
  color: #d8e1ea;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.btn,
.icon-btn,
.segment,
.chip {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--surface-2);
  color: var(--text);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 750;
  white-space: nowrap;
}

.btn:hover,
.icon-btn:hover,
.segment:hover,
.chip:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(23, 214, 198, 0.08);
}

.btn:active,
.icon-btn:active,
.segment:active,
.chip:active {
  transform: translateY(1px);
}

.btn.primary {
  background:
    linear-gradient(135deg, #13b9ad, #08786f),
    var(--teal);
  border-color: var(--teal);
  color: #f7fffd;
  box-shadow: 0 12px 24px rgba(23, 214, 198, 0.16);
}

.btn.primary:hover {
  background:
    linear-gradient(135deg, #29e6d8, #0f8f86),
    var(--teal-dark);
  color: #041311;
}

.btn.secondary {
  background:
    linear-gradient(135deg, rgba(215, 181, 109, 0.22), rgba(215, 181, 109, 0.08));
  border-color: rgba(215, 181, 109, 0.46);
  color: #f5d994;
}

.btn.ghost {
  background: rgba(246, 241, 232, 0.04);
}

.btn.danger {
  color: var(--red);
  border-color: rgba(255, 92, 138, 0.38);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
}

.control-band {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.date-filter {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.date-filter .control {
  min-width: 150px;
}

.date-mode-tabs {
  margin-bottom: 0;
}

.control,
.field {
  display: grid;
  gap: 6px;
}

.control span,
.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 9, 13, 0.66);
  color: var(--text);
  outline: none;
}

input,
select {
  padding: 0 10px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(154, 165, 181, 0.82);
}

select option {
  background: var(--surface-3);
  color: var(--text);
}

input[type="checkbox"] {
  accent-color: var(--teal);
}

textarea {
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 214, 198, 0.14);
}

.segmented {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 9, 13, 0.68);
}

.segment {
  min-height: 32px;
  padding: 0 13px;
  border-color: transparent;
  font-weight: 760;
}

.segment.active {
  background: rgba(23, 214, 198, 0.13);
  border-color: var(--line-strong);
  color: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(23, 214, 198, 0.08);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(420px, 1fr);
  gap: 14px;
  align-items: start;
}

.left-panel,
.main-panel,
.right-panel {
  min-width: 0;
}

.left-panel,
.right-panel {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 14px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(18, 23, 32, 0.72);
}

.search-box input {
  min-height: 40px;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.filter-block,
.mini-summary,
.focus-head,
.daily-summary,
.department-matrix,
.deadline-list,
.table-wrap {
  background:
    linear-gradient(180deg, rgba(24, 33, 44, 0.92), rgba(13, 17, 24, 0.94)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.filter-block,
.mini-summary,
.daily-summary,
.department-matrix,
.deadline-list {
  padding: 12px;
}

.filter-block.compact {
  display: grid;
  gap: 10px;
}

.filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 800;
}

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

.department-picker {
  display: grid;
  gap: 10px;
}

.department-select {
  min-width: 0;
  font-weight: 760;
}

.department-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
  color: var(--muted);
  font-size: 12px;
}

.department-current strong {
  color: var(--teal-dark);
  font-size: 13px;
  white-space: nowrap;
}

.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.chip > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.active {
  border-color: var(--teal);
  background: rgba(23, 214, 198, 0.12);
  color: var(--teal-dark);
}

.chip-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    var(--surface);
}

.metric .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.metric .value {
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
  font-weight: 850;
  color: var(--text);
}

.metric.warning {
  background: var(--amber-bg);
  border-color: rgba(215, 181, 109, 0.42);
}

.metric.danger {
  background: var(--red-bg);
  border-color: rgba(255, 92, 138, 0.42);
}

.metric.success {
  background: var(--green-bg);
  border-color: rgba(110, 231, 168, 0.38);
}

.board-view,
.management-view,
.right-panel textarea {
  background:
    linear-gradient(180deg, rgba(24, 33, 44, 0.94), rgba(13, 17, 24, 0.96)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.board-head p,
.focus-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.columns.single-status {
  grid-template-columns: minmax(260px, 1fr);
}

.board-status-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  background: rgba(7, 9, 13, 0.42);
}

.status-tab {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-width: 88px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 760;
  white-space: nowrap;
}

.status-tab strong {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.status-tab.active {
  border-color: var(--teal);
  background: rgba(23, 214, 198, 0.12);
  color: var(--teal-dark);
}

.column {
  min-width: 0;
  min-height: 480px;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.column:last-child {
  border-right: 0;
}

.column-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
  background: rgba(7, 9, 13, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  min-width: 0;
}

.column-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.task-card {
  display: grid;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(246, 241, 232, 0.055), rgba(246, 241, 232, 0.015)),
    var(--surface-3);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.task-card.overdue {
  border-color: rgba(255, 92, 138, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 92, 138, 0.14), rgba(255, 92, 138, 0.045)),
    var(--surface-3);
}

.task-card.rolled {
  border-style: dashed;
  border-color: rgba(215, 181, 109, 0.46);
}

.task-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.task-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.task-title strong {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.task-meta,
.task-subline,
.attachment-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
  max-width: 100%;
}

.task-subline span {
  flex: 1 1 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

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

.task-attachment-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.task-attachment-preview {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 9, 13, 0.72);
  color: var(--muted);
  text-decoration: none;
}

.task-attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-badge {
  font-size: 12px;
  font-weight: 780;
}

.task-attachment-info {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.task-attachment-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.task-attachment-name:hover {
  color: var(--teal-dark);
}

.task-attachment-download {
  width: 36px;
  height: 36px;
  text-decoration: none;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(246, 241, 232, 0.08);
  color: #d0d8e1;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
  max-width: 100%;
}

.tag.collab {
  background: rgba(23, 214, 198, 0.1);
  color: var(--teal-dark);
}

.tag.high {
  background: var(--red-bg);
  color: var(--red);
}

.tag.medium {
  background: var(--amber-bg);
  color: var(--amber);
}

.tag.low {
  background: var(--blue-bg);
  color: var(--blue);
}

.tag.done {
  background: var(--green-bg);
  color: var(--green);
}

.task-detail {
  min-width: 0;
  color: #c9d1dc;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.card-actions .status-select {
  flex: 0 1 88px;
  min-width: 76px;
  max-width: 100%;
}

.card-actions .btn {
  flex: 1 1 112px;
  min-width: 0;
  padding-inline: 10px;
}

.card-actions .icon-btn {
  flex: 0 0 40px;
}

.collab-progress {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.collab-progress-row {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.collab-progress-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.collab-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.collab-progress-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  white-space: nowrap;
}

.collab-status.pending {
  background: var(--amber-bg);
  color: var(--amber);
}

.collab-status.doing {
  background: var(--blue-bg);
  color: var(--blue);
}

.collab-status.blocked {
  background: var(--red-bg);
  color: var(--red);
}

.collab-status.done {
  background: var(--green-bg);
  color: var(--green);
}

.status-select {
  min-height: 34px;
  font-size: 13px;
}

.status-select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  background: var(--surface-2);
}

.empty-state {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 110px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  overflow-wrap: anywhere;
}

.mini-summary {
  display: grid;
  gap: 10px;
}

.alert-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
}

.alert-row svg {
  color: var(--red);
  margin-top: 1px;
}

.alert-row strong {
  display: block;
  margin-bottom: 3px;
}

.alert-row span {
  color: var(--muted);
}

.focus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.right-panel textarea {
  min-height: 150px;
}

.daily-summary {
  display: grid;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.summary-line {
  display: grid;
  gap: 5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.summary-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.summary-line strong {
  color: var(--text);
}

.summary-line span {
  color: var(--muted);
}

.management-view {
  overflow: hidden;
}

.management-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.insight-card {
  display: grid;
  gap: 9px;
  min-height: 108px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(246, 241, 232, 0.055), rgba(246, 241, 232, 0.016)),
    var(--surface-3);
}

.insight-card.warning {
  border-color: rgba(215, 181, 109, 0.42);
  background: var(--amber-bg);
}

.insight-card.danger {
  border-color: rgba(255, 92, 138, 0.42);
  background: var(--red-bg);
}

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

.insight-top strong,
.ops-kpi strong {
  white-space: nowrap;
}

.insight-top span {
  color: var(--teal-dark);
  font-size: 22px;
  font-weight: 850;
}

.insight-card p,
.ops-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ops-panel {
  display: grid;
  gap: 14px;
  margin: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(24, 33, 44, 0.84), rgba(13, 17, 24, 0.92)),
    var(--surface);
}

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

.ops-head h3,
.department-matrix h3,
.deadline-list h3 {
  margin-bottom: 4px;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.ops-field {
  min-width: 0;
}

.ops-input-wrap {
  position: relative;
}

.ops-input-wrap input {
  padding-right: 42px;
}

.ops-input-wrap em {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
  pointer-events: none;
}

.ops-visuals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ops-kpi {
  display: grid;
  gap: 7px;
  min-height: 90px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.ops-kpi strong {
  font-size: 22px;
  line-height: 1;
}

.ops-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.management-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
  gap: 12px;
  padding: 14px;
}

.department-matrix,
.deadline-list {
  box-shadow: none;
}

.matrix-row,
.deadline-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.matrix-row:last-child,
.deadline-row:last-child {
  border-bottom: 0;
}

.department-fold {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.department-fold:last-child {
  border-bottom: 0;
}

.department-fold summary {
  display: grid;
  gap: 7px;
  cursor: pointer;
  list-style: none;
}

.department-fold summary::-webkit-details-marker {
  display: none;
}

.department-fold .matrix-top strong::before {
  content: "▸";
  display: inline-block;
  width: 16px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-1px);
}

.department-fold[open] .matrix-top strong::before {
  content: "▾";
}

.department-fold-body {
  display: grid;
  gap: 8px;
  padding: 10px 0 0 16px;
}

.department-task-preview {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
  border: 1px solid var(--line);
  font-size: 12px;
}

.department-task-preview strong {
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.department-task-preview span,
.department-more {
  color: var(--muted);
}

.department-more {
  font-size: 12px;
  padding: 2px 0 0;
}

.matrix-top,
.deadline-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deadline-top {
  align-items: flex-start;
}

.matrix-top strong,
.deadline-top strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-tags {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.table-tags {
  justify-content: flex-start;
  margin-top: 6px;
}

.deadline-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.deadline-meta span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(246, 241, 232, 0.08);
  white-space: nowrap;
}

.bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(246, 241, 232, 0.09);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.table-wrap {
  margin: 0 14px 14px;
  max-height: min(72vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tbody tr:hover {
  background: rgba(246, 241, 232, 0.035);
}

tr:last-child td {
  border-bottom: 0;
}

th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  white-space: nowrap;
}

.task-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background:
    linear-gradient(180deg, rgba(24, 33, 44, 0.98), rgba(13, 17, 24, 0.99)),
    var(--surface);
  color: var(--text);
  box-shadow: 0 28px 86px rgba(0, 0, 0, 0.56);
}

/* Long-form module dialogs use one scroll container between a fixed header and footer. */
.task-dialog:is(
  .equipment-editor-dialog,
  .equipment-report-dialog,
  .equipment-progress-dialog,
  .materials-editor-dialog,
  .materials-import-dialog,
  .materials-stock-dialog,
  .materials-request-dialog,
  .materials-process-dialog,
  .safety-editor-dialog,
  .safety-rectification-dialog,
  .safety-review-dialog,
  .customer-feedback-editor-dialog,
  .customer-feedback-progress-dialog,
  .customer-feedback-close-dialog
) {
  max-height: min(92dvh, 920px);
  overflow: hidden;
}

.task-dialog:is(
  .equipment-editor-dialog,
  .equipment-report-dialog,
  .equipment-progress-dialog,
  .materials-editor-dialog,
  .materials-import-dialog,
  .materials-stock-dialog,
  .materials-request-dialog,
  .materials-process-dialog,
  .safety-editor-dialog,
  .safety-rectification-dialog,
  .safety-review-dialog,
  .customer-feedback-editor-dialog,
  .customer-feedback-progress-dialog,
  .customer-feedback-close-dialog
) > form {
  display: grid;
  width: 100%;
  min-height: 0;
  max-height: min(92dvh, 920px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.task-dialog:is(
  .equipment-editor-dialog,
  .equipment-report-dialog,
  .equipment-progress-dialog,
  .materials-editor-dialog,
  .materials-import-dialog,
  .materials-stock-dialog,
  .materials-request-dialog,
  .materials-process-dialog,
  .safety-editor-dialog,
  .safety-rectification-dialog,
  .safety-review-dialog,
  .customer-feedback-editor-dialog,
  .customer-feedback-progress-dialog,
  .customer-feedback-close-dialog
) > form > :nth-child(2) {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.feedback-dialog {
  width: min(820px, calc(100vw - 28px));
  overflow: hidden;
}

.task-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
}

#taskForm {
  padding: 18px;
}

#passwordForm {
  padding: 18px;
}

#personnelForm {
  padding: 18px;
}

#feedbackForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(84vh, 760px);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Shared module-dialog header contract.
   New full-form dialogs inherit safe spacing automatically; legacy padded forms keep their compact header. */
.task-dialog > form:not(:where(#taskForm, #passwordForm, #personnelForm)) > .dialog-head {
  min-width: 0;
  margin: 0;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(18, 132, 123, 0.06), transparent 44%),
    rgba(255, 255, 255, 0.98);
}

.task-dialog > form > .dialog-head > div:first-child {
  min-width: 0;
}

.task-dialog > form > .dialog-head .eyebrow,
.task-dialog > form > .dialog-head h2,
.task-dialog > form > .dialog-head .dialog-context {
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

.personnel-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: min(92dvh, 920px);
  overflow: hidden;
}

#personnelForm {
  max-height: min(92dvh, 920px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.personnel-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: -4px 0 14px;
}

.personnel-info {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#personnelUser:disabled {
  color: var(--muted);
  background: rgba(234, 242, 241, 0.74);
}

.admin-password-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.admin-password-panel .btn {
  justify-self: start;
}

.feedback-dialog .dialog-head {
  margin: 0;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(23, 214, 198, 0.1), transparent 42%),
    var(--surface);
}

.feedback-dialog .dialog-head .icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.dialog-context {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.feedback-dialog .dialog-context {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.feedback-dialog .dialog-context span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(246, 241, 232, 0.08);
  color: #cfd8e2;
  font-size: 12px;
  font-weight: 760;
}

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

.field.wide {
  grid-column: 1 / -1;
}

.collab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 9, 13, 0.42);
}

.collab-group {
  display: grid;
  gap: 6px;
  align-content: start;
}

.collab-group strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.collab-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  color: #d7dde6;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.collab-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.collab-option.disabled {
  color: var(--muted);
  opacity: 0.58;
}

.collab-option-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.collab-contact-panel {
  margin: 0 0 8px 22px;
  padding: 9px 10px;
  border: 1px solid rgba(17, 133, 128, 0.22);
  border-left: 3px solid rgba(17, 133, 128, 0.48);
  border-radius: 12px;
  background: rgba(17, 133, 128, 0.08);
}

.collab-contact-panel.hidden {
  display: none;
}

.collab-contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.collab-contact-head small,
.collab-contact-option small,
.collab-contact-line {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.collab-contact-options {
  display: grid;
  gap: 6px;
}

.collab-contact-option {
  display: grid;
  grid-template-columns: auto minmax(42px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #d7dde6;
  font-size: 12px;
  font-weight: 720;
}

.collab-contact-option input {
  width: 14px;
  min-height: 14px;
  margin: 0;
}

.collab-contact-option span,
.collab-contact-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-internal-panel {
  padding: 12px;
  border: 1px solid rgba(17, 133, 128, 0.32);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(17, 133, 128, 0.1), rgba(17, 133, 128, 0.025)),
    rgba(7, 9, 13, 0.34);
}

.brand-internal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.brand-internal-head span {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.brand-internal-head small {
  color: var(--muted);
  font-size: 12px;
}

.brand-internal-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.38fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.brand-member-field {
  display: grid;
  gap: 8px;
}

.brand-member-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.brand-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.brand-member-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 48px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.brand-member-option input {
  width: 16px;
  min-height: 16px;
  margin: 2px 0 0;
}

.brand-member-option.disabled {
  color: var(--muted);
  opacity: 0.55;
}

.brand-member-option strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.brand-member-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.brand-progress {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid rgba(17, 133, 128, 0.24);
  border-radius: 14px;
  background: rgba(17, 133, 128, 0.055);
}

.brand-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.brand-progress-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-progress-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.brand-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.brand-progress-row strong,
.brand-progress-row span {
  overflow-wrap: anywhere;
}

.brand-progress-row small {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.brand-internal-editor {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 16px 20px;
  overflow-y: auto;
  background: rgba(7, 9, 13, 0.5);
}

.brand-internal-feedback {
  display: grid;
  gap: 12px;
}

.feedback-rows {
  display: grid;
  gap: 14px;
  min-height: 0;
  margin: 0;
  padding: 16px 20px;
  overflow-y: auto;
  background: rgba(7, 9, 13, 0.5);
}

.feedback-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(246, 241, 232, 0.05), rgba(246, 241, 232, 0.012)),
    var(--surface-3);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.feedback-row.blocked {
  border-color: rgba(255, 92, 138, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 92, 138, 0.13), rgba(255, 92, 138, 0.035)),
    var(--surface-3);
}

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

.feedback-dept {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.feedback-dept > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.feedback-row-head strong {
  white-space: nowrap;
  font-size: 16px;
}

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

.feedback-row-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.feedback-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.feedback-status-actions .btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.feedback-status-actions .mark-feedback-done {
  border-color: rgba(18, 132, 123, 0.42);
  background: rgba(18, 132, 123, 0.1);
  color: var(--teal-dark);
}

.feedback-status-actions .mark-feedback-reopen {
  border-color: rgba(121, 137, 145, 0.28);
  color: var(--muted);
}

.feedback-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.feedback-status-choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
  color: #d7dde6;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.feedback-status-choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.feedback-status-choice:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(23, 214, 198, 0.14);
}

.feedback-status-choice.pending:has(input:checked) {
  border-color: rgba(215, 181, 109, 0.58);
  background: var(--amber-bg);
  color: var(--amber);
}

.feedback-status-choice.doing:has(input:checked) {
  border-color: rgba(120, 167, 255, 0.48);
  background: var(--blue-bg);
  color: var(--blue);
}

.feedback-status-choice.blocked:has(input:checked) {
  border-color: rgba(255, 92, 138, 0.54);
  background: var(--red-bg);
  color: var(--red);
}

.feedback-status-choice.done:has(input:checked) {
  border-color: rgba(110, 231, 168, 0.5);
  background: var(--green-bg);
  color: var(--green);
}

.feedback-row-fields {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  gap: 10px;
}

.feedback-row-fields .wide {
  grid-column: 1 / -1;
}

.feedback-dialog .feedback-note {
  min-height: 92px;
}

.feedback-attachment-box {
  display: grid;
  gap: 8px;
}

.feedback-attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.feedback-upload-btn {
  position: relative;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  overflow: hidden;
}

.feedback-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.feedback-attachment-list {
  display: grid;
  gap: 8px;
}

.feedback-attachment-empty {
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
}

.feedback-attachment-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.035);
}

.feedback-attachment-preview {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.feedback-attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feedback-attachment-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.feedback-attachment-info a,
.feedback-attachment-info span {
  overflow: hidden;
  color: var(--text);
  font-weight: 760;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-attachment-info small {
  color: var(--muted);
  font-size: 12px;
}

.feedback-card-attachments {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.feedback-card-attachments svg {
  width: 15px;
  height: 15px;
}

.feedback-card-attachments a,
.feedback-card-attachments span {
  max-width: 160px;
  overflow: hidden;
  color: var(--teal-dark);
  font-weight: 760;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-dialog .dialog-actions {
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-3);
}

.attachment-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.attachment-item {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 94px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246, 241, 232, 0.045);
}

.attachment-item img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.attachment-name {
  color: #c9d1dc;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.spacer {
  flex: 1;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(215, 181, 109, 0.38);
  background: rgba(13, 17, 24, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-panel {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  }

  .daily-summary {
    align-content: start;
  }

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

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .board-head,
  .focus-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .left-panel,
  .right-panel {
    position: static;
  }

  .right-panel {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-status-tabs {
    display: flex;
  }

  .columns {
    grid-template-columns: repeat(4, minmax(240px, 1fr));
  }

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

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

  .management-insights,
  .ops-visuals {
    grid-template-columns: 1fr;
  }

  .ops-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .feedback-row-fields {
    grid-template-columns: 1fr;
  }

  .feedback-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .card-actions .icon-btn,
  .card-actions .btn {
    width: 100%;
  }

  .management-tools {
    width: 100%;
  }

  .management-tools .segment {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .task-dialog > form:not(:where(#taskForm, #passwordForm, #personnelForm)) > .dialog-head {
    padding: 12px 14px;
  }

  .topbar-actions,
  .control-band {
    align-items: stretch;
    flex-direction: column;
  }

  .date-filter,
  .date-filter .control,
  .date-filter .segmented {
    width: 100%;
  }

  .btn,
  .segmented,
  .segment {
    width: 100%;
  }

  .segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

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

  .brand-internal-grid,
  .brand-member-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand-member-field,
  .brand-member-grid,
  .brand-member-option {
    min-width: 0;
    width: 100%;
  }

  .feedback-dialog .dialog-head,
  .feedback-rows,
  .feedback-dialog .dialog-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .feedback-row-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Comfortable light luxury theme.
   This override keeps the existing layout and interactions, but removes the heavy dark treatment. */
:root {
  --bg: #f3f7f7;
  --surface: #ffffff;
  --surface-2: #eef5f4;
  --surface-3: #f8fbfa;
  --line: #d9e3e2;
  --line-strong: #bdcbc9;
  --text: #152329;
  --muted: #61717c;
  --teal: #12847b;
  --teal-dark: #075f59;
  --blue: #446f9f;
  --green: #327d5d;
  --amber: #a97625;
  --red: #b83f52;
  --red-bg: #fff1f3;
  --amber-bg: #fff7e8;
  --green-bg: #edf8f1;
  --blue-bg: #edf5ff;
  --glass: rgba(255, 255, 255, 0.86);
  --shadow: 0 14px 34px rgba(23, 42, 48, 0.12);
  color-scheme: light;
}

body {
  background:
    linear-gradient(135deg, rgba(18, 132, 123, 0.08), transparent 32%),
    linear-gradient(180deg, #fbfdfd 0%, #f1f6f6 46%, #eef4f3 100%);
  color: var(--text);
}

body::before {
  background:
    linear-gradient(90deg, rgba(18, 132, 123, 0.035) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(238, 244, 243, 0.42));
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(18, 132, 123, 0.1), transparent 38%),
    linear-gradient(315deg, rgba(169, 118, 37, 0.08), transparent 36%),
    linear-gradient(180deg, #fbfdfd, #eef4f3);
}

.login-card,
.topbar,
.filter-block,
.mini-summary,
.focus-head,
.daily-summary,
.department-matrix,
.deadline-list,
.table-wrap,
.board-view,
.management-view,
.right-panel textarea,
.task-dialog {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 250, 0.98)),
    var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.login-card {
  border-color: #c8d6d5;
}

.topbar {
  background:
    linear-gradient(135deg, rgba(18, 132, 123, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 249, 0.98));
}

.eyebrow,
.department-current strong,
.chip.active,
.segment.active,
.status-tab.active,
.task-attachment-name:hover {
  color: var(--teal-dark);
}

.login-subtitle,
.login-message,
.board-head p,
.focus-head p,
.task-meta,
.task-subline,
.attachment-line,
.task-attachment-info,
.collab-progress-row,
.summary-line span,
.insight-card p,
.ops-head p,
.ops-kpi span,
.department-task-preview span,
.department-more,
.deadline-meta,
.feedback-row-head span,
.dialog-context,
.attachment-name {
  color: var(--muted);
}

.account-badge,
.department-current,
.deadline-meta span,
.feedback-dialog .dialog-context span {
  background: #f3f8f7;
  color: #4e616a;
  border-color: var(--line);
}

.btn,
.icon-btn,
.segment,
.chip,
.status-tab {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(23, 42, 48, 0.04);
}

.btn:hover,
.icon-btn:hover,
.segment:hover,
.chip:hover,
.status-tab:hover {
  border-color: rgba(18, 132, 123, 0.46);
  color: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(18, 132, 123, 0.08);
}

.btn.primary {
  background: linear-gradient(135deg, #15998f, #0f756e);
  border-color: #0f756e;
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(18, 132, 123, 0.18);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #19aaa0, #0c6861);
  color: #ffffff;
}

.btn.secondary {
  background: #fff8ea;
  border-color: #d9bf88;
  color: #815c1c;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.74);
}

.btn.danger {
  color: var(--red);
  border-color: #e8b7bf;
}

input,
select,
textarea,
.search-box input {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

input::placeholder,
textarea::placeholder {
  color: rgba(97, 113, 124, 0.74);
}

select option {
  background: #ffffff;
  color: var(--text);
}

.search-box,
.segmented,
.collab-grid {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.collab-contact-panel {
  background: #f5fbfa;
  border-color: rgba(18, 132, 123, 0.22);
  border-left-color: rgba(18, 132, 123, 0.58);
}

.collab-contact-option {
  color: var(--text);
}

.segment.active,
.chip.active,
.status-tab.active {
  background: #e7f5f3;
  border-color: rgba(18, 132, 123, 0.42);
  box-shadow: none;
}

.chip-count,
.count-pill,
.status-tab strong {
  background: #eaf2f1;
  color: #5b6c74;
}

.metric,
.insight-card,
.ops-kpi,
.task-card,
.task-attachment-card,
.collab-progress,
.department-task-preview,
.admin-password-panel,
.feedback-row,
.attachment-item {
  background:
    linear-gradient(180deg, #ffffff, #f8fbfa),
    var(--surface);
  border-color: var(--line);
  color: var(--text);
  box-shadow: 0 8px 20px rgba(23, 42, 48, 0.08);
}

.metric.warning,
.insight-card.warning {
  background: var(--amber-bg);
  border-color: #e2c994;
}

.metric.danger,
.insight-card.danger,
.task-card.overdue,
.feedback-row.blocked {
  background: var(--red-bg);
  border-color: #e7aeb8;
}

.metric.success {
  background: var(--green-bg);
  border-color: #b7d8c4;
}

.board-status-tabs,
.column-head,
.feedback-dialog .dialog-actions {
  background: #f7fbfa;
  border-color: var(--line);
}

.column-head {
  backdrop-filter: blur(10px);
}

.task-card.rolled {
  border-color: #d9bf88;
}

.task-detail,
.collab-progress-top strong,
.summary-line strong,
.department-task-preview strong,
.task-attachment-name {
  color: var(--text);
}

.task-attachment-preview {
  background: #eef5f4;
  color: var(--muted);
}

.tag {
  background: #edf4f3;
  color: #4c6169;
}

.tag.collab {
  background: #e3f4f2;
  color: var(--teal-dark);
}

.tag.high,
.collab-status.blocked,
.feedback-status-choice.blocked:has(input:checked) {
  background: var(--red-bg);
  color: var(--red);
}

.tag.medium,
.collab-status.pending,
.feedback-status-choice.pending:has(input:checked) {
  background: var(--amber-bg);
  color: var(--amber);
}

.tag.low,
.collab-status.doing,
.feedback-status-choice.doing:has(input:checked) {
  background: var(--blue-bg);
  color: var(--blue);
}

.tag.done,
.collab-status.done,
.feedback-status-choice.done:has(input:checked) {
  background: var(--green-bg);
  color: var(--green);
}

.ops-panel {
  background:
    linear-gradient(180deg, #ffffff, #f8fbfa),
    var(--surface);
  border-color: var(--line);
}

.bar {
  background: #e7efee;
}

.bar span {
  background: linear-gradient(90deg, #12847b, #b88a38);
}

tbody tr:hover {
  background: #f6faf9;
}

.task-dialog::backdrop {
  background: rgba(22, 39, 45, 0.32);
  backdrop-filter: blur(4px);
}

.feedback-dialog .dialog-head {
  background:
    linear-gradient(135deg, rgba(18, 132, 123, 0.08), transparent 44%),
    #ffffff;
}

.feedback-rows {
  background: #f3f7f7;
}

.feedback-status-choice {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

.toast {
  border-color: #d9bf88;
  background: #173036;
  color: #ffffff;
}

/* Department task list + detail workspace (selected design direction 2). */
body {
  background: #f4f8f7;
}

.app-stage > .topbar {
  min-height: 72px;
  padding: 12px 16px;
  border-color: #dfe8e7;
  background: #ffffff;
  box-shadow: 0 3px 14px rgba(23, 42, 48, 0.05);
}

.app-stage > .topbar h1 {
  font-size: 28px;
}

.topbar-account-menu {
  position: relative;
}

.topbar-account-menu > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 2px 8px 2px 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #42535c;
  cursor: pointer;
  list-style: none;
}

.topbar-account-menu > summary::-webkit-details-marker {
  display: none;
}

.topbar-account-menu > summary:hover,
.topbar-account-menu[open] > summary {
  border-color: #d6e3e1;
  background: #f3f8f7;
}

.topbar-account-menu > summary > svg {
  width: 15px;
  height: 15px;
  transform: rotate(90deg);
  transition: transform 0.16s ease;
}

.topbar-account-menu[open] > summary > svg {
  transform: rotate(-90deg);
}

.topbar-account-menu .account-badge {
  border: 0;
  background: transparent;
  color: #34464f;
  font-size: 13px;
  min-height: 22px;
  padding: 0;
}

.account-identity {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.account-identity small {
  max-width: 220px;
  overflow: hidden;
  color: #7a8a92;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  width: 240px;
  padding: 8px;
  border: 1px solid #d9e3e2;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(23, 42, 48, 0.15);
}

.topbar-account-profile {
  display: grid;
  gap: 3px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid #e3ebea;
}

.topbar-account-profile strong {
  color: #24343c;
  font-size: 14px;
}

.topbar-account-profile span,
.topbar-account-profile small {
  color: #74858d;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.personnel-permissions {
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.personnel-permissions legend {
  padding: 0 6px;
  color: #24343c;
  font-weight: 800;
}

.personnel-permissions > p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.personnel-permission-grid > label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 66px;
  padding: 10px;
  border: 1px solid #dce7e5;
  border-radius: 10px;
  background: #fbfdfd;
  cursor: pointer;
  overflow: hidden;
}

#personnelDialog .personnel-permission-grid input[type="checkbox"] {
  appearance: auto;
  display: block;
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  margin-top: 2px;
  padding: 0;
  border-radius: 4px;
  box-shadow: none;
}

#personnelDialog .personnel-permission-grid > label > span {
  display: grid;
  width: auto;
  max-width: 100%;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
  writing-mode: horizontal-tb;
}

#personnelDialog .personnel-permission-grid strong {
  display: block;
  color: #34464f;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  word-break: keep-all;
}

#personnelDialog .personnel-permission-grid small {
  display: block;
  color: #7a8a92;
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.personnel-permission-grid > label:has(input:checked) {
  border-color: #61bcb4;
  background: #edf8f6;
}

.personnel-department-access {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.personnel-access-heading > div {
  display: grid;
  gap: 4px;
}

.personnel-access-heading strong {
  color: #24343c;
  font-size: 14px;
  line-height: 1.4;
}

.personnel-access-heading small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

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

.personnel-access-card {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #d9e5e3;
  border-radius: 10px;
  background: #ffffff;
}

.personnel-access-card legend {
  padding: 0 6px;
  color: #34464f;
  font-size: 12px;
  font-weight: 800;
}

.personnel-access-card legend span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e8f5f3;
  color: #0f766e;
  font-size: 10px;
}

.personnel-access-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 9px;
}

.personnel-access-actions button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #cddbd9;
  border-radius: 7px;
  background: #ffffff;
  color: #53666e;
  font: inherit;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.personnel-access-actions button:hover {
  border-color: #61bcb4;
  background: #edf8f6;
  color: #0f766e;
}

.personnel-department-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 238px;
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.personnel-department-grid > label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid #e0e9e8;
  border-radius: 8px;
  background: #fbfdfd;
  color: #465a62;
  cursor: pointer;
}

#personnelDialog .personnel-department-grid input[type="checkbox"] {
  appearance: auto;
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  min-height: 16px;
  max-height: 16px;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  box-shadow: none;
}

.personnel-department-grid > label > span {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personnel-department-grid > label:has(input:checked) {
  border-color: #75c6be;
  background: #edf8f6;
  color: #0f766e;
}

.topbar-account-popover .btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  border: 0;
  box-shadow: none;
}

.btn.primary {
  background: #12847b;
  border-color: #12847b;
  color: #ffffff;
}

.btn.primary:hover {
  background: #0d6f68;
  color: #ffffff;
}

.control-band {
  align-items: center;
  justify-content: space-between;
  padding: 0 0 14px;
}

.control-band .control > span {
  display: none;
}

.workspace-list-detail {
  display: block;
}

.workspace-list-detail .main-panel {
  width: 100%;
}

.workspace-list-detail .metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid #dfe8e7;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 3px 14px rgba(23, 42, 48, 0.045);
}

.workspace-list-detail .metric {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 16px;
  border: 0;
  border-right: 1px solid #e3eae9;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.workspace-list-detail .metric:last-child {
  border-right: 0;
}

.workspace-list-detail .metric .label {
  color: #65767e;
  font-size: 13px;
  font-weight: 700;
}

.workspace-list-detail .metric .value {
  margin: 0;
  color: #3e4f57;
  font-size: 28px;
  font-weight: 780;
}

.workspace-list-detail .metric.danger .value {
  color: #c8363f;
}

.workspace-list-detail .metric.warning .value {
  color: #c67a12;
}

.workspace-list-detail .metric.success .value {
  color: #318153;
}

.workspace-list-detail .board-view {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.board-list-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(330px, 0.95fr);
  gap: 12px;
  align-items: start;
}

.task-list-panel,
.task-detail-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe8e7;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(23, 42, 48, 0.055);
}

.task-list-panel .board-status-tabs {
  gap: 4px;
  min-height: 54px;
  padding: 8px 14px 0;
  border-bottom: 1px solid #dfe8e7;
  background: #ffffff;
}

.task-list-panel .status-tab {
  position: relative;
  min-width: 82px;
  min-height: 45px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.task-list-panel .status-tab::after {
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

.task-list-panel .status-tab.active {
  color: #087169;
  background: transparent;
}

.task-list-panel .status-tab.active::after {
  background: #12847b;
}

.task-list-panel .status-tab strong {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #eef4f3;
  color: #61717c;
}

.board-filter-bar {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(150px, 0.9fr) minmax(132px, 0.7fr) auto;
  gap: 8px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid #e1e8e7;
  background: #fbfdfd;
}

.board-filter-bar .search-box {
  min-height: 40px;
  background: #ffffff;
}

.board-filter-bar .search-box input {
  min-height: 36px;
}

.inline-department-picker {
  display: block;
}

.inline-department-picker .department-current {
  display: none;
}

.inline-department-picker .department-select,
.inline-filter-control select {
  min-height: 40px;
  font-size: 13px;
}

.inline-filter-control {
  gap: 0;
}

.inline-filter-control > span {
  display: none;
}

.filter-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
  color: #60727a;
  font-size: 13px;
  font-weight: 700;
}

.mobile-filter-actions,
.task-row-mobile-meta {
  display: none;
}

.task-detail-action-buttons {
  display: contents;
}

.list-board-head {
  min-height: 46px;
  padding: 9px 14px;
  background: #ffffff;
}

.list-board-head h2 {
  display: none;
}

.list-board-head p {
  margin: 0;
  color: #718188;
  font-size: 12px;
}

.task-table {
  min-height: 520px;
  background: #ffffff;
}

.task-table-header,
.task-table-row {
  display: grid;
  grid-template-columns: 40px minmax(190px, 1.6fr) minmax(78px, 0.7fr) minmax(70px, 0.65fr) 86px 94px 74px 18px;
  gap: 8px;
  align-items: center;
}

.task-table-header {
  min-height: 40px;
  padding: 0 14px;
  border-top: 1px solid #edf1f1;
  border-bottom: 1px solid #dfe8e7;
  color: #708087;
  font-size: 11px;
  font-weight: 700;
}

.task-row-group-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid #e6eceb;
  color: #5d6d74;
  font-size: 12px;
  font-weight: 760;
}

.task-row-group-title strong {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #eef4f3;
  color: #5f7078;
}

.task-row-group.urgent .task-row-group-title {
  color: #c33b46;
}

.task-row-group.urgent .task-row-group-title::before {
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: #d73f49;
  content: "";
}

.task-table-row {
  position: relative;
  min-height: 72px;
  padding: 9px 14px;
  border-bottom: 1px solid #e7edec;
  color: #2e4048;
  cursor: pointer;
  outline: none;
}

.task-table-row:hover {
  background: #f8fbfa;
}

.task-table-row:focus-visible {
  box-shadow: 0 0 0 3px rgba(18, 132, 123, 0.18) inset;
}

.task-table-row.selected {
  background: #edf8f6;
}

.task-table-row.selected::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #12847b;
  content: "";
}

.task-row-priority {
  display: grid;
  place-items: center;
  color: #88979d;
}

.task-row-priority.high,
.task-table-row.overdue .task-row-priority {
  color: #d73f49;
}

.task-row-priority.medium {
  color: #c37c18;
}

.task-row-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.task-row-title strong {
  display: -webkit-box;
  overflow: hidden;
  color: #26383f;
  font-size: 13px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-row-title span,
.task-row-department,
.task-row-owner {
  overflow: hidden;
  color: #6d7e85;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row-due {
  display: grid;
  gap: 2px;
  color: #44565e;
}

.task-row-due strong {
  font-size: 12px;
  font-weight: 700;
}

.task-row-due small {
  min-height: 16px;
  color: #7a898f;
  font-size: 10px;
}

.task-row-due.overdue,
.task-row-due.overdue small {
  color: #d13b46;
}

.task-row-due.urgent,
.task-row-due.urgent small {
  color: #c57b13;
}

.task-row-collaboration,
.task-row-status {
  justify-self: start;
  padding: 5px 8px;
  border: 1px solid #dbe5e3;
  border-radius: 7px;
  color: #67777e;
  background: #f7faf9;
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.task-row-collaboration.has-collaboration {
  border-color: #cfe3e0;
  color: #0c766e;
  background: #eef8f6;
}

.task-row-status.status-open {
  color: #617078;
}

.task-row-status.status-doing {
  border-color: #bcded9;
  color: #087169;
  background: #edf8f6;
}

.task-row-status.status-review {
  border-color: #ead2a6;
  color: #9a681f;
  background: #fff8eb;
}

.task-row-status.status-done {
  border-color: #bfddca;
  color: #2e7956;
  background: #eef8f2;
}

.task-row-arrow {
  width: 16px;
  height: 16px;
  color: #8b999f;
}

.task-list-empty,
.task-detail-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 430px;
  padding: 32px;
  color: #7b898f;
  text-align: center;
}

.task-list-empty svg,
.task-detail-empty svg {
  width: 42px;
  height: 42px;
  color: #bdd0cd;
}

.task-list-empty span,
.task-detail-empty span {
  max-width: 280px;
  font-size: 12px;
  line-height: 1.6;
}

.task-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 14px;
  border-top: 1px solid #dfe8e7;
  color: #6e7e85;
  font-size: 12px;
}

.task-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-pagination .icon-btn {
  width: 32px;
  height: 32px;
}

.task-pagination .icon-btn:first-child svg {
  transform: rotate(180deg);
}

.task-pagination strong {
  min-width: 52px;
  color: #31434b;
  text-align: center;
}

.task-detail-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 255px);
  overflow-y: auto;
}

.task-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid #e1e8e7;
}

.task-detail-head > div {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.task-detail-head h3 {
  color: #1f3138;
  font-size: 17px;
  line-height: 1.45;
}

.task-detail-close {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
}

.task-detail-meta {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid #e3eae9;
}

.task-detail-meta > div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.task-detail-meta dt {
  color: #74838a;
  font-size: 12px;
}

.task-detail-meta dd {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: #33464e;
  font-size: 12px;
}

.detail-overdue {
  color: #d13b46;
  font-weight: 720;
}

.task-detail-section {
  padding: 16px 18px;
  border-bottom: 1px solid #e3eae9;
}

.task-detail-section h4 {
  margin: 0 0 9px;
  color: #2d4048;
  font-size: 13px;
}

.task-detail-section p {
  color: #56686f;
  font-size: 12px;
  line-height: 1.7;
}

.task-detail-section > small,
.detail-muted,
.detail-more {
  display: block;
  margin-top: 7px;
  color: #829096;
  font-size: 11px;
}

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

.detail-section-head strong {
  color: #2d4048;
  font-size: 12px;
}

.detail-progress-track {
  height: 6px;
  margin: 4px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8efee;
}

.detail-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #12847b;
}

.detail-collaboration-list {
  border: 1px solid #e1e8e7;
  border-radius: 8px;
  overflow: hidden;
}

.detail-collaboration-row {
  display: grid;
  gap: 8px;
  min-height: 72px;
  padding: 11px;
  border-bottom: 1px solid #e8eeed;
}

.detail-collaboration-row:last-child {
  border-bottom: 0;
}

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

.detail-collaboration-row-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-collaboration-row-head > .tag {
  flex: 0 0 auto;
}

.detail-collaboration-row strong {
  color: #34464e;
  font-size: 12px;
}

.detail-collaboration-meta {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  flex-wrap: wrap;
}

.detail-collaboration-meta em {
  color: #7a898f;
  font-size: 10px;
  font-style: normal;
  line-height: 1.45;
}

.detail-collaboration-note {
  margin: 0;
  padding: 8px 9px;
  border-radius: 7px;
  background: #f5f9f8;
  color: #43565e;
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.detail-collaboration-note.empty {
  color: #8a989d;
}

.detail-collaboration-row .feedback-card-attachments {
  padding-top: 1px;
}

.detail-collaboration-row .feedback-card-attachments a,
.detail-collaboration-row .feedback-card-attachments span {
  max-width: 100%;
}

.task-detail-panel > .task-attachments {
  padding: 16px 18px;
  border-bottom: 1px solid #e3eae9;
}

.task-detail-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #dfe8e7;
  background: rgba(255, 255, 255, 0.96);
}

.task-detail-actions .status-select {
  flex: 0 1 104px;
}

.task-detail-actions .btn {
  flex: 1 1 108px;
  padding-inline: 10px;
}

.task-detail-actions .icon-btn {
  flex: 0 0 40px;
}

@media (max-width: 1280px) {
  .task-table-header,
  .task-table-row {
    grid-template-columns: 36px minmax(180px, 1fr) 90px 96px 76px 18px;
  }

  .task-table-header > :nth-child(3),
  .task-table-header > :nth-child(4),
  .task-table-row > :nth-child(3),
  .task-table-row > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 920px) {
  .board-list-detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-detail-panel {
    position: fixed;
    inset: 14px;
    z-index: 100;
    display: none;
    max-height: calc(100dvh - 28px);
    box-shadow: 0 24px 70px rgba(19, 37, 42, 0.28);
  }

  .task-detail-panel.is-open {
    display: block;
  }
}

@media (max-width: 820px) {
  .app-stage > .topbar h1 {
    font-size: 22px;
  }

  .workspace-list-detail .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-list-detail .metric:nth-child(2) {
    border-right: 0;
  }

  .workspace-list-detail .metric:nth-child(-n + 2) {
    border-bottom: 1px solid #e3eae9;
  }

  .board-filter-bar {
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.72fr);
  }

  .board-filter-bar .search-box {
    grid-column: 1 / -1;
  }

  .filter-indicator {
    display: none;
  }

  .task-table-header {
    display: none;
  }

  .task-table-row {
    grid-template-columns: 22px minmax(0, 1fr) auto 16px;
    min-height: 76px;
  }

  .task-table-row > :nth-child(3),
  .task-table-row > :nth-child(4),
  .task-table-row > :nth-child(5),
  .task-table-row > :nth-child(6) {
    display: none;
  }

  .task-row-status {
    grid-column: 3;
  }

  .task-row-arrow {
    grid-column: 4;
  }

  .task-list-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-detail-panel {
    inset: 72px 8px 8px;
    max-height: calc(100dvh - 80px);
  }
}

@media (max-width: 560px) {
  .app-stage > .topbar .topbar-actions {
    overflow: visible;
  }

  .topbar-account-popover {
    right: 0;
    width: min(240px, calc(100vw - 28px));
  }

  .account-identity small {
    max-width: 128px;
  }

  .personnel-permission-grid {
    grid-template-columns: 1fr;
  }

  .personnel-permission-grid > label {
    min-height: 60px;
  }

  .personnel-department-access {
    padding: 11px;
  }

  .personnel-access-columns {
    grid-template-columns: 1fr;
  }

  .personnel-department-grid {
    grid-template-columns: 1fr;
    max-height: 220px;
  }

  .workspace-list-detail .metric {
    justify-content: space-between;
    min-height: 58px;
    padding: 10px 12px;
  }

  .workspace-list-detail .metric .value {
    font-size: 24px;
  }

  .task-list-panel .board-status-tabs {
    padding-inline: 8px;
    scrollbar-width: none;
  }

  .task-list-panel .board-status-tabs::-webkit-scrollbar {
    display: none;
  }

  .task-list-panel .status-tab {
    min-width: 78px;
  }

  .board-filter-bar {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
  }

  .board-filter-bar .search-box {
    grid-column: 1;
  }

  .mobile-filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-filter-actions .btn {
    width: auto;
    min-height: 38px;
    padding: 8px 12px;
  }

  .mobile-filter-actions .btn:first-child {
    flex: 1 1 auto;
    justify-content: flex-start;
  }

  .mobile-filter-actions b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #138c82;
    color: #fff;
    font-size: 11px;
  }

  .board-filter-bar:not(.filters-expanded) .inline-department-picker,
  .board-filter-bar:not(.filters-expanded) .inline-filter-control {
    display: none;
  }

  .board-filter-bar.filters-expanded {
    grid-template-columns: minmax(0, 1fr) minmax(108px, 0.72fr);
  }

  .board-filter-bar.filters-expanded .search-box,
  .board-filter-bar.filters-expanded .mobile-filter-actions {
    grid-column: 1 / -1;
  }

  .board-filter-bar.filters-expanded .inline-department-picker,
  .board-filter-bar.filters-expanded .inline-filter-control {
    display: block;
    min-width: 0;
  }

  .list-board-head,
  .task-row-group-title,
  .task-table-row,
  .task-list-footer {
    padding-left: 10px;
    padding-right: 10px;
  }

  .task-detail-head,
  .task-detail-meta,
  .task-detail-section,
  .task-detail-panel > .task-attachments,
  .task-detail-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .task-row-title > span {
    display: none;
  }

  .task-row-mobile-meta {
    display: block;
    overflow: hidden;
    color: #78898f;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .task-detail-panel {
    inset: 0;
    z-index: 180;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: #fff;
  }

  .task-detail-head {
    position: sticky;
    top: 0;
    z-index: 3;
    padding-top: max(12px, env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.97);
  }

  .task-detail-actions {
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .task-detail-actions .status-select {
    width: 100%;
    min-height: 42px;
  }

  .task-detail-action-buttons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .task-detail-action-buttons::-webkit-scrollbar {
    display: none;
  }

  .task-detail-action-buttons .btn {
    flex: 0 0 auto;
    min-width: 104px;
  }

  .task-detail-action-buttons .icon-btn {
    flex: 0 0 42px;
  }
}

@media (max-width: 620px) {
  .task-dialog:is(
    .equipment-editor-dialog,
    .equipment-report-dialog,
    .equipment-progress-dialog,
    .materials-editor-dialog,
    .materials-import-dialog,
    .materials-stock-dialog,
    .materials-request-dialog,
    .materials-process-dialog,
    .safety-editor-dialog,
    .safety-rectification-dialog,
    .safety-review-dialog,
    .customer-feedback-editor-dialog,
    .customer-feedback-progress-dialog,
    .customer-feedback-close-dialog
  ) .dialog-actions {
    display: grid;
    min-height: 68px;
    grid-template-columns: minmax(92px, 0.72fr) minmax(148px, 1.28fr);
    gap: 10px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  .task-dialog:is(
    .equipment-editor-dialog,
    .equipment-report-dialog,
    .equipment-progress-dialog,
    .materials-editor-dialog,
    .materials-import-dialog,
    .materials-stock-dialog,
    .materials-request-dialog,
    .materials-process-dialog,
    .safety-editor-dialog,
    .safety-rectification-dialog,
    .safety-review-dialog,
    .customer-feedback-editor-dialog,
    .customer-feedback-progress-dialog,
    .customer-feedback-close-dialog
  ) .dialog-actions > .btn {
    width: 100%;
    min-width: 0;
  }
}

/* Mobile platform phase 2: compact task editing and searchable collaborators. */
#taskDialog {
  max-height: min(92dvh, 900px);
  overflow: hidden;
  padding: 0;
}

#taskForm {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(92dvh, 900px);
  padding: 0;
}

#taskForm > .dialog-head {
  margin: 0;
  padding: 18px 20px;
}

.task-dialog-scroll {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 20px;
  overscroll-behavior: contain;
}

#taskForm > .dialog-actions {
  margin: 0;
  padding: 12px 20px max(12px, env(safe-area-inset-bottom));
}

.collab-picker-summary,
.collab-picker-search {
  display: none;
}

.collab-picker-search svg {
  width: 18px;
  height: 18px;
}

.collab-option-wrap.search-hidden,
.collab-group.search-hidden {
  display: none;
}

@media (max-width: 620px) {
  html,
  body,
  .app-shell,
  .app-stage {
    max-width: 100%;
  }

  .app-stage {
    overflow-x: hidden;
  }

  #taskDialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  #taskForm {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
  }

  #taskForm > .dialog-head {
    padding: 12px 14px;
  }

  #taskForm > .dialog-head h2 {
    font-size: 20px;
  }

  .task-dialog-scroll {
    padding: 12px 12px 18px;
  }

  #taskForm .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #taskForm .field,
  #taskForm .field.wide,
  #taskForm input,
  #taskForm select,
  #taskForm textarea {
    min-width: 0;
    width: 100%;
  }

  .collab-picker-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft, #f5faf9);
  }

  .collab-picker-summary > div {
    min-width: 0;
  }

  .collab-picker-summary strong,
  .collab-picker-summary small {
    display: block;
  }

  .collab-picker-summary strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .collab-picker-summary small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
  }

  .collab-picker-summary .btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 8px 11px;
    font-size: 13px;
  }

  .collab-picker-search:not(.hidden) {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
  }

  .collab-picker-search input {
    min-height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
  }

  #taskCollaborators:not(.expanded) {
    display: none;
  }

  #taskCollaborators.expanded {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-height: 48dvh;
    margin-top: 10px;
    padding: 10px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    overscroll-behavior: contain;
  }

  #taskCollaborators .collab-group {
    min-width: 0;
  }

  #taskForm > .dialog-actions {
    display: flex;
    gap: 8px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  #taskForm > .dialog-actions .spacer {
    display: none;
  }

  #taskForm > .dialog-actions > .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding-inline: 10px;
  }

  #taskForm > .dialog-actions > #saveTaskBtn {
    flex-grow: 1.35;
  }
}
