:root {
  --dgc-blue: #3ba4dc;
  --dgc-blue-dark: #004a99;
  --dgc-blue-light: #e8f4fc;
  --bg: #f0f6fb;
  --surface: #ffffff;
  --text: #0f2a44;
  --muted: #5a7189;
  --primary: #3ba4dc;
  --primary-hover: #2a8fc4;
  --primary-dark: #004a99;
  --border: #6ba3c9;
  --success: #0d7a4a;
  --danger: #b42318;
  --warning: #b45309;
  --content-width: 1100px;
}

* { box-sizing: border-box; }

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

body.nav-open { overflow: hidden; }

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, var(--dgc-blue) 0%, #2a8fc4 100%);
  border-bottom: 3px solid var(--dgc-blue-dark);
  box-shadow: 0 2px 8px rgba(59, 164, 220, 0.25);
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 1.28rem;
  line-height: 1.2;
  color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  transition: background 0.15s ease;
}

.nav-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 68, 0.45);
  z-index: 998;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(280px, 85vw);
  height: 100vh;
  background: var(--surface);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--dgc-blue), #2a8fc4);
  color: #fff;
}

.nav-drawer-header .brand-logo {
  width: 32px;
  height: 32px;
}

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.nav-drawer-links a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav-drawer-links a:hover {
  background: var(--dgc-blue-light);
  border-left-color: var(--dgc-blue);
  color: var(--dgc-blue-dark);
}

/* ── Layout ── */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.5rem;
}

.container.narrow { max-width: 640px; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
  margin: 0 0 0.25rem;
  color: var(--dgc-blue-dark);
  font-size: 1.35rem;
}
.page-header a { color: var(--dgc-blue); }
.page-welcome {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.title-with-badge h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--dgc-blue-dark);
}

main.container > h1 {
  font-size: 1.35rem;
  color: var(--dgc-blue-dark);
  margin: 0 0 0.25rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1;
  vertical-align: middle;
}

.btn-nowrap {
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-icon-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  display: block;
}

.list-section {
  margin-bottom: 1rem;
}

.list-section > .list-toolbar {
  margin-bottom: 0.85rem;
  padding-bottom: 0;
  border-bottom: none;
}

.list-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem;
  overflow-x: auto;
}

.list-toolbar input[type="search"],
.list-toolbar .list-search {
  flex: 1 1 auto;
  min-width: 140px;
  width: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.list-filter-date {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.list-date-range {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.list-date-range input[type="date"] {
  width: 9.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.list-date-sep {
  color: var(--muted);
  font-weight: 600;
  padding: 0 0.1rem;
}

.date-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.date-preset {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
  min-width: 9.5rem;
  width: auto;
}

.list-date-custom {
  display: none;
  align-items: center;
  gap: 0.35rem;
}

.list-date-custom:not([hidden]) {
  display: inline-flex;
}

.list-date-custom input[type="date"] {
  width: 9.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.list-footer-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.list-page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}

.list-page-size {
  width: auto;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.list-page-info {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
}

.list-footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-footer-right[hidden] {
  display: none;
}

.list-filter-date span {
  flex-shrink: 0;
}

.list-filter-date input {
  width: 9.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.list-result-count {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  margin-left: auto;
}

tr[hidden] { display: none; }

.subtitle { color: var(--muted); margin: 0; }

.container.narrow-wide { max-width: 760px; }

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  margin: 0;
}

.checkbox-inline input { width: auto; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

/* ── Dashboard cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.dashboard-stats-grid .stat-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-card {
  border-radius: 10px;
  padding: 1.1rem 1rem;
  border: 2px solid var(--border);
  min-height: 96px;
  background: var(--surface);
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 74, 153, 0.14);
}

.stat-card-static {
  opacity: 0.72;
  cursor: default;
}

.stat-card-all {
  background: linear-gradient(145deg, #e8f4fc, #d4ebf9);
  border-color: #9ccae8;
}
.stat-card-all .stat-value { color: var(--dgc-blue-dark); }

.stat-card-waiting-others {
  background: linear-gradient(145deg, #fff8eb, #ffefd0);
  border-color: #f0c674;
}
.stat-card-waiting-others .stat-value { color: #9a6700; }

.stat-card-waiting-you {
  background: linear-gradient(145deg, #e6f7ff, #cceeff);
  border-color: var(--dgc-blue);
}
.stat-card-waiting-you .stat-value { color: var(--dgc-blue-dark); }

.stat-card-completed {
  background: linear-gradient(145deg, #ecfdf5, #d1fae5);
  border-color: #6ee7b7;
}
.stat-card-completed .stat-value { color: #047857; }

.stat-card-rejected {
  background: linear-gradient(145deg, #fef2f2, #fee2e2);
  border-color: #fca5a5;
}
.stat-card-rejected .stat-value { color: #b42318; }

.stat-card-active {
  background-color: #dbeafe !important;
  border-color: #3b82f6 !important;
}
.stat-card-active .stat-value { color: #1d4ed8; }
.stat-card-active .stat-label { color: #1e3a8a; }

.stat-card-on-track {
  background-color: #d1fae5 !important;
  border-color: #10b981 !important;
}
.stat-card-on-track .stat-value { color: #047857; }
.stat-card-on-track .stat-label { color: #065f46; }

.stat-card-delayed {
  background-color: #ffedd5 !important;
  border-color: #f97316 !important;
}
.stat-card-delayed .stat-value { color: #c2410c; }
.stat-card-delayed .stat-label { color: #9a3412; }

.stat-card-on-hold {
  background-color: #e2e8f0 !important;
  border-color: #64748b !important;
}
.stat-card-on-hold .stat-value { color: #475569; }
.stat-card-on-hold .stat-label { color: #334155; }

.stat-card-my-tasks {
  background-color: #ede9fe !important;
  border-color: #8b5cf6 !important;
}
.stat-card-my-tasks .stat-value { color: #6d28d9; }
.stat-card-my-tasks .stat-label { color: #5b21b6; }

.stat-card-overdue {
  background-color: #ffe4e6 !important;
  border-color: #f43f5e !important;
}
.stat-card-overdue .stat-value { color: #be123c; }
.stat-card-overdue .stat-label { color: #9f1239; }

.dashboard-stats-grid .stat-card-link:hover {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 0.25rem;
}

.admin-menu-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-card-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.admin-card-title {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dgc-blue-dark);
  line-height: 1.25;
}

.admin-card-desc {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.4;
}

.stat-card-admin-workflows {
  background: linear-gradient(145deg, #ecfdf5, #d1fae5);
  border-color: #6ee7b7;
}

.stat-card-admin-staff {
  background: linear-gradient(145deg, #ede9fe, #ddd6fe);
  border-color: #a78bfa;
}

.stat-card-admin-fields {
  background: linear-gradient(145deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
}

.stat-card-admin-roles {
  background: linear-gradient(145deg, #fdf2f8, #fce7f3);
  border-color: #f9a8d4;
}

.stat-card-admin-hours {
  background: linear-gradient(145deg, #e8f4fc, #d4ebf9);
  border-color: #9ccae8;
}

.admin-card-icon {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  fill: currentColor;
  color: var(--dgc-blue-dark);
  opacity: 0.85;
}

.stat-card-admin-workflows .admin-card-icon { color: #047857; }
.stat-card-admin-staff .admin-card-icon { color: #6d28d9; }
.stat-card-admin-fields .admin-card-icon { color: #c2410c; }
.stat-card-admin-roles .admin-card-icon { color: #be185d; }
.stat-card-admin-hours .admin-card-icon { color: var(--dgc-blue-dark); }

.staff-leader-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.staff-leader-form select {
  width: auto;
  min-width: 12rem;
  flex: 1 1 12rem;
}

.stat-sub {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.panel, .form-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(59, 164, 220, 0.1);
}

.panel-tasks {
  background: #f5f3ff;
  border: 2px solid #818cf8;
}

.panel-projects {
  background: #eff6ff;
  border: 2px solid #3b82f6;
}

.panel-workload {
  background: #ecfdf5;
  border: 2px solid #10b981;
}

.panel-tasks .panel-head h2 { color: #4338ca; }
.panel-projects .panel-head h2 { color: #1d4ed8; }
.panel-workload .panel-head h2 { color: #047857; }

.panel-tasks .panel-link { color: #4338ca; }
.panel-projects .panel-link { color: #2563eb; }
.panel-workload .panel-link { color: #047857; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: nowrap;
  width: 100%;
}

.panel-head h1,
.panel-head h2 {
  margin: 0;
  color: var(--dgc-blue-dark);
  font-size: 1.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.panel h2 {
  font-size: 1.1rem;
}

.panel-head.page-head { margin-bottom: 1.5rem; }

.panel-head .hint {
  margin: 0;
  flex: 1 1 auto;
}

.panel-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dgc-blue);
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

.panel-link:hover { text-decoration: underline; }

.panel h2, .panel h3 {
  margin-top: 0;
  color: var(--dgc-blue-dark);
}

.panel h3 { margin-top: 1.25rem; }

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

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--dgc-blue-dark);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.sortable-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  padding-right: 1.25rem;
  position: relative;
}

.sortable-table th[data-sort]::after {
  content: "↕";
  position: absolute;
  right: 0.25rem;
  opacity: 0.35;
  font-size: 0.75rem;
}

.sortable-table th.sort-asc::after { content: "↑"; opacity: 1; color: var(--dgc-blue); }
.sortable-table th.sort-desc::after { content: "↓"; opacity: 1; color: var(--dgc-blue); }

.compact-table td { vertical-align: top; }
.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
  line-height: 1.3;
}
.col-action { text-align: right; white-space: nowrap; width: 1%; }

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.table-actions form {
  display: inline-flex;
  margin: 0;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: none;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}

.icon-btn-edit {
  background: #e8f4fc;
  color: var(--dgc-blue-dark);
  border-color: #9ccae8;
}

.icon-btn-edit:hover {
  background: #d4ebf9;
}

.icon-btn-duplicate {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.icon-btn-duplicate:hover {
  background: #d1fae5;
}

.icon-btn-delete {
  background: var(--danger);
  color: #fff;
  border-color: #912018;
}

.icon-btn-delete:hover {
  background: #912018;
}

.table-input {
  width: 100%;
  min-width: 0;
}

.master-table td {
  vertical-align: top;
}

.field-type-cell .field-options-wrap {
  margin-top: 0.5rem;
}

.field-type-cell .field-options-wrap textarea {
  width: 100%;
  min-width: 10rem;
}

/* Active / Inactive toggle */
.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.status-toggle input[type="checkbox"],
.status-toggle input[type="hidden"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.status-toggle-track {
  position: relative;
  width: 2.5rem;
  height: 1.35rem;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.status-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.status-toggle input[type="checkbox"]:checked + .status-toggle-track {
  background: #059669;
}

.status-toggle input[type="checkbox"]:checked + .status-toggle-track::after {
  transform: translateX(1.1rem);
}

.status-toggle-label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.status-toggle-label-on { color: #047857; }
.status-toggle-label-off { color: #64748b; }

.status-toggle input[type="checkbox"]:checked ~ .status-toggle-label-off {
  display: none;
}

.status-toggle input[type="checkbox"]:not(:checked) ~ .status-toggle-label-on {
  display: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: #912018;
}

.btn-danger:hover {
  background: #912018;
  border-color: #7a1a14;
  color: #fff;
}
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--dgc-blue-light); }
.clickable-row .row-link {
  color: var(--dgc-blue-dark);
  font-weight: 600;
  text-decoration: none;
}
.clickable-row:hover .row-link { text-decoration: underline; }

.workflow-step-row {
  cursor: grab;
}

.workflow-step-row.dragging {
  opacity: 0.55;
}

.workflow-settings-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.workflow-settings-row input[type="text"] {
  flex: 1 1 18rem;
  min-width: 12rem;
  margin: 0;
}

.workflow-steps-table input[type="text"],
.workflow-steps-table select {
  width: 100%;
  min-width: 0;
}

.workflow-steps-table .step-sla-input {
  width: 4.5rem;
  min-width: 4.5rem;
}

.workflow-steps-table .step-doc-cell {
  text-align: center;
  white-space: nowrap;
}

.checkbox-compact {
  font-size: 0.8125rem;
}

.step-move-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.icon-btn-move {
  background: #f1f5f9;
  color: var(--text);
  border-color: #cbd5e1;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}

.icon-btn-move:hover {
  background: #e2e8f0;
}

.workflow-step-row .icon-btn-delete {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.staff-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.staff-edit-form select {
  min-width: 10rem;
  flex: 1 1 10rem;
}

.staff-role-checkboxes {
  flex: 1 1 100%;
  margin-bottom: 0.25rem;
}

.staff-save-status {
  display: block;
  margin-top: 0.15rem;
}

.staff-save-status.is-saving {
  color: var(--muted);
}

.staff-save-status.is-saved {
  color: var(--success);
}

.staff-save-status.is-error {
  color: var(--danger);
}

.staff-table .staff-leader-select {
  min-width: 10rem;
  width: 100%;
}

.panel-staff .staff-edit-form {
  margin: 0;
}

.panel-staff .multi-select {
  min-width: 14rem;
  max-width: 22rem;
  width: 100%;
}

.panel-staff .multi-select-trigger {
  padding: 0.45rem 0.65rem;
  font: inherit;
  border-radius: 8px;
  min-height: 2.25rem;
}

.multi-select {
  position: relative;
  min-width: 10rem;
  max-width: 14rem;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  padding: 0.10rem 0.20rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  line-height: 1.2;
  cursor: pointer;
  text-align: left;
}

.multi-select-trigger::after {
  content: "▾";
  color: var(--muted);
  flex-shrink: 0;
}

.multi-select-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.2rem);
  left: 0;
  min-width: 100%;
  max-height: 11rem;
  overflow-y: auto;
  padding: 0.10rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 42, 68, 0.12);
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.multi-select-option:hover {
  background: var(--dgc-blue-light);
}

.multi-select-option input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.master-field-edit-form,
.master-field-create {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-options-wrap textarea {
  width: 100%;
  min-height: 4rem;
}

.hidden { display: none !important; }

.inline-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-form-row input[type="text"] {
  min-width: 10rem;
  flex: 1 1 10rem;
}

.draggable-row { cursor: grab; }
.draggable-row.dragging { opacity: 0.55; }
.drag-handle {
  width: 2rem;
  text-align: center;
  color: var(--muted);
  user-select: none;
}

.row-link { font-weight: 600; }
a { color: var(--dgc-blue-dark); }

.detail-list { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem 1rem; }
.detail-list dt { color: var(--muted); font-weight: 600; }
.detail-list dd { margin: 0; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: capitalize;
}
.badge-draft { background: #e2e8f0; color: #475569; }
.badge-submitted { background: #dbeafe; color: #1d4ed8; }
.badge-in_approval { background: #fef3c7; color: #b45309; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-pending_documents { background: #ede9fe; color: #6d28d9; }
.badge-completed, .badge-registered { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee4e2; color: #b42318; }
.badge-returned { background: #fef3c7; color: #b45309; }
.badge-task-pending { background: #fef3c7; color: #b45309; }
.badge-task-approved { background: #d1fae5; color: #047857; }
.badge-task-rejected { background: #fee4e2; color: #b42318; }
.badge-task-skipped { background: #e2e8f0; color: #64748b; }
.badge-task-returned { background: #fef3c7; color: #b45309; }

.attachment-list { list-style: none; padding: 0; margin: 0; }
.attachment-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.attachment-list small { display: block; color: var(--muted); }
input[type="file"] { padding: 0.35rem 0; border: none; }

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: background 0.15s ease;
}

.btn.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1;
  white-space: nowrap;
}

.btn.btn-icon .btn-icon-svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
  display: block;
}

.btn-primary {
  background: var(--dgc-blue);
  color: #fff;
  border-color: #2a8fc4;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: wait;
}

form.is-submitting { opacity: 0.85; }

.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }

label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; color: var(--dgc-blue-dark); }

label .required,
legend .required,
h3 .required {
  margin-left: 0.2rem;
}

.required { color: #c0392b; font-weight: 700; }

.form-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
  margin-top: 0.75rem;
}

.form-fieldset legend {
  padding: 0 0.35rem;
  font-weight: 600;
  color: var(--dgc-blue-dark);
}

.form-fieldset .checkbox-inline {
  display: block;
  margin-top: 0.5rem;
  font-weight: 400;
}

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--dgc-blue);
  box-shadow: 0 0 0 3px rgba(59, 164, 220, 0.2);
}

.list-toolbar input[type="search"],
.list-toolbar input[type="date"],
.list-toolbar select,
.date-preset {
  width: auto;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--dgc-blue-light) 0%, var(--bg) 50%, #dceef9 100%);
}

.auth-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 74, 153, 0.12);
  text-align: center;
}

.login-logo {
  display: block;
  width: 100px;
  height: 100px;
  margin: 0 auto 1rem;
  object-fit: contain;
}

.auth-card h1 {
  margin-top: 0;
  font-size: 1.35rem;
  color: var(--dgc-blue-dark);
}

.hint { font-size: 0.8125rem; color: var(--muted); margin-top: 1rem; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; background: #eef2f7; margin: 1rem 0; }
.alert-error { background: #fee4e2; color: var(--danger); }
.alert-warn { background: #fff4e5; color: #9a6700; }
.code-block { padding: 0.75rem 1rem; background: #f6f8fa; border-radius: 8px; overflow-x: auto; font-size: 0.9rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 0.35rem 0; }
.empty { color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item {
  padding: 0.75rem;
  border-left: 4px solid var(--border);
  margin-bottom: 0.5rem;
  border-radius: 0 8px 8px 0;
}
.timeline-pending { border-color: #f59e0b; background: #fffbeb; }
.timeline-approved { border-color: #10b981; background: #ecfdf5; }
.timeline-rejected { border-color: #ef4444; background: #fef2f2; }
.timeline-skipped { border-color: #94a3b8; background: #f8fafc; }
.timeline-item p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.875rem; }

.sla-on_track { color: var(--success); }
.sla-overdue { color: var(--danger); font-weight: 600; }
.sla-not_started, .sla-closed { color: var(--muted); }

.workflow-table { margin-bottom: 1.5rem; }
.workflow-row.workflow-pending { background: #fffbeb; border-left: 4px solid #f59e0b; }
.workflow-row.workflow-in_progress { background: #eff6ff; border-left: 4px solid #3b82f6; }
.workflow-row.workflow-completed { background: #ecfdf5; border-left: 4px solid #10b981; }
.workflow-row.workflow-upcoming { background: #f8fafc; border-left: 4px solid #cbd5e1; }
.workflow-row.workflow-rejected { background: #fef2f2; border-left: 4px solid #ef4444; }
.workflow-row.workflow-returned { background: #fffbeb; border-left: 4px solid #f59e0b; }
.workflow-row.workflow-skipped { background: #f1f5f9; border-left: 4px solid #94a3b8; }
.workflow-row.workflow-current {
  background: #e6f7ff;
  box-shadow: inset 0 0 0 2px var(--dgc-blue);
}
.current-marker {
  color: var(--dgc-blue);
  font-size: 0.75rem;
  font-weight: 600;
}
.history-table { margin-top: 0.5rem; }
.badge-step-pending { background: #fef3c7; color: #b45309; }
.badge-step-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge-step-completed { background: #d1fae5; color: #047857; }
.badge-step-upcoming { background: #e2e8f0; color: #475569; }
.badge-step-rejected { background: #fee4e2; color: #b42318; }
.badge-step-returned { background: #fef3c7; color: #b45309; }
.badge-step-skipped { background: #e2e8f0; color: #64748b; }
.badge-task-submitted { background: #dbeafe; color: #1d4ed8; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  table { font-size: 0.8125rem; }

  .header-inner {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    min-height: 56px;
  }

  .nav-toggle {
    display: flex;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
  }

  .brand {
    flex: none;
    flex-direction: row;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: calc(100% - 96px);
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-text { align-items: center; }

  .brand-title { font-size: 1.05rem; }

  .nav-links { display: none; }

  .btn-icon {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
  }

  .list-toolbar {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .list-toolbar .list-search {
    min-width: 0;
    flex: 1 1 0;
    padding: 0.45rem 0.5rem;
  }

  .date-filter-wrap {
    flex: 0 0 auto;
    min-width: 0;
  }

  .date-preset {
    min-width: 7.25rem;
    max-width: 8.5rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.8125rem;
  }

  .list-date-custom input[type="date"] {
    width: 7.5rem;
    padding: 0.4rem 0.35rem;
    font-size: 0.8125rem;
  }

  .panel-head.page-head {
    flex-wrap: nowrap;
  }

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

  .stat-value { font-size: 1.6rem; }

  .panel-head h2 { font-size: 1rem; }
}

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