:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-muted: #f7f8f6;
  --ink: #1f2724;
  --muted: #68736d;
  --line: #dce2de;
  --line-strong: #c8d0cb;
  --green: #167c5a;
  --green-soft: #e7f3ed;
  --amber: #b86c11;
  --amber-soft: #fff1dc;
  --red: #c33f38;
  --red-soft: #fce9e7;
  --blue: #2f68a5;
  --blue-soft: #e9f0f8;
  --sidebar: #202825;
  --sidebar-muted: #aeb9b3;
  --shadow: 0 12px 30px rgba(31, 39, 36, 0.12);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

body.auth-locked {
  overflow: hidden;
}

.login-screen {
  position: fixed;
  z-index: 50;
  inset: 0;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background: #edf1ee;
}

.login-panel {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-top: 4px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong { font-size: 16px; }
.login-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.login-heading { margin-top: 34px; }
.login-heading h1 { margin-bottom: 0; font-size: 25px; }

.login-form {
  margin-top: 24px;
  display: grid;
  gap: 15px;
}

.login-form label,
.password-form-content label {
  display: grid;
  gap: 6px;
}

.login-form label > span,
.password-form-content label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.login-form input,
.password-form-content input {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
}

.login-form input:focus,
.password-form-content input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 124, 90, 0.12);
}

.login-form .login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-form .login-remember input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--green);
}

.login-form .login-remember span {
  color: var(--ink);
  font-size: 12px;
}

.login-form .primary-button { margin-top: 3px; }

.login-status {
  margin-top: 20px;
  padding-top: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.form-error {
  margin: 0;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
}

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

button,
select,
input[type="date"] {
  min-height: 38px;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #fff;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 8px;
}

.brand-block strong,
.brand-block small {
  display: block;
}

.brand-block strong {
  font-size: 17px;
}

.brand-block small {
  margin-top: 3px;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border-radius: 7px;
  background: #e5b34a;
  color: #202825;
  font-weight: 800;
  font-size: 13px;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
}

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

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 18px;
}

.sidebar-status {
  margin-top: 0;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user {
  margin-top: auto;
  padding: 14px 8px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user strong { font-size: 12px; }
.sidebar-user small { margin-top: 3px; color: var(--sidebar-muted); font-size: 10px; }

.sidebar-logout {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 18px;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  font-size: 13px;
}

.sidebar-status small {
  color: var(--sidebar-muted);
  font-size: 11px;
  margin-top: 2px;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #d59b35;
  box-shadow: 0 0 0 4px rgba(213, 155, 53, 0.14);
}

.status-dot.is-online {
  background: #4ec391;
  box-shadow: 0 0 0 4px rgba(78, 195, 145, 0.14);
}

.status-dot.is-error {
  background: #df615a;
  box-shadow: 0 0 0 4px rgba(223, 97, 90, 0.14);
}

.main-content {
  min-width: 0;
  padding: 28px 32px 48px;
}

.control-page {
  display: none;
}

.control-page.is-active {
  display: block;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 7px;
  font-size: 27px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
}

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

.page-meta,
.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.record-filters,
.dialog-footer > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-control {
  min-width: 178px;
  height: 42px;
  padding: 4px 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.date-control span {
  color: var(--muted);
  font-size: 11px;
}

.date-control input {
  width: 126px;
  min-height: 30px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button,
.notice-bar button {
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  padding: 0 16px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  white-space: nowrap;
}

.primary-button:hover {
  background: #116b4d;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: #9ca8a1;
  background: var(--surface-muted);
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 21px;
}

.icon-button:hover {
  background: var(--surface-muted);
}

.icon-button.is-loading {
  animation: spin 0.8s linear infinite;
}

.text-button,
.notice-bar button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
}

.full-width {
  width: 100%;
}

.notice-bar {
  margin-top: 18px;
  min-height: 42px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: #71430d;
  font-size: 13px;
}

.kpi-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
}

.kpi-card {
  position: relative;
  min-height: 116px;
  padding: 18px 16px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--line-strong);
}

.kpi-card > span,
.kpi-card > small,
.kpi-card > strong {
  display: block;
}

.kpi-card > span {
  color: var(--muted);
  font-size: 12px;
}

.kpi-card > strong {
  margin-top: 8px;
  font-size: 27px;
  line-height: 1;
}

.kpi-card > small {
  margin-top: 9px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-card.accent-green::before { background: var(--green); }
.kpi-card.accent-ink::before { background: var(--ink); }
.kpi-card.accent-amber::before { background: var(--amber); }
.kpi-card.accent-red::before { background: var(--red); }
.kpi-card.accent-blue::before { background: var(--blue); }

.content-section {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.work-dashboard-page {
  min-height: calc(100vh - 76px);
  overflow: hidden;
  border: 1px solid #2a3732;
  border-radius: 8px;
  background: #111815;
  color: #edf5f1;
  box-shadow: 0 18px 45px rgba(20, 28, 25, 0.18);
}

.work-dashboard-masthead {
  min-height: 106px;
  padding: 23px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: #17201c;
}

.work-dashboard-title {
  min-width: 0;
}

.work-dashboard-title .eyebrow {
  color: #55dbaa;
}

.work-dashboard-title h1 {
  margin-bottom: 6px;
  color: #f7fbf9;
  font-size: 28px;
}

.work-dashboard-title > p:last-child {
  margin-bottom: 0;
  color: #8fa099;
  font-size: 11px;
}

.work-dashboard-filters {
  display: flex;
  align-items: flex-end;
  gap: 9px;
}

.work-dashboard-filters label {
  display: grid;
  gap: 6px;
}

.work-dashboard-filters label > span {
  color: #81928b;
  font-size: 10px;
  font-weight: 700;
}

.work-dashboard-filters select {
  width: min(250px, 23vw);
  min-height: 40px;
  padding: 0 30px 0 11px;
  border: 1px solid #3a4943;
  border-radius: 5px;
  outline: none;
  background: #202a26;
  color: #ecf3f0;
  font-size: 12px;
}

.work-dashboard-filters select:focus {
  border-color: #55dbaa;
  box-shadow: 0 0 0 3px rgba(85, 219, 170, 0.12);
}

.work-refresh-button {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #3a4943;
  border-radius: 5px;
  background: #202a26;
  color: #55dbaa;
  font-size: 20px;
}

.work-refresh-button:hover {
  border-color: #55dbaa;
  background: #26332e;
}

.work-refresh-button.is-loading {
  animation: spin 0.8s linear infinite;
}

.work-dashboard-status {
  min-height: 42px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid #28352f;
  border-bottom: 1px solid #28352f;
  background: #141c19;
  color: #83938c;
  font-size: 10px;
}

.work-dashboard-status > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.work-dashboard-status strong {
  color: #c7d3ce;
}

.dashboard-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #39d59f;
  box-shadow: 0 0 0 4px rgba(57, 213, 159, 0.12);
}

.work-metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  border-bottom: 1px solid #2a3732;
  background: #19221e;
}

.work-metric-strip article {
  position: relative;
  min-width: 0;
  min-height: 124px;
  padding: 21px 20px 17px;
  border-right: 1px solid #2a3732;
}

.work-metric-strip article:last-child {
  border-right: 0;
}

.work-metric-strip article::before {
  content: "";
  position: absolute;
  top: 0;
  right: 20px;
  left: 20px;
  height: 2px;
  background: #3b4843;
}

.work-metric-strip .work-metric-primary::before { background: #39d59f; }
.work-metric-strip article:nth-child(2)::before { background: #4ba8ff; }
.work-metric-strip article:nth-child(3)::before { background: #72d7de; }
.work-metric-strip article:nth-child(4)::before { background: #ffbd59; }
.work-metric-strip article:nth-child(5)::before { background: #b58cff; }
.work-metric-strip article:nth-child(6)::before { background: #ff6f61; }

.work-metric-strip span,
.work-metric-strip strong,
.work-metric-strip small {
  display: block;
}

.work-metric-strip span {
  color: #8a9a93;
  font-size: 10px;
  font-weight: 700;
}

.work-metric-strip strong {
  margin: 12px 0 9px;
  overflow: hidden;
  color: #f4f8f6;
  font-size: 27px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-metric-strip small {
  color: #72827b;
  font-size: 10px;
}

.work-analysis-grid {
  display: grid;
  grid-template-columns: minmax(340px, 5fr) minmax(480px, 7fr);
}

.work-analysis-panel {
  min-width: 0;
  min-height: 330px;
  padding: 22px 24px;
  border-bottom: 1px solid #2a3732;
  background: #151d1a;
}

.work-analysis-panel:nth-child(odd) {
  border-right: 1px solid #2a3732;
}

.work-panel-heading,
.work-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.work-panel-heading {
  margin-bottom: 22px;
}

.work-panel-heading span,
.work-detail-heading span {
  display: block;
  margin-bottom: 5px;
  color: #55dbaa;
  font-size: 9px;
  font-weight: 800;
}

.work-panel-heading h2,
.work-detail-heading h2 {
  margin: 0;
  color: #edf5f1;
  font-size: 15px;
}

.work-panel-heading > small,
.work-detail-heading > small {
  color: #718079;
  font-size: 10px;
}

.work-platform-overview {
  min-height: 230px;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: center;
  gap: 25px;
}

.work-platform-donut {
  position: relative;
  width: 176px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--donut-segments, #35423d 0deg 360deg));
}

.work-platform-donut::after {
  content: "";
  position: absolute;
  inset: 21px;
  border: 1px solid #33413b;
  border-radius: 50%;
  background: #151d1a;
}

.work-platform-donut > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.work-platform-donut strong,
.work-platform-donut span {
  display: block;
}

.work-platform-donut strong {
  color: #f3f8f5;
  font-size: 29px;
}

.work-platform-donut span {
  margin-top: 3px;
  color: #7f9088;
  font-size: 10px;
}

.work-platform-legend {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 11px;
}

.work-platform-legend-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.work-platform-swatch {
  width: 8px;
  height: 8px;
  margin: 0;
  border-radius: 2px;
  background: var(--swatch);
}

.work-platform-legend-row strong,
.work-platform-legend-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-platform-legend-row strong {
  color: #dce6e1;
  font-size: 11px;
}

.work-platform-legend-row small {
  margin-top: 3px;
  color: #687871;
  font-size: 9px;
}

.work-platform-legend-row b {
  color: #f0f5f2;
  font-size: 13px;
}

.work-chart-key {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #819089;
  font-size: 9px;
}

.work-chart-key span {
  position: relative;
  margin: 0;
  padding-left: 13px;
  color: #819089;
  font-weight: 600;
}

.work-chart-key span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #4ba8ff;
}

.work-chart-key .is-read::before {
  background: #39d59f;
}

.work-reach-chart {
  min-height: 230px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.work-reach-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
}

.work-reach-label strong,
.work-reach-label small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-reach-label strong {
  color: #dce5e1;
  font-size: 10px;
}

.work-reach-label small {
  margin-top: 3px;
  color: #67766f;
  font-size: 9px;
}

.work-reach-bars {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.work-reach-bars > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  align-items: center;
  gap: 10px;
}

.work-reach-track {
  height: 5px;
  overflow: hidden;
  background: #27332e;
}

.work-reach-track span {
  height: 100%;
  display: block;
  margin: 0;
  background: #4ba8ff;
}

.work-reach-track .is-read {
  background: #39d59f;
}

.work-reach-bars b {
  color: #aebdb6;
  font-size: 9px;
  font-weight: 700;
  text-align: right;
}

.work-engagement-chart {
  min-height: 230px;
  display: grid;
  align-content: center;
}

.work-engagement-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.work-engagement-total span,
.work-engagement-total strong {
  display: block;
}

.work-engagement-total span {
  color: #74857d;
  font-size: 9px;
}

.work-engagement-total strong {
  margin-top: 7px;
  color: #f4f8f6;
  font-size: 27px;
}

.work-engagement-total > small {
  color: #718079;
  font-size: 9px;
}

.work-engagement-total > small b {
  color: #ffbd59;
  font-size: 13px;
}

.work-engagement-meter {
  height: 12px;
  margin: 17px 0 20px;
  display: flex;
  overflow: hidden;
  background: #27332e;
}

.work-engagement-meter span {
  height: 100%;
  display: block;
  background: var(--segment);
}

.work-engagement-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #2a3732;
  border-left: 1px solid #2a3732;
}

.work-engagement-items > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid #2a3732;
  border-bottom: 1px solid #2a3732;
}

.work-engagement-items span,
.work-engagement-items strong,
.work-engagement-items small {
  display: block;
}

.work-engagement-items span {
  position: relative;
  padding-left: 11px;
  color: #83928b;
  font-size: 9px;
}

.work-engagement-items span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--metric);
}

.work-engagement-items strong {
  margin-top: 7px;
  color: #e9f1ed;
  font-size: 16px;
}

.work-engagement-items small {
  margin-top: 3px;
  color: #62716b;
  font-size: 8px;
}

.work-ranking {
  min-height: 230px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.work-ranking-row {
  min-width: 0;
  min-height: 51px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #26332e;
}

.work-ranking-row:last-child {
  border-bottom: 0;
}

.work-rank-number {
  color: #5f7169;
  font-size: 10px;
  font-weight: 800;
}

.work-ranking-row:nth-child(-n + 3) .work-rank-number {
  color: #ffbd59;
}

.work-rank-content {
  min-width: 0;
}

.work-rank-content > strong,
.work-rank-content > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-rank-content > strong {
  color: #dce5e1;
  font-size: 10px;
}

.work-rank-content > small {
  margin-top: 3px;
  color: #63726c;
  font-size: 8px;
}

.work-rank-track {
  height: 2px;
  margin-top: 6px;
  overflow: hidden;
  background: #2a3732;
}

.work-rank-track i {
  height: 100%;
  display: block;
  background: #4ba8ff;
}

.work-rank-metric {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: end;
  gap: 4px;
  text-align: right;
}

.work-rank-metric strong {
  color: #f2f7f4;
  font-size: 13px;
}

.work-rank-metric span {
  color: #72817a;
  font-size: 8px;
}

.work-rank-metric small {
  grid-column: 1 / -1;
  color: #708078;
  font-size: 8px;
}

.work-detail-section {
  background: #151d1a;
}

.work-detail-heading {
  min-height: 72px;
  padding: 18px 24px;
  align-items: center;
  border-bottom: 1px solid #2a3732;
}

.work-table {
  min-width: 980px;
  color: #cbd6d1;
}

.work-table th:nth-child(1) { width: 25%; }
.work-table th:nth-child(2) { width: 11%; }
.work-table th:nth-child(3) { width: 17%; }
.work-table th:nth-child(4) { width: 12%; }
.work-table th:nth-child(5) { width: 14%; }
.work-table th:nth-child(6) { width: 13%; }
.work-table th:nth-child(7) { width: 8%; }

.work-table th {
  border-color: #2a3732;
  background: #19231f;
  color: #718079;
}

.work-table td {
  border-color: #26332e;
  font-size: 10px;
}

.work-table tbody tr:hover {
  background: #19231f;
}

.work-table .record-title {
  color: #e4ede8;
}

.work-table .record-subline,
.work-table .link-pending {
  color: #687871;
}

.work-table a {
  color: #55dbaa;
  font-weight: 800;
  text-decoration: none;
}

.work-table-empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: #82918a;
  text-align: center;
}

.work-table-empty strong {
  color: #c6d1cc;
  font-size: 12px;
}

.work-table-empty span {
  font-size: 9px;
}

.dashboard-empty {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  color: #6e7e76;
  text-align: center;
}

.dashboard-empty > span {
  width: 28px;
  height: 28px;
  margin: 0 0 4px;
  display: grid;
  place-items: center;
  border: 1px solid #34423c;
  border-radius: 50%;
  color: #55dbaa;
}

.dashboard-empty strong {
  color: #aab7b1;
  font-size: 10px;
}

.dashboard-empty small {
  color: #607069;
  font-size: 8px;
}

.section-heading {
  min-height: 72px;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.section-heading.compact {
  min-height: 65px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf0ee;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--muted);
  background: #fafbf9;
  font-size: 11px;
  font-weight: 700;
}

.data-table td {
  font-size: 13px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fafcfb;
}

.employee-table th:nth-child(1) { width: 17%; }
.employee-table th:nth-child(2) { width: 18%; }
.employee-table th:nth-child(3) { width: 12%; }
.employee-table th:nth-child(4) { width: 28%; }
.employee-table th:nth-child(5) { width: 14%; }
.employee-table th:nth-child(6) { width: 11%; }

.person-cell,
.account-cell {
  display: grid;
  gap: 3px;
}

.person-cell strong,
.account-cell strong {
  font-size: 13px;
}

.person-cell small,
.account-cell small,
.record-subline {
  color: var(--muted);
  font-size: 11px;
}

.inactive-label {
  color: var(--red);
}

.progress-cell {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 43px;
  align-items: center;
  gap: 10px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #e8ece9;
}

.progress-fill {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: 4px;
  background: var(--green);
}

.progress-cell strong {
  text-align: right;
  font-size: 12px;
}

.count-good { color: var(--green); }
.count-bad { color: var(--red); }
.count-warn { color: var(--amber); }

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.trend-chart {
  height: 226px;
  padding: 18px 18px 14px;
  display: grid;
  grid-template-columns: repeat(14, minmax(20px, 1fr));
  align-items: end;
  gap: 7px;
}

.trend-column {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 26px;
  gap: 7px;
}

.trend-bars {
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 3px;
  border-bottom: 1px solid var(--line);
}

.trend-bar {
  width: min(12px, 42%);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
}

.trend-bar.published { background: var(--green); }
.trend-bar.failed { background: var(--red); }

.trend-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.platform-list {
  min-height: 226px;
  padding: 8px 18px 12px;
}

.platform-row {
  min-height: 49px;
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #edf0ee;
}

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

.platform-row span,
.platform-row small {
  display: block;
}

.platform-row span {
  font-size: 13px;
  font-weight: 700;
}

.platform-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.platform-row strong {
  color: var(--green);
  font-size: 16px;
}

.records-heading {
  align-items: flex-end;
}

.record-filters select,
.record-filters input {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  font-size: 12px;
}

.record-filters select {
  min-width: 112px;
  padding: 0 28px 0 10px;
}

.record-filters input {
  width: min(220px, 28vw);
  padding: 0 11px;
}

.record-export-button {
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.record-export-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.records-table th:nth-child(1) { width: 11%; }
.records-table th:nth-child(2) { width: 17%; }
.records-table th:nth-child(3) { width: 10%; }
.records-table th:nth-child(4) { width: 31%; }
.records-table th:nth-child(5) { width: 18%; }
.records-table th:nth-child(6) { width: 13%; }

.record-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 700;
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}

.status-badge.published { background: var(--green-soft); color: var(--green); }
.status-badge.failed { background: var(--red-soft); color: var(--red); }
.status-badge.pending { background: var(--amber-soft); color: var(--amber); }
.status-badge.other { background: #edf0ee; color: #58625d; }

.record-message {
  margin-top: 4px;
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-actions a,
.copy-link-button {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.work-detail-section .data-table th {
  border-color: #2a3732;
  background: #19231f;
  color: #718079;
}

.work-detail-section .data-table td {
  border-color: #26332e;
  color: #cbd6d1;
}

.copy-link-button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.link-pending {
  color: var(--muted);
  font-size: 11px;
}

.empty-state {
  min-height: 150px;
  padding: 30px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

dialog {
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(20, 27, 24, 0.48);
}

.manage-dialog {
  width: min(960px, calc(100vw - 32px));
}

.assign-dialog {
  width: min(760px, calc(100vw - 32px));
}

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

.dialog-shell {
  max-height: min(780px, calc(100vh - 40px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-header,
.dialog-footer {
  padding: 17px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-bottom: 0;
}

.dialog-header .icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.dialog-content {
  min-height: 0;
  overflow-y: auto;
}

.staff-dialog-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.staff-form {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
}

.staff-form label {
  margin-top: 15px;
  display: grid;
  gap: 6px;
}

.staff-form label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.staff-form input,
.staff-form textarea,
.staff-form select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.staff-form input {
  height: 40px;
  padding: 0 10px;
}

.staff-form select {
  height: 40px;
  padding: 0 10px;
}

.staff-form textarea {
  padding: 10px;
  resize: vertical;
}

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

.password-form-content {
  padding: 20px;
  display: grid;
  gap: 15px;
}

.password-form-content > p:first-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.password-footer {
  justify-content: flex-end;
}

.password-footer .primary-button {
  min-width: 140px;
}

.staff-form .primary-button {
  margin-top: 18px;
}

.staff-form .inline-check {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.staff-form .inline-check input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--green);
}

.staff-form .inline-check > span {
  color: var(--ink);
  font-size: 12px;
}

.subject-form-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.subject-form-actions .primary-button,
.subject-form-actions .secondary-button {
  min-height: 40px;
  margin-top: 0;
}

.danger-button {
  border-color: #d9a29e;
  color: var(--red);
}

.subject-form-note {
  margin: 14px 0 0;
}

.form-heading,
.pane-heading {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.staff-list-pane {
  min-width: 0;
  padding: 20px;
}

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

.subject-pane-heading > div {
  min-width: 110px;
}

.subject-pane-heading input {
  width: min(260px, 48%);
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  font-size: 12px;
}

.manage-staff-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.manage-staff-row {
  min-height: 72px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 0.8fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.manage-staff-row.is-inactive {
  opacity: 0.62;
}

.subject-row.is-system {
  background: var(--surface-muted);
}

.subject-counts {
  min-width: 0;
}

.manage-staff-row strong,
.manage-staff-row small {
  display: block;
}

.manage-staff-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.account-assignment-list {
  padding: 8px 20px 20px;
}

.account-group-title {
  margin: 17px 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.account-check {
  min-height: 54px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.account-check:hover {
  background: var(--surface-muted);
}

.account-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.account-check strong,
.account-check small {
  display: block;
}

.account-check strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-check small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.dialog-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-footer > span {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 15px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.is-error {
  background: #8d2f2a;
}

.is-hidden {
  display: none !important;
}

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

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .work-metric-strip { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .work-metric-strip article:nth-child(3n) { border-right: 0; }
  .work-metric-strip article:nth-child(-n + 3) { border-bottom: 1px solid #2a3732; }
  .work-analysis-grid { grid-template-columns: minmax(310px, 5fr) minmax(410px, 7fr); }
  .work-platform-overview { grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
  .work-platform-donut { width: 150px; }
  .record-filters { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }
  .side-nav { margin: 0; display: flex; }
  .nav-item { width: auto; }
  .sidebar-user { margin: 0 0 0 auto; padding: 0 0 0 12px; border-top: 0; border-left: 1px solid rgba(255, 255, 255, 0.12); }
  .sidebar-status { display: none; }
  .main-content { padding: 22px 20px 40px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .insight-grid { grid-template-columns: 1fr; gap: 0; }
  .work-dashboard-masthead { align-items: flex-end; }
  .work-dashboard-filters select { width: min(220px, 25vw); }
  .work-analysis-grid { grid-template-columns: 1fr; }
  .work-analysis-panel:nth-child(odd) { border-right: 0; }
  .work-analysis-panel { min-height: 300px; }
  .staff-dialog-grid { grid-template-columns: 1fr; }
  .staff-form { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .sidebar { flex-wrap: wrap; }
  .brand-block { min-width: calc(100% - 120px); }
  .side-nav { width: 100%; order: 4; }
  .nav-item { min-width: 0; flex: 1; justify-content: center; padding-inline: 7px; font-size: 11px; white-space: nowrap; }
  .nav-icon { width: 15px; font-size: 15px; }
  .main-content { padding: 18px 12px 32px; }
  .topbar { display: grid; }
  .topbar-actions { justify-content: flex-start; }
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px 96px;
  }
  .topbar-actions .date-control { min-width: 0; width: auto; }
  .topbar-actions .primary-button { min-width: 96px; padding-inline: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-height: 108px; padding: 15px 13px; }
  .section-heading,
  .records-heading { align-items: flex-start; flex-direction: column; }
  .work-dashboard-page { border-radius: 6px; }
  .work-dashboard-masthead { padding: 20px 16px; display: grid; gap: 18px; }
  .work-dashboard-title h1 { font-size: 24px; }
  .work-dashboard-filters { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 40px; }
  .work-dashboard-filters label { min-width: 0; }
  .work-dashboard-filters select { width: 100%; }
  .work-dashboard-status { min-height: 52px; padding: 8px 16px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
  .work-metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-metric-strip article { min-height: 108px; padding: 18px 14px 14px; }
  .work-metric-strip article:nth-child(3n) { border-right: 1px solid #2a3732; }
  .work-metric-strip article:nth-child(2n) { border-right: 0; }
  .work-metric-strip article:nth-child(-n + 4) { border-bottom: 1px solid #2a3732; }
  .work-metric-strip strong { font-size: 23px; }
  .work-analysis-panel { min-height: 0; padding: 19px 16px; }
  .work-platform-overview { min-height: 220px; grid-template-columns: 136px minmax(0, 1fr); gap: 16px; }
  .work-platform-donut { width: 136px; }
  .work-reach-row { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
  .work-reach-bars > div { grid-template-columns: minmax(0, 1fr) 52px; gap: 7px; }
  .work-ranking-row { grid-template-columns: 25px minmax(0, 1fr) 74px; gap: 8px; }
  .work-detail-heading { padding-inline: 16px; }
  .record-filters { width: 100%; justify-content: flex-start; }
  .record-filters select { flex: 1; min-width: 0; }
  .record-filters input { width: 100%; flex-basis: 100%; }
  .record-export-button { flex: 1; }
  .data-table { min-width: 780px; }
  .trend-chart { gap: 3px; padding-inline: 10px; }
  .account-check-grid { grid-template-columns: 1fr; }
  .manage-staff-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .subject-pane-heading { align-items: flex-start; flex-direction: column; }
  .subject-pane-heading input { width: 100%; }
  .dialog-footer { align-items: flex-start; flex-direction: column; }
  .dialog-footer > div { width: 100%; }
  .dialog-footer button { flex: 1; }
  .login-screen { padding: 14px; }
  .login-panel { padding: 24px 20px; }
}

@media (max-width: 430px) {
  .sidebar { gap: 10px; }
  .sidebar-user { padding-left: 8px; }
  .sidebar-user > div:nth-child(2) { display: none; }
  .nav-item { gap: 5px; font-size: 10px; }
  .work-platform-overview { grid-template-columns: 1fr; justify-items: center; }
  .work-platform-legend { width: 100%; }
  .work-engagement-items { grid-template-columns: 1fr; }
}
