:root {
  --navy-950: #03162f;
  --navy-900: #06234a;
  --navy-800: #0a3267;
  --blue-700: #0b57d0;
  --blue-600: #1265e8;
  --blue-500: #2474f0;
  --blue-50: #eef5ff;
  --green-700: #14813f;
  --green-50: #eaf8ef;
  --red-700: #c73737;
  --red-50: #fff0f0;
  --amber-700: #a76108;
  --amber-50: #fff7e7;
  --ink-950: #0f1728;
  --ink-800: #263247;
  --ink-600: #5d6a7e;
  --ink-500: #778396;
  --line: #dce3ed;
  --line-soft: #e9edf3;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --shadow: 0 12px 34px rgba(19, 43, 78, 0.12);
  --sidebar-width: 220px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink-950);
  background: var(--surface);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #fff;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #fff;
  color: var(--ink-950);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.auth-hidden {
  visibility: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  place-items: center;
  padding: 20px;
  background: #f4f7fb;
}

.login-screen.show {
  display: grid;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

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

.login-brand h1 {
  margin: 0;
  font-size: 24px;
}

.login-brand p {
  margin: 3px 0 0;
  color: var(--ink-600);
}

.login-error {
  min-height: 20px;
  margin: -5px 0 0;
  color: var(--red-700);
  font-size: 13px;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(18, 101, 232, 0.18);
  outline-offset: 2px;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  color: #fff;
  background: var(--navy-950);
  border-right: 1px solid #0b2c58;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--blue-600);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.side-nav {
  display: grid;
  gap: 7px;
  padding: 18px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: #d9e7fb;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #fff;
  background: var(--blue-600);
  box-shadow: 0 8px 18px rgba(0, 78, 190, 0.28);
}

.nav-index {
  width: 25px;
  color: #91b6ec;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

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

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 18px 20px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.sidebar-footer small {
  margin-top: 2px;
  color: #94add0;
  font-size: 11px;
}

.admin-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--navy-800);
  border: 1px solid #7ea5dc;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.admin-avatar.small {
  width: 30px;
  height: 30px;
  color: var(--ink-800);
  background: #fff;
  border-color: #b9c4d3;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 64px;
  padding: 0 30px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid var(--line);
}

.topbar-admin {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-800);
  font-weight: 600;
  padding: 0;
  background: transparent;
  border: 0;
}

.menu-button,
.mobile-title {
  display: none;
}

.mobile-logout-button {
  color: var(--ink-800);
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 800;
}

.page-content {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 34px 34px 48px;
}

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

.page-heading h1,
.agent-summary h1,
.group-space-header h1 {
  margin: 0;
  color: var(--ink-950);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page-heading p,
.panel-heading p,
.group-space-header p {
  margin: 8px 0 0;
  color: var(--ink-600);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

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

.button-primary {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
  box-shadow: 0 5px 12px rgba(18, 101, 232, 0.18);
}

.button-primary:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
}

.button-outline {
  color: var(--blue-700);
  background: #fff;
  border-color: #9abcf1;
}

.button-outline:hover {
  background: var(--blue-50);
  border-color: var(--blue-600);
}

.button-light {
  color: var(--ink-800);
  background: var(--surface-muted);
  border-color: var(--line);
}

.button-danger,
.button-danger-outline {
  color: #fff;
  background: var(--red-700);
  border-color: var(--red-700);
}

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

.button-block {
  width: 100%;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-800);
  font-weight: 600;
}

.field > span b {
  color: var(--red-700);
}

.field > span em {
  color: var(--ink-500);
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.field input,
.field select,
.field textarea,
.agent-switch select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink-950);
  background: #fff;
  border: 1px solid #cbd4e1;
  border-radius: 6px;
  outline: 0;
}

.field textarea {
  resize: vertical;
}

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

.field input:hover,
.field select:hover,
.field textarea:hover,
.agent-switch select:hover {
  border-color: #9baabd;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.agent-switch select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(18, 101, 232, 0.1);
}

.field input.invalid {
  border-color: var(--red-700);
  box-shadow: 0 0 0 3px rgba(199, 55, 55, 0.08);
}

.search-field {
  width: min(340px, 100%);
}

.search-field.wide {
  width: min(520px, 100%);
}

.select-field {
  width: 150px;
}

.field-error {
  min-height: 18px;
  color: var(--red-700);
  font-size: 12px;
  font-weight: 500;
}

.desktop-table-wrap {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

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

.data-table th,
.data-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  color: var(--ink-800);
  background: var(--surface-muted);
  font-size: 13px;
  font-weight: 700;
}

.data-table td {
  color: var(--ink-800);
}

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

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

.log-table th,
.log-table td {
  white-space: normal;
}

.status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-enabled {
  color: var(--green-700);
  background: var(--green-50);
  border-color: #b7e6c8;
}

.status-disabled {
  color: var(--red-700);
  background: var(--red-50);
  border-color: #f2c0c0;
}

.status-warning {
  color: var(--amber-700);
  background: var(--amber-50);
  border-color: #efd59f;
}

.status-neutral {
  color: #506078;
  background: #f1f4f8;
  border-color: #d8e0e9;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 13px;
}

.text-action {
  padding: 2px 0;
  color: var(--blue-600);
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 600;
}

.text-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-action.primary {
  color: var(--blue-700);
  font-weight: 800;
}

.text-action.danger {
  color: var(--red-700);
}

.text-action.success {
  color: var(--green-700);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  color: var(--ink-600);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pagination-buttons button {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  color: var(--ink-800);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.pagination-buttons button:hover:not(:disabled) {
  color: var(--blue-700);
  border-color: #9abcf1;
}

.pagination-buttons button.active {
  color: #fff;
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.pagination-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mobile-card-list {
  display: none;
}

.mobile-add-button {
  display: none;
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  color: #3f5f8c;
  background: var(--blue-50);
  border: 1px solid #cedffc;
  border-radius: 6px;
}

.rule-list {
  border: 1px solid var(--line);
  border-radius: 7px;
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 0.8fr) 150px 90px;
  align-items: center;
  gap: 24px;
  padding: 20px;
  border-bottom: 1px solid var(--line-soft);
}

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

.rule-identity strong,
.rule-identity span {
  display: block;
}

.rule-identity strong {
  font-size: 16px;
}

.rule-identity span {
  margin-top: 4px;
  color: var(--ink-500);
  font-family: Consolas, monospace;
  font-size: 12px;
}

.rule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.rule-meta em {
  padding: 4px 8px;
  color: #285ea8;
  background: var(--blue-50);
  border: 1px solid #d7e6ff;
  border-radius: 4px;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.quota-rule-field {
  grid-template-columns: auto 110px;
  align-items: center;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-800);
  font-weight: 600;
}

.switch-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-600);
}

.ipad-card {
  margin-bottom: 18px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(42, 59, 89, 0.05);
}

.ipad-card h2 {
  margin: 0 0 16px;
  color: var(--ink-900);
  font-size: 18px;
}

.ipad-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.ipad-section-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.ipad-section-title h2 {
  margin: 0;
}

.ipad-section-title span {
  color: var(--ink-500);
  font-size: 13px;
}

.ipad-robot-agent-filter {
  width: min(320px, 100%);
}

.ipad-robot-agent-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.ipad-robot-agent-group + .ipad-robot-agent-group {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.ipad-robot-agent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ipad-robot-agent-heading > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.ipad-robot-agent-heading strong {
  color: var(--ink-900);
  font-size: 16px;
}

.ipad-robot-agent-heading span {
  color: var(--ink-500);
  font-size: 13px;
}

.ipad-form-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 14px;
}

.ipad-field-wide {
  grid-column: span 2;
}

.ipad-switch {
  align-self: end;
  min-height: 44px;
}

.ipad-form-actions {
  display: flex;
  align-items: end;
}

.ipad-form-actions .button {
  width: 100%;
}

.ipad-line-modal {
  width: min(880px, 100%);
}

.ipad-line-modal .ipad-form-actions {
  gap: 10px;
}

.ipad-line-modal-notice {
  margin: 0 0 16px;
}

.ipad-mobile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.ipad-mobile-actions .button {
  flex: 1 1 90px;
}

.ipad-mobile-wide {
  grid-column: 1 / -1;
}

.ipad-admin-table .mono,
.mono {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}

.ipad-admin-table .wrap-cell {
  min-width: 220px;
  max-width: 380px;
  white-space: normal;
  word-break: break-word;
}

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

.back-button {
  padding: 4px 0;
  color: var(--blue-700);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.back-button::before {
  content: "←";
  margin-right: 7px;
}

.agent-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-600);
  font-size: 13px;
  font-weight: 600;
}

.agent-switch select {
  min-width: 160px;
}

.agent-summary {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.summary-label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-500);
  font-size: 12px;
}

.summary-metrics {
  display: grid;
  grid-template-columns: 1.7fr repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}

.summary-metrics div {
  padding-right: 16px;
  border-right: 1px solid var(--line-soft);
}

.summary-metrics div:last-child {
  border-right: 0;
}

.summary-metrics dt,
.info-list dt,
.card-metrics dt,
.record-grid dt {
  color: var(--ink-500);
  font-size: 12px;
}

.summary-metrics dd,
.info-list dd,
.card-metrics dd,
.record-grid dd {
  margin: 5px 0 0;
  color: var(--ink-950);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 22px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 20px;
  color: var(--ink-600);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font-weight: 700;
}

.tabs button:hover {
  color: var(--blue-700);
}

.tabs button.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-600);
}

.tab-content {
  padding-top: 22px;
}

.content-panel {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.narrow-panel {
  max-width: 640px;
}

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

.panel-heading.inline-heading {
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: 20px;
}

.info-list {
  margin: 0;
  border-top: 1px solid var(--line-soft);
}

.info-list > div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line-soft);
}

.info-list dd {
  margin-top: 0;
}

.panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.quota-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.fishing-server-form {
  margin-top: 22px;
}

.fishing-player-section {
  margin-top: 24px;
}

.fishing-player-table {
  overflow-x: auto;
}

.fishing-player-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 12px;
  margin: 0 0 18px;
}

.fishing-player-summary div {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.fishing-player-summary dt {
  color: var(--ink-500);
  font-size: 12px;
}

.fishing-player-summary dd {
  margin: 5px 0 0;
  color: var(--ink-950);
  font-size: 21px;
  font-weight: 800;
}

.fishing-catalog-section {
  margin-top: 28px;
}

.catalog-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.catalog-summary div {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.catalog-summary dt {
  color: var(--ink-500);
  font-size: 12px;
}

.catalog-summary dd {
  margin: 6px 0 0;
  color: var(--ink-950);
  font-size: 22px;
  font-weight: 800;
}

.fishing-catalog-toolbar {
  grid-template-columns: 160px 180px 160px minmax(220px, 1fr);
}

.catalog-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.4fr);
  gap: 20px;
  align-items: start;
}

.fishing-sea-table,
.fishing-fish-table {
  overflow-x: auto;
}

.quota-form .field {
  width: min(320px, 100%);
}

.help-text {
  margin-top: 13px;
  color: var(--ink-500);
  font-size: 12px;
}

.group-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr 160px;
}

.group-space-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.mode-label {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
}

.group-space-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 14, 32, 0.52);
}

.modal-sheet {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 24px;
  background: #fff;
  border-radius: 9px;
  box-shadow: var(--shadow);
}

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

.modal-header h2,
.confirm-sheet h2 {
  margin: 0;
  font-size: 22px;
}

.modal-header p,
.confirm-sheet p {
  margin: 6px 0 0;
  color: var(--ink-600);
}

.modal-close {
  padding: 4px 0;
  color: var(--ink-600);
  background: transparent;
  border: 0;
  font-size: 13px;
}

.form-stack {
  display: grid;
  gap: 15px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 7px;
}

.confirm-sheet {
  width: min(410px, 100%);
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 14px;
  color: var(--blue-700);
  background: var(--blue-50);
  border: 1px solid #bfd5f9;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 800;
}

.confirm-icon.danger {
  color: var(--red-700);
  background: var(--red-50);
  border-color: #f0bcbc;
}

.confirm-icon.success {
  color: var(--green-700);
  background: var(--green-50);
  border-color: #b5e3c5;
}

.confirm-sheet .modal-actions {
  justify-content: center;
  margin-top: 22px;
}

.password-result {
  margin: 18px 0;
  padding: 13px;
  color: var(--ink-950);
  background: var(--surface-muted);
  border: 1px dashed #a9b7c9;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.toast-root {
  position: fixed;
  top: 82px;
  right: 22px;
  z-index: 150;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  padding: 12px 15px;
  color: #fff;
  background: var(--ink-950);
  border-left: 4px solid var(--green-700);
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  border-left-color: var(--red-700);
}

.loading-root {
  position: fixed;
  inset: 64px 0 0 var(--sidebar-width);
  z-index: 80;
  display: none;
  place-items: center;
  color: var(--ink-600);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
}

.loading-root.show {
  display: grid;
}

.error-panel {
  max-width: 560px;
  margin: 70px auto;
  padding: 28px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.error-panel h2 {
  margin: 0 0 8px;
}

.error-panel p {
  margin: 0 0 20px;
  color: var(--ink-600);
}

.json-value {
  max-width: 260px;
  color: var(--ink-600);
  font-family: Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 34px 16px;
  color: var(--ink-500);
  text-align: center;
}

.sidebar-mask {
  display: none;
}

.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;
}

@media (max-width: 1180px) {
  .page-content {
    padding-right: 24px;
    padding-left: 24px;
  }

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

  .data-table {
    min-width: 980px;
  }

  .log-table {
    min-width: 1100px;
  }

  .rule-row {
    grid-template-columns: 1fr 190px 130px 80px;
    gap: 14px;
  }
}

@media (max-width: 760px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  body.menu-open {
    overflow: hidden;
  }

  .ipad-card {
    padding: 16px;
  }

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

  .ipad-field-wide {
    grid-column: span 1;
  }

  .sidebar {
    width: min(280px, 84vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

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

  .sidebar-mask {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(2, 14, 32, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-mask.show {
    opacity: 1;
    pointer-events: auto;
  }

  .main-shell {
    margin-left: 0;
  }

  .loading-root {
    inset: 58px 0 0;
  }

  .topbar {
    justify-content: space-between;
    height: 58px;
    padding: 0 16px;
  }

  .menu-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    padding: 0 10px;
    color: var(--ink-800);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-weight: 700;
  }

  .mobile-title {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    font-size: 16px;
  }

  .topbar-admin {
    display: none;
  }

  .page-content {
    width: 100%;
    padding: 22px 14px 38px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
  }

  .page-heading h1,
  .agent-summary h1,
  .group-space-header h1 {
    font-size: 23px;
  }

  .page-heading .button {
    width: 100%;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .search-field,
  .search-field.wide,
  .select-field {
    width: 100%;
  }

  .desktop-add-button {
    display: none;
  }

  .mobile-add-button {
    display: inline-flex;
    margin: 0 0 18px;
  }

  .desktop-table-wrap {
    display: none;
  }

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

  .agent-card,
  .record-card,
  .group-card {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
  }

  .card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
  }

  .card-title-row strong {
    font-size: 16px;
  }

  .card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 13px;
  }

  .card-metrics div {
    min-width: 0;
  }

  .card-metrics dd {
    word-break: break-word;
  }

.card-time {
    margin: 0 0 14px;
    color: var(--ink-500);
    font-size: 12px;
  }

  .card-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 22px;
    margin-top: 13px;
  }

  .record-card p,
  .group-card p {
    color: var(--ink-600);
  }

  .record-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0;
  }

  .record-grid div {
    min-width: 0;
  }

  .record-grid dd {
    overflow-wrap: anywhere;
    font-size: 13px;
  }

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

  .pagination-buttons {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .rule-list {
    border: 0;
  }

  .rule-row {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 12px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 7px;
  }

  .quota-rule-field {
    grid-template-columns: 1fr;
  }

  .rule-row .button {
    width: 100%;
  }

  .detail-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .agent-switch {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .agent-switch select {
    width: 100%;
  }

  .ipad-robot-agent-filter {
    width: 100%;
  }

  .ipad-robot-agent-controls {
    width: 100%;
  }

  .ipad-robot-agent-controls .button {
    width: 100%;
  }

  .ipad-robot-agent-heading {
    align-items: flex-start;
  }

  .agent-summary {
    padding: 18px;
  }

  .summary-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .summary-metrics div {
    padding: 13px 12px 13px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-right: -14px;
    margin-left: -14px;
    padding: 0 8px;
    overflow: visible;
  }

  .tabs button {
    min-width: 0;
    padding: 0 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .content-panel {
    padding: 18px;
  }

  .info-list > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .panel-actions,
  .quota-form {
    align-items: stretch;
    flex-direction: column;
  }

  .quota-form .field,
  .quota-form .button {
    width: 100%;
  }

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

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

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

  .fishing-catalog-toolbar,
  .catalog-grid {
    grid-template-columns: 1fr;
  }

  .group-space-header {
    align-items: stretch;
    flex-direction: column;
  }

  .group-space-header .button {
    width: 100%;
  }

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

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal-sheet {
    width: 100%;
    max-height: 94vh;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
  }

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

  .confirm-sheet {
    padding-top: 26px;
  }

  .modal-actions .button {
    flex: 1;
    min-height: 44px;
  }

  .toast-root {
    top: 70px;
    right: 12px;
    left: 12px;
  }

  .toast {
    width: 100%;
    min-width: 0;
  }
}

.card-account,
.summary-account {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 13px;
}

.card-account {
  margin: -5px 0 14px;
}

@media (max-width: 390px) {
  .card-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .card-metrics div:first-child {
    grid-column: 1 / -1;
  }

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

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