:root {
  --c-bg: #f4f6f9;
  --c-surface: #ffffff;
  --c-border: #e5e7eb;
  --c-text: #111827;
  --c-muted: #6b7280;
  --c-primary: #0f6b5c;
  --c-primary-hover: #0c574b;
  --c-primary-soft: #e8f5f2;
  --c-danger: #dc2626;
  --c-success: #16a34a;
  --c-warning: #d97706;
  --c-radius: 6px;
  --c-header-h: 52px;
  --c-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --c-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --drawer-width: 560px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--c-radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--c-primary-hover);
}

.btn-ghost {
  background: var(--c-surface);
  border-color: var(--c-border);
  color: var(--c-text);
}

.btn-ghost:hover {
  background: var(--c-bg);
}

.btn-link {
  background: none;
  border: none;
  color: var(--c-primary);
  height: auto;
  padding: 0;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

/* —— Forms —— */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--c-text);
}

.field .req {
  color: var(--c-danger);
  margin-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}

.field input[readonly] {
  background: #f9fafb;
  color: var(--c-muted);
}

/* My97DatePicker — keep field height; calendar icon on the right */
.field input.Wdate {
  height: 36px;
  background: var(--c-surface) url("/static/common/vendor/My97DatePicker/skin/datePicker.gif") no-repeat right 10px center;
  padding-right: 36px;
  cursor: pointer;
}
.field input.Wdate:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}

.field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-muted);
}

/* —— Table —— */
.table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  overflow: auto;
  box-shadow: var(--c-shadow);
}

table.data {
  width: 100%;
  border-collapse: collapse;
}

table.data th,
table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

table.data th {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  background: #fafbfc;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

table.data tbody tr:hover {
  background: var(--c-primary-soft);
}

table.data .actions {
  cursor: default;
}

table.data .actions .btn-link {
  margin-right: 10px;
}

/* —— Page chrome —— */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
}

.page-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--c-muted);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  width: 240px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  background: var(--c-surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge-ok {
  background: #ecfdf5;
  color: var(--c-success);
}

.badge-off {
  background: #f3f4f6;
  color: var(--c-muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  padding: 18px;
  box-shadow: var(--c-shadow);
}

.card__label {
  font-size: 13px;
  color: var(--c-muted);
}

.card__value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
}

.card__link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--c-primary);
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px 12px;
}

.kv dt {
  color: var(--c-muted);
  font-size: 13px;
}

.kv dd {
  font-size: 14px;
}

/* —— Login —— */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(15, 107, 92, 0.12), transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(15, 107, 92, 0.08), transparent 45%),
    var(--c-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: var(--c-shadow-md);
}

.login-card__brand {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--c-text);
}

.login-card__sub {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--c-muted);
}

.login-card .btn-primary {
  width: 100%;
  height: 40px;
  margin-top: 8px;
}

.login-card__foot {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--c-muted);
}

/* —— Drawer —— */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  visibility: hidden;
}

.drawer[data-open="true"] {
  pointer-events: auto;
  visibility: visible;
}

.drawer__mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  transition: opacity 0.2s;
}

.drawer[data-open="true"] .drawer__mask {
  opacity: 1;
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: var(--drawer-width, 560px);
  max-width: 100vw;
  background: var(--c-surface);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.drawer[data-open="true"] .drawer__panel {
  transform: translateX(0);
}

.drawer__head {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--c-border);
}

.drawer__title {
  font-size: 15px;
  font-weight: 600;
}

.drawer__close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: var(--c-radius);
  cursor: pointer;
  font-size: 20px;
  color: var(--c-muted);
  line-height: 1;
}

.drawer__close:hover {
  background: var(--c-bg);
  color: var(--c-text);
}

.drawer__frame-wrap {
  flex: 1;
  min-height: 0;
  background: var(--c-bg);
}

.drawer__frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--c-surface);
}

.drawer-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
}

.drawer-body {
  flex: 1;
  padding: 20px;
}

/* Two-column form layout (vehicle add/edit drawers) */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  align-content: start;
}
.form-grid > .field {
  margin-bottom: 14px;
  min-width: 0;
}
.form-grid > .field--full {
  grid-column: 1 / -1;
}
@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.drawer-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--c-surface);
}

/* —— Entry hub —— */
.hub {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(ellipse at 10% 10%, rgba(15, 107, 92, 0.1), transparent 40%),
    var(--c-bg);
}

.hub__inner {
  width: 100%;
  max-width: 720px;
}

.hub__title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.hub__desc {
  color: var(--c-muted);
  margin-bottom: 28px;
}

.hub__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.hub__card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--c-shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hub__card:hover {
  border-color: var(--c-primary);
  box-shadow: var(--c-shadow-md);
}

.hub__card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.hub__card p {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .hub__grid {
    grid-template-columns: 1fr;
  }

  .search-input {
    width: 160px;
  }
}

/* —— App shell: left menu + content —— */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  --sidebar-bg: #1e293b;
  --sidebar-bg-soft: #243247;
  --sidebar-border: rgba(148, 163, 184, 0.16);
  --sidebar-text: #cbd5e1;
  --sidebar-text-strong: #f8fafc;
  --sidebar-active: #0f766e;
  --sidebar-active-soft: rgba(15, 118, 110, 0.22);
  width: 210px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, #243044 0%, var(--sidebar-bg) 42%, #182233 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
}

.app-sidebar__brand {
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--sidebar-text-strong);
  letter-spacing: 0.01em;
  text-align: center;
}

.app-menu {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
}

.app-menu__item,
.app-menu__group-title,
.app-menu__sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.app-menu__item,
.app-menu__group-title {
  padding: 11px 12px;
}

.app-menu__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

.app-menu__svg {
  display: block;
}

.app-menu__label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.app-menu__item:hover,
.app-menu__group-title:hover,
.app-menu__sub-item:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--sidebar-text-strong);
}

.app-menu__item:hover .app-menu__icon,
.app-menu__group-title:hover .app-menu__icon,
.app-menu__sub-item:hover .app-menu__icon {
  color: #e2e8f0;
}

.app-menu__item.is-active,
.app-menu__sub-item.is-active {
  background: var(--sidebar-active-soft);
  color: var(--sidebar-text-strong);
  box-shadow: inset 3px 0 0 var(--sidebar-active);
  font-weight: 600;
}

.app-menu__item.is-active .app-menu__icon,
.app-menu__sub-item.is-active .app-menu__icon,
.app-menu__group.has-active > .app-menu__group-title .app-menu__icon {
  color: #5eead4;
}

.app-menu__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-menu__group.is-open > .app-menu__group-title,
.app-menu__group.has-active > .app-menu__group-title {
  color: var(--sidebar-text-strong);
  background: rgba(148, 163, 184, 0.08);
}

.app-menu__caret {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.app-menu__caret .app-menu__svg {
  width: 14px;
  height: 14px;
}

.app-menu__group.is-open .app-menu__caret {
  transform: rotate(180deg);
  color: #cbd5e1;
}

.app-menu__sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px 8px;
  margin-left: 12px;
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

.app-menu__group.is-open .app-menu__sub {
  display: flex;
}

.app-menu__sub-item {
  padding: 9px 10px;
  font-size: 13px;
}

.app-menu__sub-item .app-menu__icon {
  width: 18px;
  height: 18px;
}

.app-menu__sub-item .app-menu__svg {
  width: 16px;
  height: 16px;
}

.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
}

.app-topbar {
  height: var(--c-header-h);
  flex-shrink: 0;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  font-size: 13px;
  color: var(--c-muted);
}

.app-topbar__org {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-topbar__org-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.app-topbar__expire {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--c-muted);
  white-space: nowrap;
}

.app-topbar__expire.is-warn {
  color: #ca8a04;
  font-weight: 500;
}

.app-topbar__expire.is-expired {
  color: var(--c-danger);
  font-weight: 500;
}

.app-topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  /* Reserve scrollbar space so brief overflow during grid refresh doesn't shift layout */
  scrollbar-gutter: stable;
  padding: 16px 20px 20px;
}

/* —— List page: search + toolbar + grid —— */
.panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  box-shadow: var(--c-shadow);
  margin-bottom: 12px;
}

.panel__body {
  padding: 14px 16px;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.search-form .field {
  margin-bottom: 0;
  min-width: 180px;
}

.search-form .field label {
  font-size: 12px;
  color: var(--c-muted);
}

.search-form .field input,
.search-form .field select {
  height: 34px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.list-toolbar h1 {
  font-size: 16px;
  font-weight: 600;
}

.list-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-danger {
  background: #fff;
  border: 1px solid #fecaca;
  color: var(--c-danger);
}

.btn-danger:hover {
  background: #fef2f2;
}

.grid-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--c-radius);
  box-shadow: var(--c-shadow);
  padding: 8px;
}

.grid-panel .ui-jqgrid {
  margin: 0 auto;
  border: 0;
}

/* SweetAlert (yijing) — match project font */
.sweet-alert {
  font-family: var(--font);
}

.sweet-alert h2 {
  font-family: var(--font);
  font-size: 22px;
  line-height: 1.35;
  margin: 18px 0 12px;
}

/* 确保确认按钮 loading（la-ball-fall）在自定义主题色下仍可见 */
.sweet-alert button.confirm[disabled] {
  color: transparent !important;
}
.sweet-alert button.confirm[disabled] ~ .la-ball-fall {
  opacity: 1 !important;
  visibility: visible !important;
}
