:root {
  --navy-950: #071524;
  --navy-900: #0b1f33;
  --navy-800: #12314e;
  --navy-700: #1d4569;
  --blue-500: #4677a6;
  --gold-600: #a8813f;
  --gold-500: #c6a15b;
  --gold-300: #dfc38d;
  --ivory-50: #fcfaf5;
  --ivory-100: #f6f1e7;
  --ivory-200: #ece3d3;
  --ink: #172333;
  --muted: #6e7884;
  --line: #e4e1d9;
  --white: #ffffff;
  --success: #287258;
  --danger: #a34343;
  --warning: #9b6b1f;
  --shadow: 0 18px 50px rgba(7, 21, 36, 0.10);
  --shadow-soft: 0 8px 24px rgba(7, 21, 36, 0.07);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --sidebar-width: 258px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 8%, rgba(198, 161, 91, 0.10), transparent 24rem),
    var(--ivory-50);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(198, 161, 91, 0.36);
  outline-offset: 2px;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--navy-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow.gold {
  color: var(--gold-500);
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--gold-500);
  border-radius: 50%;
  color: var(--gold-500);
  font-family: SimSun, serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand-mark-large {
  width: 74px;
  height: 74px;
  margin-bottom: 44px;
  border-width: 2px;
  font-size: 25px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(420px, 1.05fr) minmax(460px, 0.95fr);
}

.login-brand {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 100vh;
  padding: clamp(54px, 8vw, 112px);
  flex-direction: column;
  justify-content: center;
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 25%, transparent 25%) 0 0 / 34px 34px,
    linear-gradient(315deg, rgba(198,161,91,0.035) 25%, transparent 25%) 0 0 / 34px 34px,
    var(--navy-900);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(198, 161, 91, 0.18);
  border-radius: 50%;
}

.login-brand::before {
  width: 360px;
  height: 360px;
  right: -150px;
  top: -130px;
}

.login-brand::after {
  width: 560px;
  height: 560px;
  right: -250px;
  top: -230px;
}

.login-brand .eyebrow {
  color: var(--gold-300);
}

.login-brand h1 {
  max-width: 650px;
  margin-bottom: 26px;
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: clamp(38px, 4.6vw, 66px);
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: 0.03em;
}

.login-intro {
  max-width: 550px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 16px;
  line-height: 1.9;
}

.brand-rule {
  display: flex;
  width: 164px;
  margin: 38px 0 22px;
  align-items: center;
}

.brand-rule::before,
.brand-rule::after {
  height: 1px;
  flex: 1;
  content: "";
  background: rgba(198, 161, 91, 0.35);
}

.brand-rule span {
  width: 7px;
  height: 7px;
  margin: 0 12px;
  transform: rotate(45deg);
  background: var(--gold-500);
}

.company-legal {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: 40px;
  place-items: center;
}

.login-card {
  width: min(100%, 420px);
  padding: 44px;
  border: 1px solid rgba(198, 161, 91, 0.26);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin-bottom: 7px;
  font-family: "STSong", "Songti SC", SimSun, serif;
  color: var(--navy-900);
  font-size: 33px;
  font-weight: 600;
}

.login-card > .muted {
  margin-bottom: 34px;
  font-size: 14px;
}

.login-remember {
  display: flex;
  margin: -2px 0 20px;
  align-items: flex-start;
  gap: 10px;
  color: #44505d;
  cursor: pointer;
}

.login-remember input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--navy-800);
}

.login-remember span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-remember strong {
  font-size: 12px;
  font-weight: 700;
}

.login-remember small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.mobile-brand {
  display: none;
  margin-bottom: 36px;
  align-items: center;
  gap: 12px;
  color: var(--navy-900);
  font-weight: 800;
}

.field {
  display: flex;
  min-width: 0;
  margin-bottom: 18px;
  flex-direction: column;
  gap: 8px;
}

.field > span:first-child {
  color: #44505d;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.select-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid #dcd9d2;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.select-field select:hover {
  border-color: #c4b99f;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-field select:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, 0.12);
  outline: 0;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a4a8ad;
}

.field input[readonly] {
  color: #65717d;
  background: var(--ivory-100);
  cursor: not-allowed;
}

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

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 64px;
}

.input-action {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.16s, box-shadow 0.16s, background 0.16s, border-color 0.16s;
}

.primary-button {
  color: #fff;
  background: var(--navy-900);
  box-shadow: 0 7px 18px rgba(11, 31, 51, 0.14);
}

.primary-button:hover:not(:disabled) {
  background: var(--navy-800);
  box-shadow: 0 9px 22px rgba(11, 31, 51, 0.20);
  transform: translateY(-1px);
}

.secondary-button {
  border-color: #d7d3ca;
  color: var(--navy-900);
  background: #fff;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--gold-500);
  background: var(--ivory-50);
}

.secondary-button.light {
  border-color: rgba(255,255,255,0.3);
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.secondary-button.light:hover {
  border-color: var(--gold-300);
  background: rgba(255,255,255,0.1);
}

.secondary-button.success-outline {
  border-color: rgba(40, 114, 88, 0.35);
  color: var(--success);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.full-button {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  justify-content: space-between;
  padding: 0 20px;
}

.text-button,
.icon-button,
.danger-text-button {
  padding: 0;
  border: 0;
  color: var(--navy-700);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  color: var(--gold-600);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid #e0ddd5;
  border-radius: 50%;
  place-items: center;
  color: var(--navy-900);
  font-size: 18px;
}

.icon-button:hover {
  border-color: var(--gold-500);
  background: var(--ivory-100);
}

.icon-button.inverse {
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}

.danger-text-button {
  color: var(--danger);
}

.form-error {
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--danger);
  color: var(--danger);
  background: #fff4f2;
  font-size: 12px;
  line-height: 1.5;
}

.form-notice {
  margin: -6px 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--success);
  color: var(--success);
  background: #eef8f3;
  font-size: 12px;
  line-height: 1.5;
}

.secure-note {
  margin: 23px 0 0;
  color: #92979d;
  font-size: 11px;
  text-align: center;
}

.secure-note span {
  margin-right: 5px;
  color: var(--gold-600);
}

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

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  padding: 25px 17px 18px;
  flex-direction: column;
  color: rgba(255,255,255,0.76);
  background:
    radial-gradient(circle at -20% 5%, rgba(198,161,91,0.12), transparent 260px),
    var(--navy-900);
}

.sidebar-brand {
  display: flex;
  min-height: 72px;
  padding: 0 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  align-items: center;
  gap: 12px;
}

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

.sidebar-brand strong {
  margin-bottom: 4px;
  color: #fff;
  font-size: 15px;
}

.sidebar-brand small {
  color: var(--gold-300);
  font-size: 8px;
  letter-spacing: 0.15em;
}

.main-nav {
  display: flex;
  min-height: 0;
  padding: 25px 0;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 45px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.62);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

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

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(198,161,91,0.20), rgba(198,161,91,0.07));
  box-shadow: inset 3px 0 var(--gold-500);
}

.nav-icon {
  display: grid;
  width: 23px;
  place-items: center;
  color: var(--gold-300);
  font-size: 17px;
}

.nav-count {
  min-width: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--gold-300);
  background: rgba(198,161,91,0.13);
  font-size: 10px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer > p {
  margin-bottom: 12px;
  color: rgba(255,255,255,0.35);
  font-size: 9px;
  letter-spacing: 0.12em;
}

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

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  place-items: center;
  color: var(--navy-900);
  background: linear-gradient(145deg, var(--ivory-100), var(--gold-300));
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-weight: 800;
}

.avatar.small {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  font-size: 12px;
}

.account-chip > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

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

.account-chip strong {
  color: #fff;
  font-size: 12px;
}

.account-chip small {
  margin-top: 3px;
  color: rgba(255,255,255,0.38);
  font-size: 9px;
}

#account-role {
  color: var(--gold-300);
}

.account-chip .icon-button {
  width: 29px;
  height: 29px;
  flex-basis: 29px;
  font-size: 13px;
}

.account-password-button {
  display: flex;
  width: 100%;
  min-height: 35px;
  margin-top: 13px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(255,255,255,.62);
  background: rgba(255,255,255,.035);
  font-size: 10px;
  font-weight: 700;
  transition: border-color .16s, color .16s, background .16s;
}

.account-password-button:hover {
  border-color: rgba(223,195,141,.48);
  color: var(--gold-300);
  background: rgba(198,161,91,.08);
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 86px;
  padding: 0 clamp(22px, 3vw, 45px);
  border-bottom: 1px solid rgba(228,225,217,0.82);
  align-items: center;
  justify-content: space-between;
  background: rgba(252, 250, 245, 0.92);
  backdrop-filter: blur(12px);
}

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

.topbar h1 {
  margin: 0;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 25px;
  font-weight: 700;
}

.topbar .eyebrow {
  margin-bottom: 2px;
}

.menu-button {
  display: none;
}

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

.today {
  display: flex;
  padding-right: 18px;
  border-right: 1px solid var(--line);
  align-items: baseline;
  gap: 8px;
}

.today > span {
  color: var(--navy-900);
  font-size: 19px;
  font-weight: 800;
}

.today small {
  color: var(--muted);
  font-size: 10px;
}

.view-stack {
  width: min(100%, 1640px);
  margin: 0 auto;
  padding: 32px clamp(22px, 3vw, 45px) 60px;
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
  animation: view-in 0.24s ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-strip {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 190px;
  margin-bottom: 24px;
  padding: 34px 38px;
  border-radius: var(--radius-lg);
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(11,31,51,1) 0%, rgba(18,49,78,0.98) 68%, rgba(29,69,105,0.94) 100%);
  box-shadow: var(--shadow-soft);
}

.welcome-strip::after {
  position: absolute;
  width: 280px;
  height: 280px;
  right: 5%;
  border: 1px solid rgba(198,161,91,0.16);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 48px rgba(198,161,91,0.035), 0 0 0 96px rgba(198,161,91,0.025);
}

.welcome-strip > * {
  position: relative;
  z-index: 1;
}

.welcome-strip h2 {
  margin-bottom: 11px;
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 29px;
  font-weight: 600;
}

.welcome-strip p:last-child {
  margin-bottom: 0;
  color: rgba(255,255,255,0.58);
  font-size: 13px;
}

.stats-grid {
  display: grid;
  margin-bottom: 24px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 144px;
  padding: 22px;
  border: 1px solid rgba(228,225,217,0.85);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 4px 14px rgba(7,21,36,0.035);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  display: block;
  margin: 11px 0 7px;
  color: var(--navy-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
}

.stat-card small {
  color: #9a9fa4;
  font-size: 10px;
}

.stat-accent {
  position: absolute;
  width: 5px;
  height: 38px;
  right: 0;
  top: 22px;
  border-radius: 4px 0 0 4px;
}

.stat-accent.navy { background: var(--navy-700); }
.stat-accent.gold { background: var(--gold-500); }
.stat-accent.blue { background: #668bb0; }
.stat-accent.green { background: #4e927a; }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.75fr);
  gap: 24px;
}

.panel {
  border: 1px solid rgba(228,225,217,0.9);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.94);
  box-shadow: 0 4px 16px rgba(7,21,36,0.035);
}

.panel-header {
  display: flex;
  min-height: 79px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-header h2,
.preview-toolbar h3 {
  margin: 0;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 18px;
}

.panel-header .eyebrow {
  margin-bottom: 4px;
}

.recent-list {
  min-height: 250px;
  padding: 4px 22px 12px;
}

.recent-row {
  display: grid;
  min-height: 70px;
  padding: 12px 0;
  border-bottom: 1px solid #efede7;
  grid-template-columns: minmax(170px, 1.2fr) minmax(120px, 0.8fr) auto;
  align-items: center;
  gap: 18px;
}

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

.person-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.person-cell > span:last-child {
  min-width: 0;
}

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

.person-cell strong {
  margin-bottom: 4px;
  color: var(--navy-900);
  font-size: 13px;
}

.person-cell small,
.recent-role {
  color: var(--muted);
  font-size: 10px;
}

.quick-grid {
  display: flex;
  padding: 17px;
  flex-direction: column;
  gap: 10px;
}

.quick-action {
  display: grid;
  width: 100%;
  min-height: 69px;
  padding: 10px 12px;
  border: 1px solid #e8e5de;
  border-radius: var(--radius-sm);
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  background: var(--ivory-50);
  text-align: left;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}

.quick-action:hover {
  border-color: var(--gold-300);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.quick-icon {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  place-items: center;
  color: var(--gold-600);
  background: var(--ivory-200);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-weight: 800;
}

.quick-action strong,
.quick-action small {
  display: block;
}

.quick-action strong {
  margin-bottom: 4px;
  color: var(--navy-900);
  font-size: 12px;
}

.quick-action small {
  color: var(--muted);
  font-size: 9px;
}

.quick-action b {
  color: var(--gold-600);
  font-size: 13px;
}

.loading-block {
  position: relative;
  background: linear-gradient(90deg, transparent 0%, rgba(244,241,233,.8) 50%, transparent 100%) -100% 0 / 200% 100%;
  animation: loading-sheen 1.3s linear infinite;
}

@keyframes loading-sheen {
  to { background-position: 100% 0; }
}

.section-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  margin-bottom: 7px;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 27px;
}

.section-heading > div:first-child > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.heading-actions {
  display: flex;
  gap: 10px;
}

.filter-bar {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  display: flex;
  max-width: 410px;
  flex: 1;
  align-items: center;
}

.search-box > span {
  position: absolute;
  left: 13px;
  color: var(--muted);
  font-size: 19px;
}

.search-box input {
  width: 100%;
  height: 43px;
  padding: 0 13px 0 39px;
  border: 1px solid #dedbd4;
  border-radius: var(--radius-sm);
  background: #fff;
}

.search-box input:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(198,161,91,0.12);
  outline: 0;
}

.select-field select {
  min-width: 150px;
  min-height: 43px;
}

.table-panel {
  overflow: hidden;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  height: 45px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: #7d858e;
  background: #fbfaf7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.data-table td {
  height: 72px;
  padding: 11px 18px;
  border-bottom: 1px solid #efede8;
  color: #46515d;
  font-size: 12px;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background .16s;
}

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

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

.data-table .actions-column {
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.row-action {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #dfdcd4;
  border-radius: 6px;
  color: var(--navy-700);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.row-action:hover {
  border-color: var(--gold-500);
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 14px;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}

.candidate-status-picker {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  border-radius: 999px;
  align-items: center;
}

.candidate-status-picker::after {
  position: absolute;
  right: 10px;
  color: currentColor;
  content: "▾";
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.candidate-status-select {
  width: auto;
  max-width: 136px;
  min-height: 30px;
  padding: 0 28px 0 11px;
  border: 1px solid transparent;
  border-radius: 999px;
  appearance: none;
  color: inherit;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 28px;
  cursor: pointer;
  outline: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-status-select:hover {
  border-color: currentColor;
}

.candidate-status-select:focus-visible {
  border-color: currentColor;
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .2);
}

.candidate-status-select:disabled {
  opacity: .72;
  cursor: wait;
}

.candidate-status-picker.is-saving::after {
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: candidate-status-spin .7s linear infinite;
}

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

.status-new { color: #506478; background: #edf1f4; }
.status-interview { color: #88611f; background: #fbf2dc; }
.status-interviewed { color: #375f88; background: #e8f1f9; }
.status-offer { color: #6d4c96; background: #f1eaf8; }
.status-hired { color: #247257; background: #e5f4ed; }
.status-rejected { color: #9a4d4a; background: #f9eaea; }
.status-withdrawn { color: #6b6870; background: #efedef; }
.status-archived { color: #777; background: #eee; }

.contact-stack span {
  display: block;
  line-height: 1.55;
}

.contact-stack span:last-child {
  color: #8f969d;
  font-size: 10px;
}

.table-footer {
  display: flex;
  min-height: 50px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  background: #fbfaf7;
  font-size: 10px;
}

.empty-state {
  padding: 54px 20px;
  text-align: center;
}

.empty-state.compact {
  padding: 26px 20px;
}

.empty-state h3 {
  margin: 14px 0 7px;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
}

.empty-state p {
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 12px;
}

.empty-seal {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 1px solid var(--gold-300);
  border-radius: 50%;
  place-items: center;
  color: var(--gold-600);
  background: var(--ivory-100);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 20px;
}

.email-layout {
  display: grid;
  margin-bottom: 24px;
  grid-template-columns: minmax(390px, .82fr) minmax(520px, 1.18fr);
  align-items: start;
  gap: 22px;
}

.email-editor {
  padding: 24px;
}

.step-heading {
  display: flex;
  margin-bottom: 18px;
  align-items: flex-start;
  gap: 12px;
}

.step-heading > span {
  color: var(--gold-600);
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 800;
}

.step-heading h3 {
  margin-bottom: 3px;
  color: var(--navy-900);
  font-size: 14px;
}

.step-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.divider-top {
  margin-top: 23px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.selected-person {
  display: flex;
  min-height: 65px;
  padding: 11px 13px;
  border: 1px solid var(--ivory-200);
  border-radius: var(--radius-sm);
  align-items: center;
  gap: 11px;
  background: var(--ivory-50);
}

.selected-person .person-copy {
  min-width: 0;
  flex: 1;
}

.selected-person strong,
.selected-person small {
  display: block;
}

.selected-person strong {
  margin-bottom: 4px;
  color: var(--navy-900);
  font-size: 12px;
}

.selected-person small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.template-tab {
  min-height: 63px;
  padding: 8px;
  border: 1px solid #dfdcd4;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.template-tab b,
.template-tab small {
  display: block;
}

.template-tab b {
  margin-bottom: 4px;
  font-size: 11px;
}

.template-tab small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.template-tab.active {
  border-color: var(--gold-500);
  color: var(--navy-900);
  background: var(--ivory-100);
  box-shadow: inset 0 0 0 1px rgba(198,161,91,.13);
}

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

.form-grid.compact .field {
  margin-bottom: 14px;
}

.span-2 {
  grid-column: 1 / -1;
}

.checkbox-field {
  display: flex;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #dedbd4;
  border-radius: var(--radius-sm);
  align-items: center;
  gap: 9px;
  color: #44505d;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy-800);
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
}

.preview-panel {
  position: sticky;
  top: 105px;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  min-height: 73px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
}

.save-status {
  color: var(--muted);
  font-size: 10px;
}

.save-status.loading::before {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border: 2px solid var(--ivory-200);
  border-top-color: var(--gold-600);
  border-radius: 50%;
  content: "";
  vertical-align: -2px;
  animation: spin .7s linear infinite;
}

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

.subject-bar {
  display: grid;
  min-height: 55px;
  padding: 10px 17px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  background: #fbfaf7;
}

.subject-bar > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.subject-bar strong {
  overflow: hidden;
  color: var(--navy-900);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-frame {
  position: relative;
  min-height: 520px;
  padding: 18px;
  background: #ebe8e1;
}

.device-frame iframe {
  display: block;
  width: 100%;
  height: 600px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(7,21,36,.10);
}

.preview-empty {
  position: absolute;
  inset: 18px;
  display: grid;
  padding: 20px;
  place-content: center;
  text-align: center;
  background: #fff;
}

.preview-empty h3 {
  margin: 14px 0 7px;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
}

.preview-empty p {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.preview-actions {
  display: flex;
  padding: 14px 17px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}

.preview-actions .primary-button,
.preview-actions .secondary-button {
  min-height: 37px;
  padding: 0 12px;
  font-size: 11px;
}

.preview-help {
  display: grid;
  margin: 0;
  padding: 0 18px 16px;
  color: #8d9298;
  font-size: 9px;
  line-height: 1.6;
  gap: 5px;
}

.smtp-setup-link {
  width: fit-content;
  color: var(--gold-600);
  text-align: left;
}

.smtp-channel-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  color: #986b17;
  font-size: 10px;
  font-weight: 700;
  gap: 7px;
}

.smtp-channel-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c99636;
  box-shadow: 0 0 0 3px rgba(201, 150, 54, .13);
  flex: 0 0 auto;
}

.smtp-channel-status.ready {
  color: #2f7753;
}

.smtp-channel-status.ready i {
  background: #3e9168;
  box-shadow: 0 0 0 3px rgba(62, 145, 104, .14);
}

.smtp-channel-status.unavailable {
  color: #a04747;
}

.smtp-channel-status.unavailable i {
  background: #bc5b5b;
  box-shadow: 0 0 0 3px rgba(188, 91, 91, .12);
}

.smtp-channel-status.checking i {
  animation: smtp-pulse 1.2s ease-in-out infinite;
}

@keyframes smtp-pulse {
  50% {
    opacity: .35;
    transform: scale(.82);
  }
}

.history-panel {
  overflow: hidden;
}

.history-table td {
  height: 58px;
}

.mailbox-layout {
  display: grid;
  grid-template-columns: minmax(350px, .85fr) minmax(460px, 1.15fr);
  align-items: start;
  gap: 22px;
}

.mailbox-status-panel {
  overflow: hidden;
}

.mailbox-status-hero {
  display: flex;
  min-height: 206px;
  padding: 34px;
  align-items: center;
  gap: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 12%, rgba(198,161,91,.18), transparent 180px),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
}

.mailbox-status-hero h3 {
  margin-bottom: 9px;
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 22px;
  font-weight: 600;
}

.mailbox-status-hero > div > strong {
  display: block;
  margin-bottom: 15px;
  overflow-wrap: anywhere;
  color: var(--gold-300);
  font-size: 14px;
}

.mailbox-seal {
  display: grid;
  width: 74px;
  height: 74px;
  flex: 0 0 74px;
  border: 1px solid rgba(223,195,141,.62);
  border-radius: 50%;
  place-items: center;
  color: var(--gold-300);
  background: rgba(255,255,255,.04);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 26px;
}

.connection-badge {
  display: inline-flex;
  min-height: 27px;
  padding: 0 11px;
  border-radius: 14px;
  align-items: center;
  gap: 6px;
  color: #efe1bd;
  background: rgba(198,161,91,.14);
  font-size: 10px;
  font-weight: 700;
}

.connection-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}

.connection-badge.ready {
  color: #bde8d1;
  background: rgba(59,151,106,.18);
}

.connection-badge.unavailable {
  color: #f0c2bf;
  background: rgba(188,91,91,.16);
}

.connection-badge.checking::before {
  animation: smtp-pulse 1.2s ease-in-out infinite;
}

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

.mailbox-facts > div {
  min-height: 82px;
  padding: 18px 21px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mailbox-facts > div:nth-child(2n) {
  border-right: 0;
}

.mailbox-facts > div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.mailbox-facts span,
.mailbox-facts strong {
  display: block;
}

.mailbox-facts span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.mailbox-facts strong {
  overflow-wrap: anywhere;
  color: var(--navy-900);
  font-size: 12px;
}

.mailbox-form-panel {
  overflow: hidden;
}

.mailbox-form {
  padding: 24px 24px 8px;
}

.mailbox-actions {
  display: flex;
  margin-top: 4px;
  padding: 2px 0 17px;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.mailbox-actions .danger-text-button {
  margin-left: auto;
}

.security-callout {
  margin: 0 24px 24px;
  padding: 15px 17px;
  border: 1px solid var(--ivory-200);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius-sm);
  color: #59636e;
  background: var(--ivory-50);
}

.security-callout strong {
  display: block;
  margin-bottom: 5px;
  color: var(--navy-800);
  font-size: 11px;
}

.security-callout p {
  margin: 0;
  font-size: 10px;
  line-height: 1.7;
}

.user-management-layout {
  display: grid;
  grid-template-columns: minmax(340px, .72fr) minmax(620px, 1.28fr);
  align-items: start;
  gap: 22px;
}

.create-user-panel,
.user-list-panel {
  overflow: hidden;
}

.user-form {
  padding: 22px 22px 6px;
}

.domain-input {
  display: flex;
  width: 100%;
  min-height: 44px;
  border: 1px solid #dcd9d2;
  border-radius: var(--radius-sm);
  align-items: stretch;
  overflow: hidden;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}

.domain-input:focus-within {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(198,161,91,.12);
}

.field .domain-input input {
  min-width: 0;
  min-height: 42px;
  padding-right: 5px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.domain-input b {
  display: flex;
  padding: 0 12px 0 5px;
  align-items: center;
  color: var(--navy-700);
  background: var(--ivory-50);
  font-size: 11px;
  white-space: nowrap;
}

.user-active-field {
  margin-top: 20px;
}

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

.password-form-fields {
  padding-bottom: 7px;
}

.password-form-intro {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold-500);
  color: #59636e;
  background: var(--ivory-50);
  font-size: 11px;
  line-height: 1.7;
}

.password-form-fields .field:last-child {
  margin-bottom: 8px;
}

.users-table {
  min-width: 730px;
}

.users-table td {
  height: 68px;
}

.users-table .person-cell {
  min-width: 145px;
}

.danger-row-action {
  color: var(--danger);
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 22px;
}

.settings-layout .panel {
  padding-bottom: 6px;
}

.settings-layout .form-grid {
  padding: 22px;
}

.settings-actions {
  display: flex;
  padding: 0 22px 17px;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  display: flex;
  width: min(360px, calc(100vw - 30px));
  right: 18px;
  top: 18px;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  min-height: 55px;
  padding: 11px 14px;
  border: 1px solid rgba(198,161,91,.3);
  border-radius: var(--radius-sm);
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.45;
  animation: toast-in .2s ease both;
}

.toast > span:first-child {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.toast.error {
  border-color: rgba(163,67,67,.28);
}

.toast.error > span:first-child {
  background: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(7, 21, 36, .58);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(680px, calc(100vw - 30px));
  max-height: min(88vh, 860px);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 28px 80px rgba(7,21,36,.32);
}

.modal > form,
.modal > div {
  display: flex;
  max-height: min(88vh, 860px);
  flex-direction: column;
}

.modal-header {
  display: flex;
  min-height: 82px;
  padding: 19px 24px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.modal-header h2 {
  margin: 0;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 22px;
}

.modal-body {
  overflow-y: auto;
  padding: 22px 24px 8px;
}

.modal-error {
  margin: 0 24px 14px;
}

.modal-footer {
  display: flex;
  min-height: 70px;
  padding: 13px 24px;
  border-top: 1px solid var(--line);
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  background: #fbfaf7;
}

.detail-modal {
  width: min(740px, calc(100vw - 30px));
}

.detail-hero {
  min-height: 120px;
  border: 0;
  color: #fff;
  background:
    radial-gradient(circle at 80% 0%, rgba(198,161,91,.20), transparent 230px),
    var(--navy-900);
}

.detail-hero .person-cell strong {
  color: #fff;
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 21px;
}

.detail-hero .person-cell small {
  color: rgba(255,255,255,.58);
  font-size: 11px;
}

.detail-hero .avatar {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  font-size: 18px;
}

.detail-grid {
  display: grid;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.detail-item span,
.detail-item strong {
  display: block;
}

.detail-item span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}

.detail-item strong {
  overflow-wrap: anywhere;
  color: #34404d;
  font-size: 11px;
  font-weight: 600;
}

.detail-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border: 0;
}

.detail-section-heading {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-heading h3 {
  margin: 0;
  color: var(--navy-900);
  font-size: 13px;
}

.detail-section-heading span {
  color: var(--muted);
  font-size: 9px;
}

.status-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status-choice {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #dedbd4;
  border-radius: 17px;
  color: #53606d;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.status-choice:hover {
  border-color: var(--gold-500);
}

.status-choice.current {
  border-color: var(--navy-800);
  color: #fff;
  background: var(--navy-800);
}

.notes-box {
  min-height: 55px;
  margin: 0;
  padding: 12px;
  border-left: 3px solid var(--gold-300);
  color: #59636e;
  background: var(--ivory-50);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.timeline {
  position: relative;
  display: flex;
  padding-left: 17px;
  flex-direction: column;
}

.timeline::before {
  position: absolute;
  width: 1px;
  left: 4px;
  top: 7px;
  bottom: 8px;
  content: "";
  background: #ddd8cc;
}

.timeline-item {
  position: relative;
  padding: 0 0 17px 8px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  position: absolute;
  width: 7px;
  height: 7px;
  left: -16px;
  top: 5px;
  border: 2px solid #fff;
  border-radius: 50%;
  content: "";
  background: var(--gold-500);
  box-shadow: 0 0 0 1px var(--gold-300);
}

.timeline-item strong {
  display: block;
  margin-bottom: 3px;
  color: #3c4651;
  font-size: 10px;
}

.timeline-item small {
  color: var(--muted);
  font-size: 9px;
}

.split-footer {
  justify-content: space-between;
}

.split-footer > div {
  display: flex;
  gap: 8px;
}

.confirm-dialog {
  width: min(420px, calc(100vw - 30px));
  padding: 30px 28px 0;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 28px 80px rgba(7,21,36,.32);
}

.confirm-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 16px;
  border-radius: 50%;
  place-items: center;
  color: var(--danger);
  background: #faeaea;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 800;
}

.confirm-dialog h2 {
  margin-bottom: 9px;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
}

.confirm-dialog p {
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.confirm-dialog .modal-footer {
  margin: 0 -28px;
}

.sidebar-scrim {
  position: fixed;
  z-index: 25;
  inset: 0;
  background: rgba(7,21,36,.55);
}

@media (min-width: 921px) and (max-width: 1500px) {
  .login-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(400px, .85fr);
  }

  .login-brand {
    padding: clamp(46px, 5vw, 68px);
  }

  .login-brand h1 {
    max-width: 610px;
    font-size: clamp(40px, 3.55vw, 48px);
    line-height: 1.3;
    letter-spacing: .02em;
    white-space: nowrap;
  }

  .login-intro {
    max-width: 590px;
  }
}

@media (max-width: 1120px) {
  :root {
    --sidebar-width: 224px;
  }

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

  .overview-grid,
  .settings-layout,
  .mailbox-layout,
  .user-management-layout {
    grid-template-columns: 1fr;
  }

  .email-layout {
    grid-template-columns: minmax(360px, .8fr) minmax(450px, 1.2fr);
  }

  .data-table th,
  .data-table td {
    padding-right: 13px;
    padding-left: 13px;
  }
}

@media (max-width: 920px) {
  .login-shell {
    grid-template-columns: minmax(360px, .95fr) minmax(360px, 1.05fr);
  }

  .login-brand {
    padding: 36px;
  }

  .login-brand h1 {
    font-size: 34px;
    line-height: 1.3;
    letter-spacing: .015em;
    white-space: nowrap;
  }

  .login-panel {
    padding: 24px;
  }

  .login-card {
    padding: 34px;
  }

  .sidebar {
    width: min(290px, 82vw);
    transform: translateX(-102%);
    transition: transform .22s ease;
  }

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

  .workspace {
    margin-left: 0;
  }

  .menu-button {
    display: inline-grid;
  }

  .email-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .login-shell {
    display: block;
    background:
      linear-gradient(rgba(11,31,51,.94), rgba(11,31,51,.94)),
      linear-gradient(135deg, rgba(255,255,255,.06) 25%, transparent 25%) 0 0 / 34px 34px;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 20px;
  }

  .login-card {
    padding: 34px 26px;
  }

  .mobile-brand {
    display: flex;
  }

  .topbar {
    height: 74px;
    padding: 0 16px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar .eyebrow {
    font-size: 8px;
  }

  .today {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-actions .primary-button {
    width: 40px;
    min-height: 40px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .topbar-actions .primary-button > span {
    font-size: 20px;
  }

  .view-stack {
    padding: 20px 14px 44px;
  }

  .welcome-strip {
    min-height: 220px;
    padding: 28px 23px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 22px;
  }

  .welcome-strip h2 {
    font-size: 24px;
  }

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

  .stat-card {
    min-height: 126px;
    padding: 17px;
  }

  .stat-card strong {
    font-size: 29px;
  }

  .overview-grid {
    gap: 14px;
  }

  .panel-header {
    padding-right: 17px;
    padding-left: 17px;
  }

  .recent-list {
    padding-right: 17px;
    padding-left: 17px;
  }

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

  .recent-role {
    display: none;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions > * {
    flex: 1;
  }

  .filter-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
    max-width: none;
    flex-basis: 100%;
  }

  .select-field {
    flex: 1;
  }

  .select-field select {
    width: 100%;
  }

  .table-panel .table-wrap {
    overflow: visible;
  }

  .table-panel .data-table,
  .table-panel .data-table tbody,
  .table-panel .data-table tr,
  .table-panel .data-table td {
    display: block;
    width: 100%;
  }

  .table-panel .data-table thead {
    display: none;
  }

  .table-panel .data-table tbody {
    padding: 4px 14px;
  }

  .table-panel .data-table tr {
    position: relative;
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
  }

  .table-panel .data-table td {
    height: auto;
    padding: 4px 0;
    border: 0;
  }

  .table-panel .data-table td:nth-child(2) {
    color: var(--navy-700);
    font-size: 11px;
  }

  .table-panel .data-table td:nth-child(3) {
    position: static;
    width: auto;
    margin-top: 7px;
  }

  .candidate-status-picker,
  .candidate-status-select {
    max-width: 100%;
  }

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

  .table-panel .data-table td:nth-child(4),
  .table-panel .data-table td:nth-child(5) {
    display: none;
  }

  .table-panel .data-table td:last-child {
    margin-top: 6px;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .email-editor {
    padding: 20px 17px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .preview-toolbar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .device-frame {
    min-height: 430px;
    padding: 8px;
  }

  .device-frame iframe {
    height: 520px;
  }

  .preview-empty {
    inset: 8px;
  }

  .preview-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

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

  .history-panel .table-wrap {
    max-width: 100%;
  }

  .history-table {
    min-width: 650px;
  }

  .mailbox-status-hero {
    min-height: 180px;
    padding: 28px 23px;
  }

  .mailbox-form {
    padding-right: 18px;
    padding-left: 18px;
  }

  .security-callout {
    margin-right: 18px;
    margin-left: 18px;
  }

  .user-form {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .modal > form,
  .modal > div {
    max-height: calc(100vh - 20px);
  }

  .modal-header,
  .modal-footer {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-body {
    padding-right: 18px;
    padding-left: 18px;
  }

  .modal-error {
    margin-right: 18px;
    margin-left: 18px;
  }

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

  .split-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .split-footer > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 410px) {
  .login-panel {
    padding: 13px;
  }

  .login-card {
    padding: 30px 21px;
  }

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

  .stat-label {
    font-size: 10px;
  }

  .stat-card small {
    display: none;
  }

  .template-tabs {
    gap: 5px;
  }

  .template-tab {
    padding: 7px 6px;
  }

  .mailbox-status-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .mailbox-facts {
    grid-template-columns: 1fr;
  }

  .mailbox-facts > div {
    border-right: 0;
  }

  .mailbox-facts > div:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .mailbox-facts > div:last-child {
    border-bottom: 0;
  }

  .mailbox-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mailbox-actions .danger-text-button {
    min-height: 36px;
    margin-left: 0;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Company management: people and attendance */
.people-summary {
  display: grid;
  margin-bottom: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.people-summary-card,
.attendance-stat {
  position: relative;
  min-height: 116px;
  padding: 20px 21px;
  border: 1px solid rgba(228,225,217,.9);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,.94);
  box-shadow: 0 4px 16px rgba(7,21,36,.035);
}

.people-summary-card::after,
.attendance-stat::after {
  position: absolute;
  width: 4px;
  height: 34px;
  right: 0;
  top: 20px;
  border-radius: 4px 0 0 4px;
  content: "";
  background: var(--gold-500);
}

.people-summary-card:nth-child(2)::after,
.attendance-stat:nth-child(2)::after {
  background: var(--success);
}

.people-summary-card:nth-child(3)::after,
.attendance-stat:nth-child(3)::after {
  background: var(--blue-500);
}

.people-summary-card > span,
.attendance-stat > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.people-summary-card > strong,
.attendance-stat > strong {
  display: block;
  margin: 9px 0 5px;
  color: var(--navy-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
}

.people-summary-card > small,
.attendance-stat > small {
  color: #999fa5;
  font-size: 9px;
}

.employee-toolbar {
  display: flex;
  min-height: 70px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  gap: 12px;
}

.employees-table {
  min-width: 960px;
}

.employees-table td {
  height: 72px;
}

.table-primary,
.table-secondary {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-primary {
  margin-bottom: 4px;
  color: var(--navy-800);
  font-size: 11px;
}

.table-secondary {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.content-state {
  display: grid;
  min-height: 150px;
  padding: 28px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.content-state::before,
.mini-loading::before {
  width: 19px;
  height: 19px;
  border: 2px solid var(--ivory-200);
  border-top-color: var(--gold-500);
  border-radius: 50%;
  content: "";
  animation: management-spin .75s linear infinite;
}

.content-state.error-state {
  color: var(--danger);
}

.content-state.error-state::before {
  display: grid;
  width: 26px;
  height: 26px;
  border: 0;
  place-items: center;
  content: "!";
  animation: none;
  color: #fff;
  background: var(--danger);
}

.content-state.error-state span {
  color: var(--muted);
}

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

.employee-row-actions {
  min-width: 126px;
}

.emphasized-row-action {
  color: var(--gold-600);
}

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

.employee-form-grid {
  padding-bottom: 20px;
}

.employee-email-dialog {
  width: min(650px, calc(100vw - 30px));
}

.employee-email-body {
  display: grid;
  gap: 14px;
  padding-bottom: 24px;
}

.employee-email-body .selected-person {
  margin-bottom: 2px;
}

.employee-email-body textarea {
  min-height: 230px;
  line-height: 1.75;
  resize: vertical;
}

.employee-email-dialog .modal-footer .save-status {
  margin-right: auto;
  text-align: left;
}

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

.month-picker {
  display: grid;
  min-width: 178px;
  gap: 6px;
}

.month-picker span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.month-picker input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #dcd9d2;
  border-radius: var(--radius-sm);
  color: var(--navy-900);
  background: #fff;
}

.attendance-today-grid {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: minmax(360px, .95fr) minmax(430px, 1.05fr);
  gap: 18px;
}

.attendance-clock-card {
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0, rgba(198,161,91,.24), transparent 210px),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
}

.clock-face {
  min-height: 188px;
  padding: 27px 29px 21px;
}

.clock-face p {
  margin-bottom: 12px;
  color: rgba(255,255,255,.58);
  font-size: 11px;
}

.clock-face > strong {
  display: block;
  margin-bottom: 17px;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 4vw, 54px);
  font-weight: 400;
  letter-spacing: .04em;
}

.attendance-status {
  display: inline-flex;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 15px;
  align-items: center;
  color: #f0d8a8;
  background: rgba(198,161,91,.15);
  font-size: 10px;
  font-weight: 700;
}

.attendance-status::before {
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  content: "";
  background: currentColor;
}

.attendance-status.working {
  color: #bde8d1;
  background: rgba(59,151,106,.18);
}

.attendance-status.completed {
  color: #d4e2ee;
  background: rgba(108,151,186,.16);
}

.attendance-status.unavailable {
  color: #f0c2bf;
  background: rgba(188,91,91,.16);
}

.clock-actions {
  display: grid;
  padding: 0 29px 15px;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.clock-actions .attendance-action {
  min-height: 44px;
}

.attendance-clock-card .secondary-button {
  border-color: rgba(255,255,255,.22);
  color: #fff;
  background: rgba(255,255,255,.06);
}

.attendance-clock-card .form-error {
  margin: 0 29px 10px;
  color: #ffd2ce;
}

.attendance-tip {
  margin: 0;
  padding: 0 29px 20px;
  color: rgba(255,255,255,.4);
  font-size: 9px;
}

.today-timeline-card {
  overflow: hidden;
}

.mini-loading {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  gap: 9px;
}

.today-attendance-facts {
  display: grid;
  min-height: 180px;
  grid-template-columns: 1fr 1fr;
}

.today-attendance-facts > div {
  display: flex;
  min-height: 85px;
  padding: 20px 23px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  flex-direction: column;
  justify-content: center;
}

.today-attendance-facts > div:nth-child(2) {
  border-right: 0;
}

.today-attendance-facts .today-duration {
  min-height: 95px;
  border-right: 0;
  border-bottom: 0;
  grid-column: 1 / -1;
}

.today-attendance-facts span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.today-attendance-facts strong {
  color: var(--navy-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
}

.today-attendance-facts .today-duration strong {
  color: var(--gold-600);
  font-size: 28px;
}

.attendance-stat-grid {
  display: grid;
  margin-bottom: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.attendance-stat {
  min-height: 112px;
}

.attendance-stat:nth-child(4)::after {
  background: var(--warning);
}

.attendance-policy-note {
  margin: 0 2px 20px;
  color: #858d95;
  font-size: 9px;
  line-height: 1.7;
}

.attendance-policy-note span {
  display: block;
  margin-top: 3px;
  color: var(--warning);
}

.attendance-summary-source-note {
  margin: -5px 0 14px;
  padding: 9px 12px;
  border-left: 3px solid var(--gold-500);
  color: #75613e;
  background: rgba(198,161,91,.09);
  font-size: 9px;
  line-height: 1.6;
}

.attendance-records-panel {
  margin-bottom: 28px;
  overflow: hidden;
}

.attendance-records-table {
  min-width: 650px;
}

.attendance-records-table td {
  height: 57px;
}

.section-divider-heading {
  display: flex;
  margin: 7px 0 15px;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-divider-heading h2 {
  margin: 0;
  color: var(--navy-900);
  font-family: "STSong", "Songti SC", SimSun, serif;
  font-size: 23px;
}

.section-divider-heading > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.attendance-insights-grid {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
  gap: 18px;
}

.attendance-chart-panel,
.attendance-ranking-panel,
.attendance-team-table-panel,
.attendance-raw-panel {
  overflow: hidden;
}

.attendance-bar-chart {
  display: flex;
  min-height: 280px;
  padding: 24px 20px 17px;
  align-items: stretch;
  gap: clamp(3px, .55vw, 8px);
  overflow-x: auto;
}

.attendance-bar-column {
  display: grid;
  min-width: 20px;
  flex: 1 0 20px;
  grid-template-rows: 22px 1fr 18px;
  justify-items: center;
  gap: 5px;
}

.attendance-bar-value {
  opacity: 0;
  color: var(--navy-700);
  font-size: 8px;
  white-space: nowrap;
  transition: opacity .16s;
}

.attendance-bar-column:hover .attendance-bar-value,
.attendance-bar-column:focus-visible .attendance-bar-value {
  opacity: 1;
}

.attendance-bar-track {
  position: relative;
  display: block;
  width: min(19px, 72%);
  min-height: 190px;
  border-radius: 5px;
  background: #f1eee7;
}

.attendance-bar {
  position: absolute;
  height: var(--bar-height);
  inset: auto 0 0;
  display: block;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--gold-300), var(--gold-600));
  transition: height .25s ease;
}

.attendance-bar-column small {
  color: var(--muted);
  font-size: 8px;
}

.attendance-ranking {
  min-height: 280px;
  margin: 0;
  padding: 13px 20px 18px;
  list-style: none;
}

.hours-review-note {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.attendance-ranking li {
  display: grid;
  min-height: 54px;
  border-bottom: 1px solid #efede7;
  grid-template-columns: 24px minmax(90px, .8fr) minmax(70px, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.attendance-ranking li:last-child {
  border-bottom: 0;
}

.ranking-number {
  color: var(--gold-600);
  font-family: Georgia, serif;
  font-size: 16px;
}

.ranking-person {
  min-width: 0;
}

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

.ranking-person strong {
  margin-bottom: 3px;
  color: var(--navy-900);
  font-size: 10px;
}

.ranking-person small {
  color: var(--muted);
  font-size: 8px;
}

.ranking-meter {
  position: relative;
  display: block;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: #eeeae1;
}

.ranking-meter i {
  position: absolute;
  width: var(--ranking-width);
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--gold-500);
}

.ranking-hours {
  color: var(--navy-700);
  font-size: 10px;
  white-space: nowrap;
}

.attendance-team-table {
  min-width: 850px;
}

.attendance-team-table td {
  height: 66px;
}

.attendance-raw-panel {
  margin-top: 18px;
}

.attendance-record-filter select {
  min-height: 36px;
  padding: 0 32px 0 11px;
  border: 1px solid #dcd9d2;
  border-radius: var(--radius-sm);
  color: var(--navy-800);
  background: #fff;
  font-size: 10px;
}

.attendance-audit-note {
  margin: 0;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line);
  color: #75613e;
  background: rgba(198,161,91,.08);
  font-size: 9px;
  line-height: 1.65;
}

.attendance-raw-table {
  min-width: 900px;
}

.attendance-raw-table td {
  height: 64px;
}

.attendance-exception-row {
  background: rgba(198,161,91,.055);
}

.attendance-exception-row td:first-child {
  box-shadow: inset 3px 0 var(--gold-500);
}

.attendance-adjust-dialog {
  width: min(680px, calc(100vw - 30px));
}

.attendance-adjust-body {
  display: grid;
  gap: 20px;
  padding-bottom: 23px;
}

.attendance-adjust-record {
  display: flex;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  align-items: center;
  gap: 11px;
  background: var(--ivory-50);
}

.attendance-adjust-record > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.attendance-adjust-record strong,
.attendance-adjust-record small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendance-adjust-record strong {
  margin-bottom: 5px;
  color: var(--navy-900);
  font-size: 12px;
}

.attendance-adjust-record small {
  color: var(--muted);
  font-size: 9px;
}

.attendance-adjust-audit {
  padding: 13px 15px;
  border-left: 3px solid var(--gold-500);
  color: #6b655a;
  background: rgba(198,161,91,.08);
}

.attendance-adjust-audit strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy-800);
  font-size: 10px;
}

.attendance-adjust-audit p {
  margin: 0;
  font-size: 9px;
  line-height: 1.7;
}

@media (max-width: 1120px) {
  .attendance-today-grid,
  .attendance-insights-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .people-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .people-summary-card:last-child {
    grid-column: 1 / -1;
  }

  .employee-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .employee-toolbar .search-box {
    flex-basis: 100%;
  }

  .attendance-heading {
    align-items: stretch;
  }

  .month-picker {
    width: 100%;
  }

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

  .clock-face {
    padding: 25px 22px 19px;
  }

  .clock-face > strong {
    font-size: 38px;
  }

  .clock-actions {
    padding-right: 22px;
    padding-left: 22px;
  }

  .attendance-clock-card .form-error,
  .attendance-tip {
    margin-right: 22px;
    margin-left: 22px;
  }

  .attendance-tip {
    padding-right: 0;
    padding-left: 0;
  }

  .attendance-stat-grid {
    gap: 9px;
  }

  .attendance-stat {
    min-height: 105px;
    padding: 17px;
  }

  .attendance-stat > strong {
    font-size: 24px;
  }

  .attendance-bar-chart {
    min-height: 250px;
  }

  .employee-email-dialog .modal-footer {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .employee-email-dialog .modal-footer .save-status {
    width: 100%;
  }

  .attendance-record-filter {
    width: 100%;
  }

  .attendance-record-filter select {
    width: 100%;
  }

  .attendance-adjust-record {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .attendance-adjust-record .status-badge {
    margin-left: 49px;
  }
}

@media (max-width: 410px) {
  .people-summary {
    grid-template-columns: 1fr;
  }

  .people-summary-card:last-child {
    grid-column: auto;
  }

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

  .attendance-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .attendance-stat > small {
    display: none;
  }

  .attendance-ranking li {
    grid-template-columns: 22px minmax(90px, 1fr) auto;
  }

  .ranking-meter {
    display: none;
  }
}
