:root {
  --ink: #17231e;
  --ink-soft: #5f6d66;
  --line: #dde4df;
  --line-strong: #c7d1ca;
  --canvas: #f3f5f2;
  --surface: #ffffff;
  --sidebar: #122820;
  --sidebar-soft: #1d3a2f;
  --accent: #0f7a55;
  --accent-dark: #095f42;
  --accent-soft: #e7f4ee;
  --warning: #9a5b08;
  --warning-soft: #fff4df;
  --danger: #a33737;
  --danger-soft: #fbecec;
  --info: #245c8a;
  --shadow: 0 20px 60px rgba(20, 33, 27, 0.18);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

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

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: #b8d7ca;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: 36px;
  place-items: center;
  overflow: hidden;
  background: #0e1d17;
}

.login-backdrop,
.login-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.login-backdrop {
  object-fit: cover;
  object-position: center;
}

.login-shade {
  background: rgba(7, 21, 15, 0.35);
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  margin-left: clamp(0px, 46vw, 700px);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

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

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

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 25px;
  font-weight: 800;
  place-items: center;
}

.brand-mark.compact {
  width: 38px;
  height: 38px;
  font-size: 19px;
}

.login-brand h1,
.password-panel h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.login-intro {
  margin: 18px 0 24px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field-label {
  color: #34483e;
  font-size: 13px;
  font-weight: 700;
}

.captcha-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.captcha-row .captcha-image {
  width: 136px;
  height: 46px;
  flex: 0 0 136px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #f2f6f3;
}

.captcha-row input {
  min-width: 110px;
  flex: 1 1 110px;
  text-transform: uppercase;
}

.captcha-row .button {
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 122, 85, 0.13);
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.button:hover {
  border-color: #9bac9f;
  background: #f5f8f6;
}

.button.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button.danger {
  border-color: #d9a8a8;
  color: var(--danger);
  background: var(--danger-soft);
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button-row.end {
  justify-content: flex-end;
}

.form-message {
  margin: 0;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
}

.form-message.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.form-message.success {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.login-security {
  margin: 18px 0 0;
  color: #748078;
  font-size: 12px;
  line-height: 1.65;
}

.password-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  background: #eef2ee;
  place-items: center;
}

.password-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 34, 25, 0.9);
}

.password-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  padding: 30px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.password-panel .eyebrow {
  color: var(--accent);
}

.password-panel .muted {
  margin: 10px 0 22px;
}

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

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 22px;
}

.sidebar-brand div {
  display: grid;
}

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

.sidebar-brand span {
  color: #95aa9f;
  font-size: 11px;
}

.main-nav {
  display: grid;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #c9d8d0;
  background: transparent;
  text-align: left;
}

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

.nav-item.active {
  color: #fff;
  background: var(--sidebar-soft);
  box-shadow: inset 3px 0 0 #67c89e;
}

.nav-index {
  width: 22px;
  color: #719486;
  font-size: 10px;
  font-weight: 700;
}

.nav-item.active .nav-index {
  color: #78cfaa;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 18px 9px 0;
  color: #91a69b;
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #57c58e;
  box-shadow: 0 0 0 4px rgba(87, 197, 142, 0.12);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 80px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.topbar-kicker {
  margin: 0 0 2px;
  color: #7d8a83;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.live-calendar {
  display: grid;
  min-width: 138px;
  gap: 4px;
  margin-left: auto;
  padding: 8px 11px;
  border: 1px solid #d9e4dc;
  border-radius: 8px;
  color: #193a2b;
  background: #f5f9f6;
  font-variant-numeric: tabular-nums;
  justify-items: end;
}

.live-calendar-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #65776d;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.live-calendar-time {
  font-size: 20px;
  line-height: 1;
}

.admin-menu,
.admin-identity {
  display: flex;
  align-items: center;
}

.admin-menu {
  gap: 14px;
}

.admin-identity {
  flex-direction: column;
  align-items: flex-end;
}

.admin-identity span {
  font-weight: 700;
}

.admin-identity small {
  color: var(--ink-soft);
}

.view-host {
  padding: 24px 28px 40px;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.view-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.view-head p {
  max-width: 760px;
  margin: 0;
  color: var(--ink-soft);
}

.section {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 12px;
}

.section-body {
  padding: 16px;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #ead5af;
  border-left: 4px solid #c78722;
  border-radius: 6px;
  color: #65430f;
  background: var(--warning-soft);
  line-height: 1.65;
}

.notice.info {
  border-color: #bed5e7;
  border-left-color: var(--info);
  color: #244b69;
  background: #edf5fb;
}

.notice.danger {
  border-color: #e2bcbc;
  border-left-color: var(--danger);
  color: #722828;
  background: var(--danger-soft);
}

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

.metric {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.metric-value {
  display: block;
  overflow: hidden;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.metric-note {
  display: block;
  margin-top: 6px;
  color: #89938d;
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 18px;
}

.trend-list,
.reason-list {
  display: grid;
  gap: 11px;
}

.trend-row {
  display: grid;
  align-items: center;
  gap: 10px;
  grid-template-columns: 82px minmax(120px, 1fr) 120px;
}

.trend-date,
.trend-value {
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trend-value {
  text-align: right;
}

.trend-bars {
  display: grid;
  gap: 3px;
}

.trend-bar,
.reason-bar {
  height: 6px;
  min-width: 1px;
  border-radius: 2px;
  background: var(--accent);
}

.trend-bar.out {
  background: #c06b45;
}

.reason-row {
  display: grid;
  gap: 7px;
}

.reason-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.reason-track {
  height: 7px;
  border-radius: 2px;
  background: #edf1ee;
}

.filter-bar {
  display: grid;
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
}

.filter-bar.compact {
  grid-template-columns: minmax(220px, 1.5fr) minmax(120px, 0.6fr) auto;
}

.filter-bar.record-filter {
  grid-template-columns:
    minmax(210px, 0.8fr)
    minmax(220px, 1.3fr)
    minmax(130px, 0.55fr)
    auto;
}

.filter-bar .field {
  gap: 5px;
}

.record-mode-field {
  min-width: 0;
}

.segmented-control {
  display: grid;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f6f4;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-control button {
  min-width: 0;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.segmented-control button.active {
  color: #fff;
  background: var(--accent-dark);
  box-shadow: 0 2px 7px rgba(20, 65, 46, 0.18);
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  color: var(--ink-soft);
  font-size: 12px;
}

.summary-strip strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 13px;
  border-bottom: 1px solid #edf0ee;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: #65736c;
  background: #f8faf8;
  font-size: 12px;
  font-weight: 700;
}

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

tr.clickable {
  cursor: pointer;
}

td.wrap {
  min-width: 220px;
  white-space: normal;
}

.mono,
.number {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.number {
  text-align: right;
}

.amount-in {
  color: var(--accent-dark);
  font-weight: 700;
}

.amount-out {
  color: var(--danger);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  color: #47564e;
  background: #edf1ee;
  font-size: 11px;
  font-weight: 700;
}

.badge.success {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.badge.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.info {
  color: var(--info);
  background: #edf5fb;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

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

.pagination-current {
  min-width: 72px;
  text-align: center;
}

.empty-state {
  padding: 48px 20px;
  color: var(--ink-soft);
  text-align: center;
}

.loading-state {
  display: grid;
  min-height: 280px;
  color: var(--ink-soft);
  place-items: center;
}

.error-state {
  padding: 22px;
  border: 1px solid #e2bcbc;
  border-radius: var(--radius);
  color: var(--danger);
  background: var(--danger-soft);
}

.inline-form {
  display: grid;
  gap: 12px;
}

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

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

.form-grid .full {
  grid-column: 1 / -1;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-weight: 700;
}

.checkbox-label input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.toggle-copy {
  max-width: 680px;
}

.toggle-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.toggle-copy p {
  margin: 0;
  color: var(--ink-soft);
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  cursor: pointer;
  background: #b9c3bd;
  transition: background 0.16s ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 0.16s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(22px);
}

.assist-schedule {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.schedule-pick {
  display: grid;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.schedule-pick span,
.schedule-pick small {
  color: var(--ink-soft);
  font-size: 11px;
}

.schedule-pick strong {
  margin: 3px 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.schedule-pick.is-active {
  border-color: var(--accent);
  background: #f2f9f5;
  box-shadow: 0 0 0 2px rgba(15, 122, 85, 0.1);
}

.schedule-pick:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.assist-calendar {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.assist-calendar-toolbar {
  display: grid;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  text-align: center;
}

.assist-calendar-toolbar strong,
.assist-calendar-toolbar small {
  display: block;
}

.assist-calendar-toolbar strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.assist-calendar-toolbar small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.calendar-nav {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  font-size: 22px;
  line-height: 1;
  place-items: center;
}

.calendar-nav:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.assist-calendar-weekdays,
.assist-calendar-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.assist-calendar-weekdays {
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
}

.calendar-blank,
.calendar-day {
  min-width: 0;
  min-height: 34px;
}

.calendar-day {
  position: relative;
  display: grid;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  place-items: center;
}

.calendar-day:hover:not(:disabled) {
  border-color: var(--accent);
}

.calendar-day.is-today {
  border-color: #9ab8a9;
}

.calendar-day.is-selected {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.calendar-day.is-start::after,
.calendar-day.is-expiry::after {
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.calendar-day.is-start::after {
  left: calc(50% - 6px);
}

.calendar-day.is-expiry::after {
  right: calc(50% - 6px);
}

.calendar-day.is-selected::after {
  background: #fff;
}

.calendar-day:disabled {
  cursor: not-allowed;
  color: #a8b1ac;
  background: #f4f6f5;
}

.calendar-day:disabled::after {
  opacity: 0.35;
}

.schedule-time-row {
  display: grid;
  align-items: end;
  gap: 10px;
  grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1fr);
}

.schedule-quick {
  display: grid;
  gap: 6px;
}

.schedule-quick > span {
  color: #34483e;
  font-size: 13px;
  font-weight: 700;
}

.schedule-quick > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schedule-preview {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  background: #f5faf7;
  font-size: 12px;
  line-height: 1.55;
}

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

.snapshot-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.snapshot-item span {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
}

.snapshot-item strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

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

.compare-side {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compare-side h4 {
  margin: 0 0 10px;
  font-size: 13px;
}

.compare-side dl,
.detail-list {
  display: grid;
  margin: 0;
  gap: 9px;
  grid-template-columns: minmax(90px, 0.4fr) minmax(0, 1fr);
}

.compare-side dt,
.detail-list dt {
  color: var(--ink-soft);
}

.compare-side dd,
.detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-list {
  grid-template-columns: 110px minmax(0, 1fr);
}

.details-stack {
  display: grid;
  gap: 14px;
}

.subpanel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.subpanel h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.credential-actions {
  margin-top: 12px;
}

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

.credential-row input {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.danger-zone {
  border-color: #e4bcbc;
  background: #fffafa;
}

.identity-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.identity-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfa;
}

.identity-item strong {
  display: block;
  margin-bottom: 3px;
}

.identity-item code {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
}

.layer {
  position: fixed;
  z-index: 80;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
}

.layer-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(10, 20, 15, 0.46);
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(640px, 94%);
  height: 100%;
  overflow-y: auto;
  padding: 22px;
  background: #fff;
  box-shadow: -18px 0 50px rgba(11, 25, 18, 0.22);
}

.drawer.player-detail {
  width: min(960px, 100%);
  padding: 24px 26px;
  overflow-x: hidden;
}

.player-detail .details-stack,
.player-detail .subpanel,
.player-detail .inline-form,
.player-detail .form-grid,
.player-detail .toggle-row,
.player-detail .identity-item {
  min-width: 0;
}

.player-detail .drawer-head > div,
.player-detail .snapshot-item,
.player-detail .snapshot-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.player-detail .table-wrap {
  overflow-x: visible;
}

.player-detail .player-membership-table {
  min-width: 0;
  table-layout: fixed;
}

.player-detail .player-membership-table th,
.player-detail .player-membership-table td {
  padding: 10px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.drawer.record-detail {
  width: min(780px, 100%);
  padding: 24px 26px;
  overflow-x: hidden;
}

.record-detail .details-stack,
.record-detail .subpanel,
.record-detail .detail-list {
  min-width: 0;
}

.record-stat-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-stat {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfa;
}

.record-stat span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 11px;
}

.record-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.record-player-list {
  display: grid;
  gap: 8px;
}

.record-player {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  grid-template-columns: minmax(150px, 0.85fr) minmax(180px, 1.35fr) auto;
}

.record-player.is-target {
  border-color: #8eb8a4;
  background: #f5faf7;
}

.record-player-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.record-player-identity > div {
  min-width: 0;
}

.record-player-identity strong,
.record-player-identity small {
  display: block;
  overflow-wrap: anywhere;
}

.record-player-identity small {
  color: var(--ink-soft);
}

.record-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--accent-dark);
  background: #e3f0e8;
  font-size: 13px;
  font-weight: 800;
  place-items: center;
}

.record-player-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.record-player-score {
  min-width: 74px;
  text-align: right;
}

.record-player-score strong,
.record-player-score small {
  display: block;
  font-variant-numeric: tabular-nums;
}

.record-player-score small {
  margin-top: 2px;
  color: var(--ink-soft);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.drawer-head > .icon-button {
  position: relative;
  z-index: 2;
}

.drawer-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.drawer-head p {
  margin: 0;
  color: var(--ink-soft);
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  place-items: center;
}

.modal-layer {
  display: grid;
  padding: 22px;
  place-items: center;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 22px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.modal-panel > p {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

.toast {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  max-width: min(400px, calc(100vw - 44px));
  padding: 12px 15px;
  border-radius: 6px;
  color: #fff;
  background: #1c3328;
  box-shadow: 0 12px 36px rgba(12, 30, 21, 0.25);
}

.toast.error {
  background: #8c3030;
}

.stat-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--ink-soft);
  font-size: 12px;
}

.stat-inline strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

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

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

  .filter-bar,
  .filter-bar.record-filter {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

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

@media (max-width: 900px) {
  .login-view {
    padding: 20px;
    align-items: end;
  }

  .login-panel {
    width: 100%;
    margin-left: 0;
    padding: 25px;
  }

  .login-intro {
    margin: 14px 0 20px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px;
  }

  .sidebar-brand {
    padding: 0 2px 12px;
  }

  .main-nav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .nav-item {
    min-width: max-content;
    min-height: 36px;
    padding: 7px 10px;
  }

  .nav-index,
  .sidebar-footer {
    display: none;
  }

  .topbar {
    min-height: 66px;
    padding: 10px 16px;
  }

  .topbar-kicker {
    display: none;
  }

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

  .admin-identity {
    display: none;
  }

  .admin-menu {
    gap: 8px;
  }

  .live-calendar {
    min-width: 116px;
    padding: 7px 9px;
  }

  .live-calendar-time {
    font-size: 18px;
  }

  .view-host {
    padding: 16px 14px 30px;
  }

  .view-head {
    display: grid;
  }

  .metric-grid {
    gap: 9px;
  }

  .metric {
    padding: 13px;
  }

  .metric-value {
    font-size: 21px;
  }

  .form-grid,
  .form-grid.three,
  .compare-snapshot {
    grid-template-columns: 1fr;
  }

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

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

  .filter-bar,
  .filter-bar.compact,
  .filter-bar.record-filter {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    grid-column: auto;
  }

  .drawer {
    width: 100%;
    max-width: none;
  }

  .drawer.player-detail {
    width: 100%;
    padding: 20px;
  }

  .drawer.record-detail {
    width: 100%;
    padding: 20px;
  }

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

@media (max-width: 540px) {
  .topbar {
    gap: 10px;
  }

  .live-calendar {
    min-width: 72px;
    padding: 6px 8px;
  }

  .live-calendar-meta {
    font-size: 10px;
  }

  .live-calendar-meta span:last-child {
    display: none;
  }

  .live-calendar-time {
    font-size: 16px;
  }

  .login-view {
    min-height: 100svh;
    padding: 12px;
  }

  .login-panel {
    padding: 22px 18px;
  }

  .login-brand h1 {
    font-size: 22px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

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

  .calendar-blank,
  .calendar-day {
    min-height: 36px;
  }

  .metric-grid,
  .snapshot-grid {
    grid-template-columns: 1fr;
  }

  .trend-row {
    grid-template-columns: 72px minmax(80px, 1fr);
  }

  .trend-value {
    grid-column: 2;
    text-align: left;
  }

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

  .toggle-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .drawer.player-detail {
    padding: 16px 12px;
  }

  .drawer.record-detail {
    padding: 16px 12px;
  }

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

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

  .record-player-meta {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .player-detail .player-membership-table,
  .player-detail .player-membership-table tbody,
  .player-detail .player-membership-table tr,
  .player-detail .player-membership-table td {
    display: block;
    width: 100%;
  }

  .player-detail .player-membership-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .player-detail .player-membership-table tr {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
  }

  .player-detail .player-membership-table tr:last-child {
    border-bottom: 0;
  }

  .player-detail .player-membership-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }

  .player-detail .player-membership-table td::before {
    flex: 0 0 auto;
    color: var(--ink-soft);
    content: attr(data-label);
    text-align: left;
  }
}
