:root {
  --ink: #171717;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --canvas: #f4f5f7;
  --brand-dark: #241a17;
  --brand-primary: #2563eb;
  --brand-primary-strong: #1d4ed8;
  --brand-soft: #dbeafe;
  --brand-red: #ef4444;
  --brand-cocoa: #9f7a6c;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --violet: #8b5cf6;
  --violet-soft: #ede9fe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --mint: #ecfdf5;
  --focus: rgba(37, 99, 235, 0.18);
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
  --shadow-sm: 0 6px 18px rgba(17, 24, 39, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --control-height: 42px;
  --control-height-sm: 34px;
  --control-pad-x: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

[aria-busy="true"] {
  cursor: progress;
}

.panel[aria-busy="true"],
form[aria-busy="true"] {
  opacity: 0.86;
}

button.is-busy {
  gap: 8px;
}

button.is-busy svg {
  display: none;
}

button.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 16px;
  color: #fbf5f0;
  background: #261c19;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(159, 122, 108, 0.12)),
    #fff url("assets/brandname-logo.png") center 39% / 390% auto no-repeat;
  box-shadow: inset 0 -3px 0 rgba(37, 99, 235, 0.15);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #e8d7cf;
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  color: #e5d2ca;
  background: transparent;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.22);
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #eadbd4;
  font-size: 13px;
}

.logout-button {
  margin-left: auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #eadbd4;
  background: transparent;
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #d8b3a2;
  box-shadow: 0 0 0 4px rgba(216, 179, 162, 0.18);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.system-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  margin: -6px 0 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.system-status-main,
.system-status-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.system-status-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-status-meta {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-refresh {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-success {
  color: #166534;
  background: var(--green-soft);
  border-color: #bbf7d0;
}

.status-loading,
.status-saving {
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  border-color: #bfdbfe;
}

.status-warning {
  color: #92400e;
  background: var(--amber-soft);
  border-color: #fde68a;
}

.status-error {
  color: #991b1b;
  background: var(--red-soft);
  border-color: #fecaca;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: var(--brand-primary-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 13px;
  white-space: nowrap;
}

.soft-badge {
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  border-color: #bfdbfe;
  font-weight: 700;
}

.soft-badge.amber {
  color: #92400e;
  background: var(--amber-soft);
  border-color: #fde68a;
}

.soft-badge.ok {
  color: #166534;
  background: var(--green-soft);
  border-color: #bbf7d0;
}

.icon-button {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.submit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.employee-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.submit-grid > *,
.dashboard-layout > *,
.employee-layout > *,
.settings-grid > * {
  min-width: 0;
}

.form-panel,
.preview-panel,
.chart-panel,
.donut-panel,
.trend-panel,
.issue-panel,
.missing-panel,
.table-panel,
.employee-form-panel,
.employee-table-panel,
.settings-grid .panel {
  padding: 18px;
}

.form-panel,
.preview-panel,
.employee-form-panel,
.employee-table-panel,
.table-panel {
  position: relative;
  overflow: hidden;
}

.form-panel::before,
.employee-form-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary), #38bdf8);
}

.preview-panel::before,
.employee-table-panel::before,
.table-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary), #93c5fd);
}

.panel-header,
.section-line,
.form-footer,
.button-row,
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.panel-header {
  margin-bottom: 16px;
  align-items: flex-start;
}

.panel-header h2 {
  line-height: 1.35;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.field-grid.one-col {
  grid-template-columns: 1fr;
  margin-top: 16px;
}

.employee-lookup-grid {
  align-items: end;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.lookup-row .secondary-button {
  min-width: 112px;
}

.custom-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  margin-top: 8px;
}

.custom-option-row input {
  min-height: 38px;
}

.icon-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand-primary-strong);
  background: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.icon-action-button:hover {
  border-color: #bfdbfe;
  background: var(--blue-soft);
}

.lookup-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.lookup-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
}

.lookup-status.ok {
  color: #15803d;
}

.lookup-status.ok::before {
  background: var(--green);
}

.lookup-status.warn {
  color: var(--amber);
}

.lookup-status.warn::before {
  background: var(--amber);
}

.employee-profile-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: linear-gradient(180deg, #f0fdf4, #fff);
}

.employee-profile-card > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(34, 197, 94, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.employee-profile-card .profile-identity {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-profile-card span,
.employee-profile-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.employee-profile-card strong {
  display: block;
  margin: 2px 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.previous-template-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.previous-template-card.is-found,
.previous-template-card.is-applied {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #eff6ff, #fff);
}

.previous-template-card.is-loading {
  border-color: #dbeafe;
  background: #f8fafc;
}

.previous-template-card.is-empty {
  border-color: #e5e7eb;
  background: #fff;
}

.template-card-main {
  min-width: 0;
}

.previous-template-card span {
  display: block;
  color: var(--brand-primary-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.previous-template-card strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.previous-template-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

label,
.full-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-alert {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  background: #fff7f7;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.form-alert[hidden] {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  overflow-wrap: anywhere;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
select {
  height: var(--control-height);
  padding: 0 var(--control-pad-x);
}

select {
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"] {
  padding-left: 38px;
  background-image:
    radial-gradient(circle at 14px 16px, transparent 5px, var(--muted) 5px, var(--muted) 6px, transparent 6px),
    linear-gradient(45deg, transparent 0 54%, var(--muted) 54% 64%, transparent 64%);
  background-position: 0 0, 20px 24px;
  background-size: 28px 28px, 12px 12px;
  background-repeat: no-repeat;
}

textarea {
  min-height: 104px;
  max-height: 220px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.date-input-shell:has(input[aria-invalid="true"]) .date-display,
.date-picker-shell:has(input[aria-invalid="true"]) {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

input[readonly] {
  background: #f7fafc;
}

input:hover,
select:hover,
textarea:hover,
.date-display:hover {
  border-color: #9ca3af;
}

.date-input-shell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.date-input-shell input[type="date"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: var(--control-height);
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.date-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: var(--control-height);
  padding: 0 var(--control-pad-x);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

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

.date-input-shell:focus-within .date-display {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus);
}

.form-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.text-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.text-button {
  min-height: var(--control-height-sm);
  border: 0;
  color: var(--brand-primary-strong);
  background: transparent;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.quiet-button {
  color: var(--muted);
}

.primary-button {
  border: 1px solid var(--brand-primary);
  color: #fff;
  background: var(--brand-primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.text-button:hover {
  color: #1e40af;
  background: var(--blue-soft);
}

.secondary-button:hover,
.inline-button:hover,
.secondary-link:hover {
  border-color: #cbd5e1;
  background: var(--surface-subtle);
}

.secondary-button:active,
.primary-button:active,
.inline-button:active,
.date-preset-button:active,
.range-button:active {
  transform: translateY(1px);
}

.primary-button:hover {
  border-color: var(--brand-primary-strong);
  background: var(--brand-primary-strong);
}

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

.task-row {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.task-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand-primary);
}

.task-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  font-weight: 900;
}

.task-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 0.95fr);
  gap: 10px;
}

.textarea-counter {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.textarea-counter.near-limit {
  color: #92400e;
}

.remove-task {
  display: grid;
  place-items: center;
  width: 38px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.remove-task:hover {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff7f7;
}

.support-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.support-toggle input {
  width: 18px;
  height: 18px;
}

.form-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.preview-panel {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.report-preview {
  max-height: min(52vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  font-weight: 900;
}

.preview-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.preview-meta div {
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.preview-meta div:nth-child(even) {
  border-right: 0;
}

.preview-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.preview-table th {
  padding: 9px;
  border: 1px solid #bfdbfe;
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  text-align: center;
}

.preview-table td {
  min-height: 44px;
  padding: 9px;
  border: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1440px) {
  .preview-table,
  .preview-table thead,
  .preview-table tbody,
  .preview-table tr,
  .preview-table th,
  .preview-table td {
    display: block;
  }

  .preview-table thead {
    display: none;
  }

  .preview-table tr {
    border-bottom: 1px solid var(--line);
  }

  .preview-table tr:last-child {
    border-bottom: 0;
  }

  .preview-table td {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    min-height: auto;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-table td:last-child {
    border-bottom: 0;
  }

  .preview-table td::before {
    content: attr(data-label);
    color: var(--brand-primary-strong);
    font-weight: 900;
  }
}

.mini-feed {
  margin-top: 18px;
}

.today-feed {
  max-height: 320px;
  overflow: auto;
}

.mini-feed .section-line {
  flex-direction: row;
  align-items: center;
  margin-bottom: 12px;
}

.mini-feed .section-line .soft-badge {
  width: auto;
  min-width: 58px;
  align-self: center;
}

.today-feed,
.issue-list,
.missing-list {
  display: grid;
  gap: 10px;
}

.missing-list {
  max-height: min(56vh, 620px);
  overflow: auto;
  padding-right: 2px;
}

.feed-item,
.issue-card,
.missing-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  overflow-wrap: anywhere;
}

.feed-item strong,
.issue-card strong,
.missing-item strong {
  font-size: 14px;
}

.feed-item span,
.issue-card span,
.missing-item span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.dashboard-toolbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.dashboard-filter-group {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(180px, 240px);
  align-items: end;
  gap: 12px;
}

.dashboard-filter-group label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-filter-group label span,
.filter-row + *,
label > span,
.full-label > span {
  min-width: 0;
}

.dashboard-filter-group .compact-select,
.dashboard-filter-group .compact-date,
.dashboard-filter-group .date-picker-shell,
.dashboard-filter-group #dashboard-group {
  max-width: none;
  width: 100%;
}

.dashboard-date-control {
  display: grid;
  grid-template-columns: auto auto minmax(130px, 1fr);
  gap: 6px;
}

.date-picker-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--control-height);
  padding: 0 38px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  overflow: hidden;
}

.date-picker-shell::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: currentColor;
  opacity: 0.78;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.date-picker-shell span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-picker-shell input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.date-preset-button {
  min-height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.date-preset-button.active {
  border-color: var(--brand-primary);
  color: #fff;
  background: var(--brand-primary);
}

.date-preset-button:hover {
  border-color: #bfdbfe;
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
}

.dashboard-toolbar .segmented-control,
.dashboard-toolbar .compact-action {
  align-self: end;
}

.dashboard-toolbar .segmented-control {
  justify-self: center;
}

.dashboard-toolbar .compact-action {
  justify-self: end;
  white-space: nowrap;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.range-button {
  min-height: var(--control-height-sm);
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.range-button.active {
  color: #fff;
  background: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}

.kpi-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

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

.insight-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 88px;
  padding: 14px 14px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.insight-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #cbd5e1;
}

.insight-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.insight-card small {
  color: var(--muted);
  line-height: 1.4;
}

.insight-ok::before {
  background: var(--green);
}

.insight-warn::before,
.insight-missing::before {
  background: var(--amber);
}

.insight-issue::before {
  background: var(--red);
}

.insight-support::before {
  background: var(--violet);
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #2563eb;
}

.kpi-card:nth-child(2)::before {
  background: #f59e0b;
}

.kpi-card:nth-child(3)::before {
  background: #ef4444;
}

.kpi-card:nth-child(4)::before {
  background: #8b5cf6;
}

.kpi-card:nth-child(5)::before {
  background: #22c55e;
}

.kpi-card-submitted::before {
  background: var(--blue);
}

.kpi-card-missing::before {
  background: var(--amber);
}

.kpi-card-issue::before {
  background: var(--red);
}

.kpi-card-support::before {
  background: var(--violet);
}

.kpi-card-date::before {
  background: var(--green);
}

.kpi-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.kpi-card em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.kpi-card-missing em {
  color: #92400e;
  background: var(--amber-soft);
}

.kpi-card-issue em {
  color: #991b1b;
  background: var(--red-soft);
}

.kpi-card-support em {
  color: #5b21b6;
  background: var(--violet-soft);
}

.kpi-card-date em {
  color: #166534;
  background: var(--green-soft);
}

.chart-panel,
.trend-panel {
  grid-column: 1;
}

.donut-panel,
.issue-panel,
.missing-panel {
  grid-column: 2;
}

.chart-panel canvas,
.trend-panel canvas,
.donut-panel canvas,
.issue-panel canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.issue-panel canvas {
  margin-bottom: 12px;
}

.compact-select {
  max-width: 180px;
}

.compact-date {
  min-height: var(--control-height);
  padding: 0 var(--control-pad-x);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
}

#dashboard-group {
  max-width: 260px;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  display: none;
  gap: 4px;
  min-width: 156px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.chart-tooltip.show {
  display: grid;
}

.chart-tooltip strong {
  font-size: 13px;
}

.chart-tooltip span {
  color: var(--muted);
  font-size: 12px;
}

.issue-card.issue {
  border-color: #fecaca;
  background: var(--red-soft);
}

.issue-card.support {
  border-color: #fde68a;
  background: var(--amber-soft);
}

.missing-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.missing-item > span:not(.status-chip) {
  grid-column: 1 / -1;
}

.missing-item .status-chip {
  align-self: start;
  white-space: nowrap;
}

.table-tools {
  align-items: end;
}

.filter-row {
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.filter-row input {
  min-width: 260px;
  flex: 1 1 260px;
}

.filter-row select {
  min-width: 180px;
  flex: 0 1 220px;
}

.compact-action {
  min-height: var(--control-height);
  padding: 10px 14px;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.table-wrap:has(.empty-row) {
  background: linear-gradient(180deg, #fff, var(--surface-subtle));
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

.report-history-table {
  min-width: 1360px;
  table-layout: fixed;
}

.report-history-table th:nth-child(1),
.report-history-table td:nth-child(1) {
  width: 74px;
}

.report-history-table th:nth-child(2),
.report-history-table td:nth-child(2) {
  width: 116px;
}

.report-history-table th:nth-child(3),
.report-history-table td:nth-child(3) {
  width: 86px;
}

.report-history-table th:nth-child(4),
.report-history-table td:nth-child(4) {
  width: 116px;
}

.report-history-table th:nth-child(5),
.report-history-table td:nth-child(5),
.report-history-table th:nth-child(6),
.report-history-table td:nth-child(6),
.report-history-table th:nth-child(7),
.report-history-table td:nth-child(7) {
  width: 260px;
}

.report-history-table th:nth-child(8),
.report-history-table td:nth-child(8) {
  width: 96px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: #241a17;
  font-weight: 900;
  white-space: nowrap;
}

td {
  line-height: 1.45;
}

tbody tr:hover td {
  background: #f8fafc;
}

.report-detail-cell {
  padding: 10px 12px;
}

.empty-row {
  position: sticky;
  left: 0;
  height: 104px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-weight: 800;
  text-align: left;
}

.empty-cell-content {
  display: grid;
  gap: 4px;
  max-width: 460px;
}

.empty-cell-content strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-cell-content span {
  color: var(--muted);
  font-weight: 700;
}

.report-text,
.report-item-list {
  max-height: 168px;
  overflow: auto;
  padding-right: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}

.report-item-list {
  display: grid;
  gap: 8px;
}

.report-item-line {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
}

.report-item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  color: var(--brand-primary-strong);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.report-item-text,
.report-empty-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-empty-value {
  color: var(--muted);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-chip.ok {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
}

.status-chip.warn {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.status-chip.issue {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

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

.summary-pill {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  box-shadow: var(--shadow-sm);
}

.summary-pill::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand-primary);
}

.summary-pill.summary-pill-inactive::before {
  background: var(--red);
}

.summary-pill.summary-pill-branch::before {
  background: var(--amber);
}

.summary-pill.summary-pill-support::before {
  background: var(--violet);
}

.summary-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-pill strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.summary-pill small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-pill.wide strong {
  font-size: 14px;
  line-height: 1.45;
}

.employee-actions {
  margin-top: 16px;
}

.danger-button {
  color: #991b1b;
  border-color: #f3c7c7;
  background: #fff7f7;
  box-shadow: none;
}

.danger-button:hover {
  background: #fee2e2;
}

.inline-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand-primary-strong);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.inline-button:hover {
  border-color: #bfdbfe;
  background: var(--blue-soft);
}

.employee-table {
  min-width: 920px;
}

.followup-layout {
  display: grid;
  gap: 14px;
}

.leave-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.leave-form-panel,
.leave-list-panel {
  min-width: 0;
}

.followup-panel,
.leave-form-panel,
.leave-list-panel {
  padding: 18px;
}

.leave-form-panel .field-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.followup-layout .employee-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0;
}

.followup-panel {
  display: grid;
  gap: 14px;
}

.followup-panel .panel-header,
.leave-list-panel .panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 12px 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.followup-panel .panel-header > div:first-child,
.leave-list-panel .panel-header > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.followup-panel .filter-row,
.leave-list-panel .filter-row {
  display: grid;
  flex: 1 1 520px;
  grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(140px, 0.65fr));
  align-items: center;
  justify-content: end;
  max-width: 760px;
  min-width: min(100%, 520px);
}

.followup-panel .filter-row input,
.followup-panel .filter-row select,
.leave-list-panel .filter-row input,
.leave-list-panel .filter-row select {
  width: 100%;
  min-width: 0;
}

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

.followup-card,
.empty-followup {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.followup-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--red);
}

.followup-in-progress::before {
  background: var(--amber);
}

.followup-done::before {
  background: var(--green);
}

.followup-cancelled::before {
  background: var(--muted);
}

.followup-card-main {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding-left: 4px;
}

.followup-card-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.followup-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.followup-person,
.followup-issue {
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.followup-person {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.followup-issue {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  white-space: pre-wrap;
}

.followup-status-chip {
  background: var(--blue-soft);
  color: var(--brand-primary-strong);
}

.followup-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.followup-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.followup-note-field,
.followup-save-button {
  grid-column: 1 / -1;
}

.followup-save-button {
  justify-self: end;
  min-width: 126px;
}

.empty-followup {
  grid-template-columns: 1fr;
  color: var(--muted);
  background: var(--surface-subtle);
}

.empty-followup strong {
  color: var(--ink);
}

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

.leave-list-panel .employee-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leave-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.leave-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}

.leave-pending::before {
  background: var(--amber);
}

.leave-cancelled::before {
  background: var(--red);
}

.leave-card h3 {
  margin: 8px 0 4px;
  font-size: 17px;
  line-height: 1.25;
}

.leave-note {
  margin: 10px 0 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-subtle);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@media (min-width: 1600px) {
  .followup-card {
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  }
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
}

.full-label {
  margin-bottom: 16px;
}

.flow {
  display: grid;
  gap: 10px;
}

.flow div {
  display: grid;
  place-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  font-weight: 900;
}

.flow span {
  justify-self: center;
  width: 2px;
  height: 18px;
  background: var(--brand-primary);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: none;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #172554;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.toast.show {
  display: block;
}

.admin-gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.72);
}

.admin-gate-card {
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-gate-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .submit-grid,
  .employee-layout,
  .leave-layout,
  .dashboard-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .report-preview {
    max-height: 420px;
  }

  .chart-panel,
  .trend-panel,
  .donut-panel,
  .issue-panel,
  .missing-panel,
  .employee-form-panel,
  .employee-table-panel,
  .dashboard-toolbar {
    grid-column: auto;
  }

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

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

  .dashboard-toolbar .compact-action {
    grid-column: 1 / -1;
    justify-self: end;
  }

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

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

  .followup-panel .panel-header,
  .leave-list-panel .panel-header {
    grid-template-columns: 1fr;
  }

  .followup-panel .panel-header > div:first-child,
  .leave-list-panel .panel-header > div:first-child {
    flex: 0 1 auto;
  }

  .followup-panel .filter-row,
  .leave-list-panel .filter-row {
    flex: 0 1 auto;
    grid-template-columns: 1fr;
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .leave-list-panel .employee-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leave-form-panel .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: 248px;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .workspace {
    padding: 16px;
  }

  .icon-button {
    display: grid;
  }

  .field-grid,
  .employee-profile-card,
  .preview-meta {
    grid-template-columns: 1fr;
  }

  .previous-template-card {
    align-items: stretch;
    flex-direction: column;
  }

  .template-card-actions {
    justify-content: stretch;
  }

  .template-card-actions button {
    flex: 1;
  }

  .preview-meta div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .form-footer,
  .panel-header,
  .section-line,
  .table-tools,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .section-line .text-button {
    align-self: flex-start;
  }

  .filter-row input,
  .filter-row select {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  .dashboard-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-filter-group {
    grid-template-columns: 1fr;
  }

  .dashboard-toolbar .segmented-control,
  .dashboard-toolbar .compact-action {
    width: 100%;
  }

  .dashboard-toolbar .compact-action {
    justify-self: stretch;
  }

  .followup-layout .employee-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leave-list-panel .employee-summary {
    grid-template-columns: 1fr;
  }

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

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

  .leave-card .inline-button {
    width: 100%;
  }

  .followup-controls {
    grid-template-columns: 1fr;
  }

  .followup-save-button {
    justify-self: stretch;
  }

  .segmented-control {
    width: 100%;
  }

  .range-button {
    flex: 1;
  }

  .mini-feed .section-line {
    align-items: center;
    flex-direction: row;
  }

  .mini-feed .section-line .soft-badge {
    width: auto;
    min-width: 58px;
    align-self: center;
  }

  .button-row {
    width: 100%;
  }

  .button-row button {
    flex: 1;
  }

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

  .employee-actions .primary-button {
    grid-column: 1 / -1;
  }

  .kpi-strip {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 720px) {
  .system-status {
    align-items: stretch;
    flex-direction: column;
  }

  .system-status-main,
  .system-status-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .system-status-main strong {
    white-space: normal;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .employee-table,
  .report-history-table {
    min-width: 0;
    background: transparent;
    table-layout: auto;
  }

  .employee-table,
  .employee-table thead,
  .employee-table tbody,
  .employee-table tr,
  .employee-table th,
  .employee-table td,
  .report-history-table,
  .report-history-table thead,
  .report-history-table tbody,
  .report-history-table tr,
  .report-history-table th,
  .report-history-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  .employee-table thead,
  .report-history-table thead {
    display: none;
  }

  .employee-table tr,
  .report-history-table tr {
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .employee-table td,
  .report-history-table td {
    display: grid;
    grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .employee-table td:last-child,
  .report-history-table td:last-child {
    border-bottom: 0;
  }

  .employee-table td::before,
  .report-history-table td::before {
    content: attr(data-label);
    color: var(--brand-primary-strong);
    font-weight: 900;
  }

  .employee-table .empty-row,
  .report-history-table .empty-row {
    display: block;
    position: static;
  }

  .employee-table .empty-row::before,
  .report-history-table .empty-row::before {
    content: "";
  }

  .report-text {
    max-height: 220px;
  }
}

@media (max-width: 540px) {
  h1 {
    font-size: 22px;
  }

  .panel {
    box-shadow: none;
  }

  .task-row {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    padding: 10px;
  }

  .task-number,
  .remove-task {
    width: 34px;
  }

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

  .lookup-row .secondary-button {
    width: 100%;
  }

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

  .form-footer .button-row button {
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    line-height: 1.25;
  }

  .form-footer .button-row .primary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .form-footer .button-row {
    grid-template-columns: 1fr;
  }

  .form-footer .button-row .primary-button {
    grid-column: auto;
  }
}
