:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --bg-strong: #eaf2f8;
  --panel: #ffffff;
  --panel-muted: #f6f8fa;
  --panel-tint: #eef7fd;
  --ink: #141922;
  --muted: #687383;
  --line: #d9e5ee;
  --line-strong: #bfd2e2;
  --shadow: 0 22px 48px rgba(20, 25, 34, 0.08);
  --shadow-soft: 0 10px 26px rgba(20, 25, 34, 0.06);
  --success: #0f7a5f;
  --success-soft: #e6f5ef;
  --warning: #2e6f9e;
  --warning-soft: #e8f4fb;
  --danger: #b9413a;
  --danger-soft: #fdebea;
  --neutral: #0d5ea8;
  --neutral-soft: #e8f3fc;
  --teal: #168bd0;
  --gold: #27486d;
  --gold-soft: #e9f1fb;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Avenir Next", "Noto Sans TC", "PingFang TC", sans-serif;
  background: linear-gradient(180deg, #fbfdff 0%, var(--bg) 48%, var(--bg-strong) 100%);
}

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

button {
  touch-action: manipulation;
}

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

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  color: var(--ink);
}

h1 {
  margin: 0;
  font-size: 2.6rem;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  letter-spacing: 0;
}

h3 {
  letter-spacing: 0;
}

.shell {
  flex: 1;
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.footer-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  object-fit: cover;
}

.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.footer-links button {
  border: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(14, 25, 31, 0.38);
  backdrop-filter: blur(7px);
}

.policy-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(14, 25, 31, 0.5);
  backdrop-filter: blur(8px);
}

.view {
  display: grid;
  gap: 16px;
}

.account-bar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(220, 227, 234, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.brand-lockup,
.account-actions,
.toolbar,
.status-stack {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  min-width: 280px;
}

.brand-home {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-home:hover .brand-mark {
  border-color: rgba(13, 94, 168, 0.3);
  box-shadow: 0 10px 22px rgba(13, 94, 168, 0.16);
}

.brand-home:focus-visible {
  outline: 3px solid rgba(13, 94, 168, 0.2);
  outline-offset: 4px;
}

.brand-mark {
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid rgba(13, 94, 168, 0.16);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(13, 94, 168, 0.1);
  object-fit: contain;
}

.account-bar strong {
  display: block;
  margin-top: 2px;
  font-size: 0.98rem;
}

.account-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.account-user {
  min-width: 150px;
  text-align: right;
}

.sync-meta {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-muted);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.system-feedback {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--neutral);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.system-feedback.success {
  border-left-color: var(--success);
}

.system-feedback.danger {
  border-left-color: var(--danger);
}

.login-shell {
  min-height: max(540px, calc(100vh - 190px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  align-items: center;
  gap: 18px;
}

.login-intro {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 24px;
  min-height: 500px;
  padding: 46px;
  border-radius: var(--radius);
  color: #ffffff;
  background-image:
    linear-gradient(135deg, rgba(8, 48, 86, 0.97) 0%, rgba(13, 94, 116, 0.96) 58%, rgba(69, 158, 190, 0.9) 100%),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  box-shadow: var(--shadow);
}

.login-intro::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #8bd3ff 0%, #ffffff 38%, rgba(255, 255, 255, 0.34) 100%);
}

.login-intro::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.login-intro h1,
.login-intro .login-kicker,
.login-intro .subtitle {
  position: relative;
  color: #ffffff;
}

.login-intro h1 {
  font-size: 3.8rem;
  line-height: 0.98;
}

.login-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}

.login-product-logo {
  position: relative;
  width: 116px;
  aspect-ratio: 1;
  display: block;
  flex: 0 0 auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(2, 20, 39, 0.22);
  object-fit: contain;
}

.login-kicker {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.92rem;
  font-weight: 900;
}

.login-intro .subtitle {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  line-height: 1.72;
}

.login-highlights {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-highlights span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.11);
  font-size: 0.84rem;
  font-weight: 900;
}

.login-card {
  align-self: center;
  width: 100%;
  display: grid;
  gap: 18px;
  padding: 26px;
}

.login-card .eyebrow {
  margin: 0;
}

.login-card h1 {
  font-size: 2rem;
}

.password-gate {
  min-height: max(480px, calc(100vh - 220px));
  display: grid;
  place-items: center;
}

.password-gate .login-card {
  max-width: 520px;
}

.quick-login {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.quick-login span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.quick-login button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--neutral);
  background: #ffffff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.quick-login button:hover {
  border-color: var(--neutral);
}

.hero,
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 2px 12px;
}

.page-heading {
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.58;
}

.summary-strip,
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filter-panel,
.editor-panel,
.lot-card,
.group-card,
.account-card {
  display: grid;
  gap: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(190px, 1fr) minmax(190px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.field,
.settings-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.field span,
.label,
.field-title {
  color: var(--muted);
  font-size: 0.88rem;
}

.field input,
.field select,
.settings-form input,
.settings-form select,
.settings-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.field input:hover,
.field select:hover,
.settings-form input:hover,
.settings-form select:hover,
.settings-form textarea:hover {
  border-color: #b8c5cf;
}

.field input:focus,
.field select:focus,
.settings-form input:focus,
.settings-form select:focus,
.settings-form textarea:focus {
  border-color: var(--neutral);
  box-shadow: 0 0 0 3px rgba(47, 93, 114, 0.14);
}

.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form textarea {
  resize: vertical;
}

.filter-actions {
  display: flex;
  align-items: center;
}

.result-meta {
  margin: 0;
  color: var(--neutral);
  font-weight: 900;
  white-space: nowrap;
}

.lot-grid,
.actions-grid,
.group-grid,
.account-grid {
  display: grid;
  gap: 14px;
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.highlight {
  color: #ffffff;
  border-color: #18352f;
  background: linear-gradient(135deg, #16342f 0%, #24405a 100%);
}

.highlight h2 {
  color: #ffffff;
}

.highlight .label,
.highlight .muted {
  color: rgba(255, 255, 255, 0.78);
}

.detail-dashboard {
  grid-template-columns: minmax(320px, 1.28fr) repeat(3, minmax(0, 0.72fr));
  gap: 14px;
}

.detail-availability-card {
  position: relative;
  min-height: 224px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
  background-image:
    linear-gradient(135deg, rgba(22, 52, 47, 0.98) 0%, rgba(36, 64, 90, 0.98) 100%),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
}

.detail-availability-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: inherit;
  pointer-events: none;
}

.detail-availability-card h2 {
  margin: 6px 0 0;
  color: #ffffff;
  font-size: 4.4rem;
  line-height: 0.92;
}

.detail-availability-card .meter.large {
  height: 12px;
  margin: 16px 0 12px;
}

.detail-availability-card .muted {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
}

.detail-metric {
  min-height: 224px;
  align-content: end;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 248, 250, 0.92) 100%);
}

.detail-metric h2 {
  font-size: 3rem;
}

.detail-command-grid,
.detail-log-grid {
  display: grid;
  gap: 14px;
}

.detail-command-grid {
  grid-template-columns: minmax(260px, 0.72fr) minmax(520px, 1.28fr);
  align-items: start;
}

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

.command-card,
.settings-card,
.activity-card {
  display: grid;
  gap: 16px;
}

.command-card {
  min-height: 220px;
  align-content: space-between;
  border-color: rgba(47, 93, 114, 0.2);
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f8f8 100%);
}

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

.traffic-buttons .action {
  min-height: 74px;
  font-size: 1.04rem;
}

#detailSettingsForm {
  grid-template-columns: minmax(220px, 1.35fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr);
  align-items: start;
}

#detailGroupsField,
#detailSettingsForm .button-row {
  grid-column: 1 / -1;
}

.activity-card {
  align-content: start;
}

.activity-card .event-list {
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.metric {
  position: relative;
  min-height: 126px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--neutral);
}

.metric:nth-child(2)::before {
  background: var(--success);
}

.metric:nth-child(3)::before {
  background: var(--warning);
}

.metric:nth-child(4)::before {
  background: var(--teal);
}

.metric h2,
.highlight h2 {
  margin: 8px 0 0;
  font-size: 2.55rem;
  line-height: 1;
}

.label {
  margin: 0;
  font-weight: 800;
}

.field-title {
  margin: 0 0 8px;
  font-weight: 900;
}

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

.hint {
  margin: 5px 0 0;
  line-height: 1.55;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.section-title > div {
  min-width: 0;
}

.section-title h3 {
  margin: 0;
  font-size: 1.08rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.online,
.badge.success {
  color: var(--success);
  background: var(--success-soft);
}

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

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

.badge.subtle,
.badge.neutral {
  color: var(--neutral);
  background: var(--neutral-soft);
}

.button-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row.compact {
  justify-content: flex-start;
}

.action,
.icon-button,
.back-link {
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.action {
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid transparent;
  color: #ffffff;
  font-weight: 900;
  white-space: nowrap;
}

.action:hover,
.icon-button:hover,
.back-link:hover {
  transform: translateY(-1px);
}

.is-busy .action {
  pointer-events: none;
  opacity: 0.68;
}

.action.neutral {
  background: var(--neutral);
}

.action.success {
  background: var(--success);
}

.action.danger {
  background: var(--danger);
}

.action.soft {
  color: var(--neutral);
  background: var(--neutral-soft);
}

.action.ghost {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line-strong);
}

.action.ghost.is-active {
  color: #ffffff;
  border-color: var(--neutral);
  background: var(--neutral);
}

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

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  color: var(--neutral);
  background: var(--neutral-soft);
  font-size: 1.25rem;
  line-height: 1;
}

.back-link {
  margin-bottom: 12px;
  padding: 0;
  border: 0;
  color: var(--neutral);
  background: transparent;
  font-weight: 900;
}

.form-error {
  min-height: 1.4em;
  margin: 0;
  color: var(--danger);
  font-weight: 900;
}

.editor-panel {
  border: 1px solid rgba(200, 210, 220, 0.92);
  border-radius: var(--radius);
  padding: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(20, 25, 34, 0.2);
}

#editorPanel,
#groupPanel {
  position: fixed;
  top: 40px;
  left: 50%;
  z-index: 100;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  transform: translateX(-50%);
}

#groupPanel {
  width: min(1040px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(320px, 1fr);
  align-items: start;
  gap: 18px;
}

#accountPanel {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
  box-shadow: var(--shadow-soft);
}

#editorPanel > .section-title,
#groupPanel > .section-title:first-child {
  position: sticky;
  top: -20px;
  z-index: 2;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

#homeView.is-account-route > .hero-home,
#homeView.is-account-route > .summary-strip,
#homeView.is-account-route > .filter-panel,
#homeView.is-account-route > #groupPanel,
#homeView.is-account-route > #editorPanel,
#homeView.is-account-route > #lotGrid,
#homeView.is-account-route > #homeEmptyState {
  display: none !important;
}

#groupEditorForm {
  grid-column: 1;
  grid-row: 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#groupEditorForm label:first-child,
#groupEditorForm label:nth-child(4),
#groupEditorForm > div,
#groupEditorForm > .button-row {
  grid-column: 1 / -1;
}

.group-directory {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  gap: 14px;
}

.account-profile-area {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
}

.account-directory {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  gap: 14px;
}

.account-editor-dialog {
  position: fixed;
  top: 40px;
  left: 50%;
  z-index: 100;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  transform: translateX(-50%);
  border: 1px solid rgba(200, 210, 220, 0.92);
  border-radius: var(--radius);
  padding: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(20, 25, 34, 0.2);
}

.account-editor-dialog .compact-title {
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.readonly-grid p {
  margin: 0;
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.readonly-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  font-weight: 900;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--brand);
}

.compact-title {
  margin-bottom: 0;
}

.password-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.group-directory .group-list-title {
  margin-top: 0;
}

.group-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

#groupGrid {
  max-height: 52vh;
  overflow: auto;
  padding-right: 4px;
}

#groupPanel .group-grid,
#accountPanel .account-grid {
  grid-template-columns: 1fr;
}

#accountGrid {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.group-list-title {
  margin-top: 12px;
}

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

.picker-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.picker-tools input,
.group-list-tools input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

.picker-tools input:focus,
.group-list-tools input:focus {
  border-color: var(--neutral);
  box-shadow: 0 0 0 3px rgba(47, 93, 114, 0.14);
}

.picker-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.picker-list {
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.checkbox-pill {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  font-weight: 800;
}

.checkbox-pill input {
  width: auto;
  min-height: auto;
  padding: 0;
}

.checkbox-pill span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.checkbox-pill small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.compact-hint {
  margin: 0;
  line-height: 1.55;
}

.mini-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-badge {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--teal);
  background: #e6f4f2;
  font-size: 0.76rem;
  font-weight: 900;
}

.mini-badge.subtle {
  color: var(--muted);
  background: #eef2f5;
}

.group-card h3,
.group-card p,
.account-card h3,
.account-card p {
  margin: 0;
}

.group-meta {
  display: grid;
  gap: 8px;
}

.group-meta p {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.group-meta span {
  color: var(--muted);
  line-height: 1.6;
}

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

.empty-state h3 {
  margin: 0 0 10px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.lot-card {
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--neutral);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.lot-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.lot-card.is-open {
  border-left-color: var(--success);
}

.lot-card.is-high {
  border-left-color: var(--warning);
}

.lot-card.is-full {
  border-left-color: var(--danger);
}

.lot-card h3 {
  margin: 0;
  font-size: 1.14rem;
  line-height: 1.28;
}

.lot-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.lot-code {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.stat-box {
  min-width: 0;
  padding: 11px;
  border: 1px solid #edf1f4;
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.stat-box strong {
  display: block;
  margin-top: 5px;
  font-size: 1.24rem;
  line-height: 1;
}

.meter {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebef;
}

.meter.large {
  height: 10px;
  margin: 14px 0 10px;
  background: rgba(255, 255, 255, 0.18);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width 220ms ease;
}

.meter.is-high span,
.meter.is-warning span {
  background: var(--warning);
}

.meter.is-full span,
.meter.is-danger span {
  background: var(--danger);
}

.highlight .meter span {
  background: #8ed8cb;
}

.highlight .meter.is-high span,
.highlight .meter.is-warning span {
  background: #f3c76b;
}

.highlight .meter.is-full span,
.highlight .meter.is-danger span {
  background: #ee8580;
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.event-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #edf1f4;
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.event-list span {
  color: var(--muted);
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid rgba(13, 28, 32, 0.16);
  color: rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(17, 36, 39, 0.98) 0%, rgba(12, 25, 29, 1) 100%);
}

.site-footer-inner {
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 24px 0 26px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px 22px;
  align-items: center;
}

.footer-company {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.footer-company strong {
  display: block;
  color: #ffffff;
  font-size: 0.98rem;
}

.footer-company p,
.copyright {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.84rem;
  line-height: 1.5;
}

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

.footer-links button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
}

.footer-links button:hover,
.footer-links button:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  outline: 0;
}

.copyright {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.policy-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 130;
  width: min(800px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(200, 210, 220, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(20, 25, 34, 0.28);
  transform: translate(-50%, -50%);
}

.policy-dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.policy-dialog-header h2 {
  margin: 2px 0 0;
  font-size: 1.35rem;
  line-height: 1.22;
}

.policy-dialog-body {
  display: grid;
  gap: 16px;
  padding: 18px 20px 22px;
}

.policy-dialog-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.policy-section {
  display: grid;
  gap: 6px;
}

.policy-section h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

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

.contact-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
}

.contact-item strong,
.contact-item a {
  display: block;
}

.contact-item a {
  margin-top: 5px;
  color: var(--neutral);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

@media (max-width: 1080px) {
  .lot-grid,
  .group-grid,
  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .detail-availability-card {
    grid-column: 1 / -1;
  }

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

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

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

@media (max-width: 860px) {
  h1 {
    font-size: 2.25rem;
  }

  .site-footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }

  .site-footer-inner {
    display: grid;
  }

  #groupPanel,
  #accountPanel {
    grid-template-columns: 1fr;
  }

  #groupEditorForm,
  .group-directory,
  .account-profile-area,
  .account-directory {
    grid-column: 1;
    grid-row: auto;
  }

  .account-profile-area {
    grid-template-columns: 1fr;
  }

  #groupGrid,
  #accountGrid {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  #groupEditorForm {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: 360px;
  }

  .login-intro h1 {
    font-size: 3rem;
  }

  .login-product-logo {
    width: 96px;
  }

  .hero,
  .lot-card-head,
  .account-bar {
    align-items: stretch;
  }

  .hero,
  .lot-card-head {
    flex-direction: column;
  }

  .account-bar {
    grid-template-columns: 1fr;
  }

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

  .account-user {
    text-align: left;
  }

  .actions-grid,
  .lot-grid,
  .group-grid,
  .account-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  #detailSettingsForm {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 18px, 1240px);
    padding-top: 12px;
  }

  .site-footer-inner {
    width: min(100vw - 18px, 1240px);
  }

  .footer-company {
    align-items: flex-start;
  }

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

  .policy-dialog {
    width: min(100vw - 18px, 1240px);
    max-height: calc(100vh - 24px);
  }

  #editorPanel,
  #groupPanel {
    top: 12px;
    width: min(100vw - 18px, 1240px);
    max-height: calc(100vh - 24px);
    padding: 16px;
  }

  #editorPanel > .section-title,
  #groupPanel > .section-title:first-child {
    top: -16px;
  }

  h1 {
    font-size: 2rem;
  }

  .summary-strip,
  .dashboard,
  .stat-row,
  .checkbox-grid,
  .picker-tools,
  .group-list-tools,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .detail-availability-card {
    grid-column: auto;
    min-height: 210px;
  }

  .detail-availability-card h2 {
    font-size: 4rem;
  }

  .detail-metric {
    min-height: 132px;
  }

  .traffic-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .login-intro {
    min-height: auto;
    gap: 18px;
    padding: 24px;
  }

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

  .login-product-logo {
    width: 82px;
  }

  .login-intro h1 {
    font-size: 2.35rem;
  }

  .login-highlights span {
    flex: 1 1 98px;
    justify-content: center;
  }

  .login-card h1 {
    font-size: 1.8rem;
  }

  .card,
  .editor-panel {
    padding: 15px;
  }

  .button-row,
  .card-actions,
  .toolbar,
  .status-stack,
  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .account-bar {
    position: static;
  }

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

  .account-user {
    min-width: 0;
    grid-column: 1;
    text-align: left;
  }

  .account-actions .action {
    min-height: 38px;
    padding: 8px 11px;
  }

  .account-actions .badge {
    display: none;
  }

  .sync-meta {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .brand-lockup {
    min-width: 0;
  }
}
