:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-muted: #f8faf9;
  --ink: #1e2925;
  --muted: #69736f;
  --line: #dfe5e1;
  --line-strong: #cbd5cf;
  --nav: #202724;
  --nav-hover: #313b37;
  --accent: #16735a;
  --accent-hover: #0f5b47;
  --accent-soft: #e7f3ee;
  --danger: #b53f3f;
  --warning: #9a681b;
  --radius: 7px;
  --shadow-sm: 0 2px 10px rgba(27, 42, 35, 0.06);
  --shadow-md: 0 18px 48px rgba(27, 42, 35, 0.12);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(27, 42, 35, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  color: #17201d;
}

.brand > span:last-child { white-space: nowrap; }

.brand-mark {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 14px rgba(22, 115, 90, 0.22);
  font-size: 17px;
  font-weight: 700;
}

.brand-mark::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e2ad4c;
  content: "";
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.account small {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.account form, .button-row form { margin: 0; }

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

.sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 22px 14px;
  background: var(--nav);
  border-right: 1px solid #18201d;
}

.sidebar nav { display: grid; gap: 5px; }

.sidebar a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  color: #dce3df;
  font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease;
}

.sidebar a::before {
  width: 3px;
  height: 16px;
  margin-right: 0;
  border-radius: 3px;
  background: transparent;
  content: "";
  transition: margin-right 160ms ease, background-color 160ms ease;
}

.sidebar a:hover { background: var(--nav-hover); color: #fff; }
.sidebar a.active { background: #34433d; color: #fff; }
.sidebar a.active::before { margin-right: 10px; background: #60c3a2; }

.workspace {
  display: flex;
  min-width: 0;
  min-height: calc(100vh - 64px);
  flex-direction: column;
}

.content {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 30px 34px 36px;
  flex: 1;
  min-width: 0;
}

.public-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: #eef3f0;
}

.public-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.site-footer {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  color: #7b8580;
  font-size: 12px;
}

.app-page .site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer a:hover { color: var(--accent); }

.page-head, .section-head, .contract-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 5px; font-size: 25px; line-height: 1.35; letter-spacing: 0; }
.page-head p, .contract p { margin: 0; color: var(--muted); }
.page-head h1 .status { vertical-align: middle; }
.eyebrow, .section-kicker { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.eyebrow { margin-bottom: 5px; }

.breadcrumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumbs a, .text-link, .actions a { color: var(--accent); }
.breadcrumbs a:hover, .text-link:hover, .actions a:hover { color: var(--accent-hover); text-decoration: underline; }

.button-row, .form-actions, .filter-actions { display: flex; align-items: center; gap: 9px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: #2d3934;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.button:hover { border-color: #aebbb4; background: var(--surface-muted); }
.button:focus-visible { outline: 3px solid rgba(22, 115, 90, 0.18); outline-offset: 2px; }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 4px 10px rgba(22, 115, 90, 0.16); }
.button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.button-danger { border-color: #dbb2b2; color: var(--danger); }
.button-quiet { min-height: 32px; padding: 5px 11px; background: var(--surface-muted); }
.button-small { min-height: 31px; padding: 5px 10px; font-size: 13px; }
.button-block { width: 100%; }

.filter-bar, .form-panel, .section, .table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
}

.filter-actions { align-self: end; }

.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }
.field label { color: #43514b; font-size: 13px; font-weight: 600; }
.field label span { margin-left: 3px; color: var(--danger); }

.field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field textarea { min-height: 112px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #9aa39f; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(22, 115, 90, 0.13); }
.field input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.field small { color: var(--muted); line-height: 1.55; }
.recipient-choice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.recipient-choice-list > div { min-width: 0; }
.recipient-choice-list label { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; cursor: pointer; }
.birthday-chat-create { display: grid; grid-template-columns: minmax(260px, 520px) auto; align-items: end; gap: 12px; margin: 18px 0 24px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.birthday-chat-create .button { min-height: 38px; }
.reminder-page-head { align-items: end; }
.config-section { padding: 26px; }
.config-section-head { margin-bottom: 12px; }
.config-section-head h2, .rules-section h2 { margin-top: 2px; margin-bottom: 4px; }
.config-tools { display: flex; align-items: center; gap: 10px; }
.config-source { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.config-source-error { margin-left: 7px; color: var(--danger); }
.workbench-entry { display: flex; min-width: 0; align-items: center; gap: 12px; margin: -9px 0 20px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.workbench-entry strong { flex: 0 0 auto; font-size: 13px; }
.workbench-entry code { min-width: 0; color: var(--accent); overflow-wrap: anywhere; }
.recipient-sync-summary { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: center; gap: 7px 18px; margin: -8px 0 22px; padding: 13px 15px; border: 1px solid #bcd8cd; border-left: 3px solid var(--accent); border-radius: 6px; background: #f4faf7; }
.recipient-sync-summary > div:first-child { display: flex; min-width: 0; align-items: baseline; gap: 10px; }
.recipient-sync-summary > div:first-child span, .recipient-sync-result span { color: var(--muted); font-size: 13px; }
.recipient-sync-result { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.recipient-sync-result strong { color: var(--accent); font-size: 13px; }
.recipient-sync-summary > small { grid-column: 1 / -1; color: var(--danger); overflow-wrap: anywhere; }
.recipient-sync-summary.recipient-sync-error { border-color: #e7c5c0; border-left-color: var(--danger); background: #fff8f7; }
.recipient-sync-error .recipient-sync-result strong { color: var(--danger); }
.connection-grid { display: grid; grid-template-columns: 1.1fr 1.5fr 1fr 1.8fr 1.2fr; gap: 15px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.toggle-line { display: flex; align-items: center; gap: 8px; min-height: 38px; color: #43514b; }
.toggle-line input { flex: 0 0 auto; margin: 0; }
.channel-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 25px 0 13px; }
.channel-heading h3 { margin: 3px 0 0; font-size: 18px; }
.channel-heading p { margin: 0; text-align: right; }
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.channel-panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-muted); }
.channel-panel-birthday { border-top: 3px solid #dc9a4b; }
.channel-panel-expiry { border-top: 3px solid var(--accent); }
.channel-panel-head { display: flex; align-items: center; gap: 11px; margin-bottom: 19px; }
.channel-panel-head h3 { margin: 0; font-size: 17px; }
.channel-panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.channel-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 7px; background: #fff; color: var(--accent); font-weight: 800; box-shadow: 0 2px 8px rgba(27, 42, 35, 0.06); }
.channel-panel .field + .field { margin-top: 16px; }
.channel-panel .recipient-choice-list { background: #fff; }
.webhook-field input { font-family: Consolas, "Microsoft YaHei", monospace; }
.webhook-field .webhook-toggle { margin: 6px 0 9px; font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
.choice-empty { display: block; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 5px; background: #fff; }
.channel-note { display: flex; flex-direction: column; gap: 3px; margin-top: 18px; padding: 13px; border-left: 3px solid var(--line-strong); color: var(--muted); font-size: 13px; }
.channel-note strong { color: var(--ink); }
.template-panel { margin-top: 18px; padding: 19px 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.template-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.template-panel-head h3 { margin: 3px 0 0; font-size: 16px; }
.variable-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.variable-example { display: flex; min-width: 0; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); }
.variable-example code { flex: 0 0 auto; color: var(--accent); font-weight: 700; }
.variable-example span { min-width: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.template-example { margin-top: 10px; padding: 12px; border-left: 3px solid var(--accent); background: var(--surface-muted); }
.template-example strong { display: block; margin-bottom: 6px; font-size: 13px; }
.template-example pre { margin: 0; overflow-x: auto; color: #43514b; font: inherit; font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.birthday-chat-create { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); align-items: center; }
.birthday-chat-create > div:first-child { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.birthday-chat-create strong { font-size: 14px; }
.birthday-chat-create small { color: var(--muted); }
.birthday-chat-create-control { display: flex; gap: 8px; }
.birthday-chat-create-control input { min-width: 0; flex: 1; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; }
.birthday-chat-create-control input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(22, 115, 90, 0.13); }
.rules-section { padding: 24px 26px; }

.errorlist { margin: 0; padding: 0; color: var(--danger); font-size: 13px; list-style: none; }
.form-errors { margin-bottom: 15px; padding: 11px 13px; border: 1px solid #efd1d1; border-radius: 6px; background: #fff2f2; color: #8d2929; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 15px; border-bottom: 1px solid #e8edea; text-align: left; }
th { background: #f7f9f8; color: #4d5a54; font-size: 13px; font-weight: 700; }
tbody tr { transition: background-color 120ms ease; }
tbody tr:hover { background: #f6faf8; }
tbody tr:last-child td { border-bottom: 0; }
.actions { text-align: right; }
.actions a + a { margin-left: 13px; }
.empty { padding: 40px 20px !important; color: var(--muted); text-align: center !important; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.pagination-summary { color: var(--muted); font-size: 13px; }
.pagination-controls { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.page-link { display: inline-grid; min-width: 34px; min-height: 34px; place-items: center; padding: 5px 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; color: #43514b; font-size: 13px; }
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.current { border-color: var(--accent); background: var(--accent); color: #fff; }
.page-link.disabled { cursor: default; opacity: 0.45; }
.page-ellipsis { padding: 0 4px; color: var(--muted); }

.status { display: inline-block; padding: 3px 8px; border-radius: 4px; background: #edf1ef; color: #52605a; font-size: 12px; font-weight: 600; }
.status-active, .status-current { background: var(--accent-soft); color: var(--accent); }
.status-left, .status-expired { background: #f8eaea; color: #923838; }
.status-part_time, .status-draft, .status-upcoming { background: #fff2d9; color: #806018; }
.rule-table td { vertical-align: top; }
.rule-form { min-width: 280px; }
.rule-form input { width: 100%; min-width: 240px; }
.rule-form small { display: block; margin-top: 5px; color: var(--muted); }
.rule-form .errorlist { margin-top: 6px; }
.rule-actions { flex-wrap: nowrap; }

.section { margin-bottom: 19px; padding: 22px; }
.section h2 { margin: 0 0 17px; font-size: 18px; }
.section-head { align-items: center; margin-bottom: 17px; }
.section-head h2 { margin: 0; }

.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 26px; margin: 0; }
.detail-grid div { min-width: 0; }
.detail-grid .wide { grid-column: span 2; }
.detail-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }

.contract { padding: 16px 0; border-top: 1px solid var(--line); }
.contract:first-of-type { padding-top: 0; border-top: 0; }
.contract-head strong { margin-right: 8px; }
.contract p { margin-top: 5px; font-size: 13px; }
.contract-head .button-row { flex-wrap: wrap; }

.attachment-list { display: grid; gap: 7px; margin-top: 13px; }
.attachment-list a { display: flex; min-width: 0; justify-content: space-between; gap: 20px; padding: 9px 11px; border-radius: 5px; background: var(--surface-muted); }
.attachment-list a:hover { background: var(--accent-soft); }
.attachment-list a span { min-width: 0; overflow-wrap: anywhere; }
.attachment-list small { flex-shrink: 0; color: var(--muted); }
.muted { color: var(--muted); }

.form-panel { padding: 24px; }
.form-panel.narrow { max-width: 680px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 24px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line); }

.messages { width: 100%; margin-bottom: 17px; }
.public-content > .messages { width: min(430px, calc(100% - 40px)); margin: 20px auto 0; }
.message { padding: 11px 14px; border: 1px solid #cde3da; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }

.login-wrap {
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 560px;
  padding: 44px 22px;
  background-color: #eef3f0;
  background-image: linear-gradient(rgba(22, 115, 90, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 115, 90, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.login-panel {
  position: relative;
  width: min(430px, 100%);
  overflow: hidden;
  padding: 38px 40px 40px;
  border: 1px solid #d7dfda;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.login-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0 72%, #d7a548 72% 100%);
  content: "";
}

.login-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.login-heading .brand-mark { width: 44px; height: 44px; font-size: 20px; }
.login-heading h1 { margin: 0; font-size: 21px; line-height: 1.4; }
.login-panel h2 { margin: 0 0 18px; font-size: 17px; font-weight: 700; }
.form-stack { display: grid; gap: 18px; }
.login-panel .field input { min-height: 44px; }
.login-panel .button-primary { min-height: 44px; margin-top: 3px; }
.login-panel .button-wecom { min-height: 44px; border-color: #168547; background: #168547; color: #fff; font-weight: 700; }
.login-panel .button-wecom:hover { border-color: #116d3a; background: #116d3a; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }

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

.captcha-control .captcha {
  display: block;
  width: 120px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  object-fit: cover;
}

.captcha-control input[type=text] { min-width: 0; min-height: 40px; height: 40px; }
.captcha-refresh { min-height: 40px; height: 40px; padding: 7px 10px; font-size: 13px; }
.captcha-refresh:disabled { cursor: wait; opacity: 0.65; }
.lockout-panel p { margin: -4px 0 24px; color: var(--muted); line-height: 1.7; }

.employee-summary { display: flex; align-items: center; gap: 19px; min-width: 0; }
.employee-portrait { width: 92px; height: 116px; flex: 0 0 92px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #eef2f0; }
.employee-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.employee-portrait-placeholder { display: grid; width: 100%; height: 100%; place-content: center; justify-items: center; gap: 7px; background: #eef2f0; color: #64716b; }
.employee-portrait-placeholder strong { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #dce5e0; color: #43514b; font-size: 20px; }
.employee-portrait-placeholder span { font-size: 12px; }

.notes-content { line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.inline-contract { margin-top: 24px; padding-top: 19px; border-top: 1px solid var(--line); }
.inline-contract-toggle { display: inline-flex; align-items: center; gap: 9px; color: #34423c; font-weight: 600; cursor: pointer; }
.inline-contract-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.inline-contract-fields { margin-top: 19px; }
.inline-contract-fields[hidden] { display: none; }
.document-filter { grid-template-columns: 2fr 1fr 1fr auto; }
.document-filter .filter-actions { min-width: 150px; }

/* Performance management */
.performance-filter { grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto; }
.performance-form { max-width: 980px; }
.performance-form #id_cc_users {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  list-style: none;
}
.performance-form #id_cc_users label { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.performance-form #id_cc_users input { flex: 0 0 auto; margin: 0; }
.table-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 400; }
.overdue-text { display: block; margin-top: 2px; color: var(--danger); font-size: 12px; }
.performance-overview { padding-top: 26px; }
.process-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 26px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--line);
}
.process-step { position: relative; display: grid; min-width: 0; justify-items: center; gap: 5px; padding: 0 9px; text-align: center; }
.process-step::before { position: absolute; top: 15px; right: 50%; left: -50%; height: 2px; background: var(--line-strong); content: ""; }
.process-step:first-child::before { display: none; }
.process-step > span { position: relative; z-index: 1; display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--muted); font-size: 12px; font-weight: 800; }
.process-step strong { margin-top: 3px; font-size: 13px; }
.process-step small { max-width: 100%; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.process-step.done::before { background: var(--accent); }
.process-step.done > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.process-step.current > span { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--accent); }
.performance-meta { margin-top: 0; }
.score-summary { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.score-summary span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); color: var(--muted); font-size: 12px; }
.score-summary strong { margin-left: 4px; color: var(--ink); font-size: 14px; }
.score-table table, .score-form table, .flat-table table { white-space: normal; }
.objective-cell { min-width: 260px; max-width: 600px; line-height: 1.65; white-space: normal; }
.score-input-head, .score-input { width: 160px; }
.score-input .field { min-width: 120px; }
.score-input input { text-align: right; }
.template-objective { margin-bottom: 12px; padding: 10px 12px; border-left: 3px solid #b7c9c2; background: #f5f8f7; color: var(--muted); }
.template-objective strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; }
.content-input textarea { min-height: 96px; }
.employee-content { color: var(--text); font-weight: 600; }
.form-section + .form-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-section-head { margin-bottom: 14px; }
.form-section-head h2 { margin: 0; font-size: 16px; }
.scope-field > label { margin-bottom: 8px; }
.scope-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.reviewer-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.scope-options > div label { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-weight: 600; }
.scope-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.scope-options > div:has(input:checked) label { border-color: var(--accent); background: #edf7f3; color: var(--accent); }
.score-comment { margin-top: 18px; }
.template-summary { display: flex; align-items: center; gap: 24px; margin-bottom: 19px; padding: 15px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.48); }
.template-summary span { color: var(--muted); }
.template-summary strong { margin-left: 6px; color: var(--ink); font-size: 17px; }
.template-summary small { margin-left: auto; color: var(--muted); }
.template-category .section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.template-category .button-row form { margin: 0; }
.flat-table { border: 0; border-radius: 0; box-shadow: none; }
.inline-action { display: inline; margin-left: 13px; }
.inline-action button { padding: 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; }
.inline-action button:hover { text-decoration: underline; }
.section-description { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.organization-toolbar { flex-wrap: wrap; justify-content: flex-end; }
.organization-member-table td { vertical-align: middle; }
.organization-table .actions { position: sticky; right: 0; z-index: 1; background: #fff; box-shadow: -9px 0 12px -12px rgba(27, 42, 35, 0.28); }
.organization-table thead .actions { z-index: 2; background: #f7f9f8; }
.organization-table tbody tr:hover .actions { background: #f6faf8; }
.inline-bind-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 8px; margin-top: 8px; }
.inline-bind-form select { min-width: 180px; }
.member-actions { display: flex; min-width: 220px; align-items: center; justify-content: flex-end; gap: 13px; flex-wrap: wrap; }
.department-actions { min-width: 110px; }
.member-actions form { margin: 0; }
.row-actions { display: flex; min-width: 150px; align-items: center; justify-content: flex-end; gap: 13px; }
.row-actions form { margin: 0; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.link-button:hover { color: var(--accent-hover); text-decoration: underline; }
.danger-link { color: var(--danger); }
.danger-link:hover { color: #8d2929; }
.empty-template { padding: 34px; text-align: center; }
.empty-template p { margin: 6px 0 17px; color: var(--muted); }
.status-pending_self { background: #fff2d9; color: #806018; }
.status-pending_hr { background: #e8f1fb; color: #35628f; }
.status-pending_manager { background: #f0ecfa; color: #685297; }
.status-withdrawn { background: #f3f4f5; color: #5d6469; }
.status-completed { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; width: 100%; min-width: 0; height: auto; overflow: hidden; padding: 9px 15px; border-right: 0; border-bottom: 1px solid #18201d; }
  .workspace { width: 100%; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav { scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
  .sidebar a { min-height: 38px; flex: 0 0 auto; padding: 8px 12px; }
  .sidebar a::before { display: none; }
  .content { padding: 24px 18px 30px; }
  .filter-bar, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .performance-filter .filter-actions { grid-column: 1 / -1; }
  .performance-form #id_cc_users { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipient-choice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .channel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { min-height: 62px; height: auto; gap: 10px; padding: 10px 14px; }
  .brand { flex-shrink: 0; gap: 8px; font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; font-size: 15px; }
  .account { flex-shrink: 0; min-width: 0; gap: 8px; }
  .account > span { min-width: 0; font-size: 13px; }
  .account small { display: none; }
  .button-quiet { padding: 5px 9px; }
  .shell, .workspace { min-height: calc(100vh - 62px); }
  .filter-bar, .form-grid, .detail-grid, .document-filter, .performance-filter { grid-template-columns: 1fr; }
  .performance-form #id_cc_users { grid-template-columns: 1fr; }
  .recipient-choice-list { grid-template-columns: 1fr; }
  .connection-grid { grid-template-columns: 1fr; }
  .config-section, .rules-section { padding: 18px; }
  .config-tools, .channel-heading, .template-panel-head { align-items: flex-start; flex-direction: column; }
  .config-tools { width: 100%; }
  .config-tools form, .config-tools .button { width: 100%; }
  .recipient-sync-summary { grid-template-columns: 1fr; }
  .workbench-entry { align-items: flex-start; flex-direction: column; gap: 5px; }
  .recipient-sync-summary > div:first-child { align-items: flex-start; flex-direction: column; gap: 2px; }
  .recipient-sync-result { justify-content: flex-start; white-space: normal; }
  .channel-heading p { text-align: left; }
  .birthday-chat-create { grid-template-columns: 1fr; }
  .birthday-chat-create-control { width: 100%; min-width: 0; flex-direction: column; align-items: stretch; }
  .birthday-chat-create-control input,
  .birthday-chat-create-control .button { width: 100%; min-width: 0; }
  .variable-examples { grid-template-columns: 1fr; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .detail-grid .wide { grid-column: auto; }
  .page-head, .contract-head { flex-direction: column; }
  .page-head .button-row, .contract-head .button-row { width: 100%; }
  .page-head > .button, .page-head .button-row .button, .contract-head .button-row .button { flex: 1; }
  .filter-actions { grid-column: 1 / -1; }
  .filter-actions .button { flex: 1; }
  .form-panel, .section { padding: 18px; }
  .attachment-list a { flex-direction: column; gap: 3px; }
  .attachment-list small { flex-shrink: 1; }
  .document-filter .filter-actions { min-width: 0; }
  .process-rail { grid-template-columns: 1fr; gap: 0; padding-left: 5px; }
  .process-step { min-height: 64px; grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto auto; align-content: start; justify-items: start; padding: 0 0 12px; text-align: left; }
  .process-step::before { top: -32px; bottom: auto; left: 15px; width: 2px; height: 34px; }
  .process-step > span { grid-row: 1 / 3; }
  .process-step strong { align-self: end; margin: 0; }
  .process-step small { align-self: start; }
  .score-summary { width: 100%; }
  .score-summary span { flex: 1; text-align: center; }
  .template-summary { align-items: flex-start; flex-direction: column; gap: 7px; }
  .template-summary small { margin-left: 0; }
  .template-category .section-head { align-items: flex-start; flex-direction: column; }
  .template-category .button-row { width: 100%; flex-wrap: wrap; }
  .template-category .button-row .button, .template-category .button-row form { flex: 1; }
  .template-category .button-row form .button { width: 100%; }
  .organization-toolbar { width: 100%; }
  .organization-toolbar form, .organization-toolbar .button { flex: 1; }
  .organization-toolbar form .button { width: 100%; }
  .organization-member-table .actions { position: static; box-shadow: none; }
  .score-form > .table-wrap { overflow: visible; }
  .score-form table, .score-form tbody { display: block; width: 100%; }
  .score-form thead { display: none; }
  .score-form tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-rows: auto auto;
    gap: 3px 14px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .score-form tbody tr:last-child { border-bottom: 0; }
  .score-form tbody td { padding: 0; border: 0; }
  .score-form tbody td:first-child { grid-column: 1; grid-row: 1; }
  .score-form tbody .objective-cell { grid-column: 1; grid-row: 2; min-width: 0; }
  .score-form tbody .score-input { grid-column: 2; grid-row: 1 / 3; width: 120px; align-self: center; }
  .login-wrap { min-height: 500px; padding: 28px 16px; }
  .login-panel { padding: 32px 24px 30px; }
  .login-heading { margin-bottom: 26px; }
  .login-heading h1 { font-size: 19px; }
  .captcha-control { grid-template-columns: 112px minmax(0, 1fr) auto; gap: 6px; }
  .captcha-control .captcha { width: 112px; }
  .captcha-refresh { padding-right: 8px; padding-left: 8px; }
}

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