*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: #f5f5f5;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

/* ── Panel shell ─────────────────────────────────────────────────────────── */
#app {
  width: 100%;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
}

/* ── Brand header ────────────────────────────────────────────────────────── */
.brand-bar {
  padding: 16px 20px 14px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-text {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
  letter-spacing: -0.2px;
}

.brand-subtitle {
  font-size: 11px;
  color: #aaa;
  margin-top: 1px;
}

/* ── Customer card ───────────────────────────────────────────────────────── */
.customer-card {
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
}

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

.customer-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  flex-shrink: 0;
}

.customer-label {
  font-size: 12px;
  color: #999;
}

.customer-name {
  font-weight: 700;
  font-size: 14px;
  color: #1a1a1a;
  margin-top: 1px;
}

.customer-phone {
  font-size: 11px;
  color: #bbb;
  margin-top: 1px;
}

.customer-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  background: #f8f8f8;
  border: 0.5px solid #e8e8e8;
}

.pill-label {
  font-size: 11px;
  color: #777;
}

.pill-value {
  font-size: 11px;
  font-weight: 700;
  color: #1a1a1a;
}

.pill-value.branded {
  padding: 1px 7px;
  border-radius: 20px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.tab {
  flex: 1;
  padding: 11px 4px;
  font-size: 12px;
  font-weight: 400;
  color: #aaa;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.tab.active {
  font-weight: 600;
  border-bottom-width: 2px;
  border-bottom-style: solid;
}

/* ── Records ─────────────────────────────────────────────────────────────── */
.records {
  flex: 1;
  min-height: 150px;
  padding: 4px 0;
}

.record-row {
  display: flex;
  align-items: center;
  padding: 11px 20px;
  gap: 10px;
  border-bottom: 1px solid #f5f5f5;
}

.record-row:last-child {
  border-bottom: none;
}

.record-id {
  font-size: 11px;
  color: #ccc;
  min-width: 72px;
  font-family: monospace;
  letter-spacing: -0.3px;
}

.record-desc {
  flex: 1;
  font-size: 13px;
  color: #333;
}

.record-amt {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.empty-msg {
  padding: 24px 20px;
  color: #ccc;
  font-size: 12px;
  text-align: center;
}

/* ── Actions ─────────────────────────────────────────────────────────────── */
.actions {
  padding: 14px 20px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: opacity .15s;
  font-family: inherit;
}

.btn:hover { opacity: 0.88; }

.btn-primary {
  border: none;
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: #444;
  border: 1px solid #e0e0e0;
}

.util-row {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.btn-util {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 11px;
  border: 1px solid #e8e8e8;
  background: #fafafa;
  color: #888;
  cursor: pointer;
  font-weight: 500;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: opacity .15s;
}

.btn-util:hover { opacity: 0.75; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 280px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.modal-header {
  padding: 14px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.modal-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 3px;
  display: block;
}

.modal-input,
.modal-select,
.modal-textarea {
  width: 100%;
  padding: 7px 9px;
  font-size: 12px;
  border-radius: 7px;
  border: 0.5px solid #ddd;
  outline: none;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
}

.modal-textarea { resize: vertical; }

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
}

/* ── State messages ──────────────────────────────────────────────────────── */
.state-msg {
  padding: 40px 20px;
  text-align: center;
  color: #bbb;
  font-size: 12px;
}

.state-error {
  color: #A32D2D;
}