/* ===== H5 Shell ===== */
.app-body {
  margin: 0;
  padding: 0;
  background: #eef1f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  height: 100vh;
  overflow: hidden;
}

.h5-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  max-width: 640px;
  margin: 0 auto;
  background: linear-gradient(180deg, #f8fafc 0%, #eef1f5 100%);
  position: relative;
}

/* ===== Header ===== */
.h5-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  background: #16213e;
  flex-shrink: 0;
  gap: 10px;
}

.h5-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.h5-brand {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #1d6b57;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.h5-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.h5-title-label {
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255,255,255,0.55);
}

.h5-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h5-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.h5-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.h5-btn-primary {
  background: #1d6b57;
  color: #fff;
}
.h5-btn-primary:hover { background: #154c3f; }

.h5-btn-ghost {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.82);
}
.h5-btn-ghost:hover { background: rgba(255,255,255,0.14); }

/* ===== Filter Bar ===== */
.h5-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid #e8eaed;
  flex-shrink: 0;
}

.h5-filter-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: #1a1a2e;
  outline: none;
  min-width: 0;
}
.h5-filter-input:focus { border-color: #1d6b57; }

.h5-filter-summary {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #666;
  white-space: nowrap;
}
.h5-filter-summary strong { color: #1d6b57; font-weight: 700; }
.h5-count { color: #999; font-size: 12px; }

/* ===== Main / Panel ===== */
.h5-main {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding-bottom: 124px;
}

.h5-pull-indicator {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
  z-index: 2;
  transition: height 0.18s ease, opacity 0.18s ease;
  opacity: 0;
}

.h5-pull-indicator span {
  margin-bottom: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #dde1e7;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.h5-panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 132px;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.18s ease;
}
.h5-panel.hidden { display: none; }

/* ===== Records ===== */
.h5-record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.h5-record-card {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 14px;
  padding: 10px 11px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.h5-record-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.h5-record-main {
  min-width: 0;
  flex: 1;
}

.h5-record-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.35;
  word-break: break-word;
}

.h5-record-meta {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #8a92a6;
}

.h5-record-time {
  color: inherit;
}

.h5-record-price {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 800;
  color: #1d6b57;
}

.h5-record-note {
  color: #677085;
  word-break: break-word;
}

.h5-record-bottom {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.h5-record-bottom.is-admin {
  justify-content: space-between;
}

.h5-record-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.h5-record-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3f6f9;
  color: #52607a;
  font-size: 11px;
  line-height: 1.3;
}

.h5-record-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.h5-record-owner {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef4f1;
  color: #1d6b57;
  font-size: 11px;
  font-weight: 600;
}

.h5-record-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 6px 0 2px;
}

.h5-page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.h5-page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  background: #fff;
  color: #52607a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.h5-page-btn:hover {
  background: #f7f9fb;
}

.h5-page-btn.is-active {
  background: #1d6b57;
  border-color: #1d6b57;
  color: #fff;
}

.h5-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.h5-page-ellipsis {
  color: #8a92a6;
  font-size: 12px;
}

.h5-page-nav {
  white-space: nowrap;
}

.h5-row-btn {
  padding: 5px 10px;
  border: 1px solid #dde1e7;
  border-radius: 999px;
  background: #fff;
  color: #555;
  font-size: 11.5px;
  cursor: pointer;
}
.h5-row-btn:hover { background: #f0f1f3; }
.h5-row-btn.danger { border-color: #fca5a5; color: #dc2626; }
.h5-row-btn.danger:hover { background: #fef2f2; }

/* ===== Stats ===== */
.h5-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.h5-stat-card {
  min-width: 0;
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.h5-stat-card span { font-size: 12px; color: #888; }
.h5-stat-card strong { font-size: 16px; font-weight: 700; color: #1d6b57; line-height: 1.2; }

.h5-stats-tables { padding: 12px 0 0; display: flex; flex-direction: column; gap: 12px; }

.h5-stats-block {
  border: 1px solid #e8eaed;
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fff;
}
.h5-stats-block-title {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.h5-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.h5-table thead th {
  padding: 8px 10px;
  text-align: left;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
  color: #666;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.h5-table tbody tr {
  border-bottom: 1px solid #f0f1f3;
}

.h5-table tbody td {
  padding: 8px 10px;
  vertical-align: middle;
}

.td-price { font-weight: 600; color: #1d6b57; white-space: nowrap; font-size: 12.5px; }

/* ===== Bottom nav / FAB ===== */
.compact-bottom-nav {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px 14px 14px;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid rgba(221,225,231,0.9);
  backdrop-filter: blur(10px);
  z-index: 5;
}

.bottom-nav-item {
  border: none;
  background: transparent;
  border-radius: 12px;
  padding: 10px 8px;
  color: #8087a0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav-item.is-active {
  color: #1d6b57;
  background: rgba(29, 107, 87, 0.1);
}

.compact-add-btn {
  position: absolute;
  right: 16px;
  bottom: 82px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f8a70 0%, #1d6b57 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 32px;
  line-height: 1;
  box-shadow: 0 14px 28px rgba(29, 107, 87, 0.28);
  cursor: pointer;
  z-index: 6;
}

/* ===== Dialog ===== */
.h5-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(480px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.h5-dialog::backdrop {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

.h5-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.h5-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.h5-dialog-head h3 { margin: 0; font-size: 15px; font-weight: 700; }

.h5-dialog-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #f0f1f3;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.h5-dialog-close:hover { background: #e0e2e6; }

.h5-dialog-form {
  flex: 1;
  overflow-y: auto;
  padding: 12px 18px;
}

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

.h5-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.h5-field-full { grid-column: span 2; }
.h5-inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.h5-inline-fields .h5-field {
  min-width: 0;
}
.h5-field label { font-size: 12px; font-weight: 600; color: #555; }
.h5-field input:not([type="radio"]),
.h5-field select,
.h5-field textarea {
  padding: 7px 10px;
  border: 1px solid #dde1e7;
  border-radius: 7px;
  font-size: 13px;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.h5-field input:focus,
.h5-field select:focus,
.h5-field textarea:focus { border-color: #1d6b57; }
.h5-field .readonly { background: #f8f9fa; color: #888; }

.payment-method-field {
  gap: 6px;
}

.payment-method-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #dde1e7;
  border-radius: 7px;
  background: #fff;
  box-sizing: border-box;
}

.payment-method-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

.payment-method-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
  accent-color: #1d6b57;
}

.payment-method-option input:focus,
.payment-method-option input:focus-visible {
  border: none;
  box-shadow: none;
  outline: none;
}

.payment-method-option span {
  display: inline;
  line-height: 1.4;
}

.payment-method-option:hover {
  color: #1a1a2e;
}

.payment-method-option:has(input:checked) {
  color: #1a1a2e;
  font-weight: 600;
}

.h5-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 2px;
}

.hidden { display: none !important; }

/* ===== Error message ===== */
.h5-error {
  padding: 8px 12px;
  margin: 8px 0 0;
  background: #fef2f2;
  border-radius: 6px;
  color: #dc2626;
  font-size: 13px;
}

@media (max-width: 640px) {
  .h5-header {
    padding: 12px 12px 10px;
  }

  .h5-filter {
    flex-wrap: wrap;
  }

  .h5-filter-summary {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

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

  .h5-stat-card {
    padding: 8px 10px;
    border-radius: 12px;
  }

  .h5-stat-card span {
    font-size: 11.5px;
  }

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

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

  .h5-inline-fields {
    grid-template-columns: 1fr;
  }

  .h5-field-full {
    grid-column: span 1;
  }
}
