/* ── Reusable components ───────────────────────────────────────────────────── */

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--tap);
  padding: 0 var(--space-5);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-weight: 600;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--c-primary);
  color: #fff;
}
.btn--primary:active { background: var(--c-primary-dk); }

.btn--outline {
  background: var(--c-surface);
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
}
.btn--outline:active { background: #e8f0fe; }

.btn--danger {
  background: var(--c-danger);
  color: #fff;
}
.btn--danger:active { opacity: .85; }

.btn--ghost {
  background: transparent;
  color: var(--c-text);
  padding: 0 var(--space-3);
}
.btn--ghost:active { background: var(--c-border); }

.btn--full { width: 100%; }

.btn:disabled {
  opacity: .45;
  pointer-events: none;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field + .field { margin-top: var(--space-4); }

.label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0 var(--space-3);
  height: var(--tap);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color .15s;
  appearance: none;
}

.textarea {
  height: auto;
  min-height: 80px;
  padding: var(--space-3);
  resize: vertical;
  line-height: 1.5;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

.input::placeholder, .textarea::placeholder {
  color: #adb5bd;
}

/* ── Checkbox row ────────────────────────────────────────────────────────── */

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--c-primary);
}

.checkbox-row__label {
  font-size: var(--text-base);
  user-select: none;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: var(--space-3); }

.card__body {
  padding: var(--space-4);
}

.card--tap {
  cursor: pointer;
  transition: background .12s;
}
.card--tap:active { background: var(--c-bg); }

/* ── Section header ──────────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
}

/* ── Status chip ─────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.chip--draft    { background: #e9ecef; color: var(--c-text-muted); }
.chip--sent     { background: #dbeafe; color: #1d4ed8; }
.chip--accepted { background: #dcfce7; color: #15803d; }
.chip--paid     { background: #d1fae5; color: #065f46; }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--c-text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
  opacity: .4;
}

.empty-state__text {
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-2);
}

.empty-state__sub {
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--space-4) 0;
}

/* ── Search input ────────────────────────────────────────────────────────── */

.search-wrap {
  position: relative;
}

.search-wrap .input {
  padding-left: 40px;
}

.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}

/* ── Client search dropdown ──────────────────────────────────────────────── */

.client-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--c-surface);
  border: 1.5px solid var(--c-primary);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
}

.client-dropdown__item {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  min-height: var(--tap);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.client-dropdown__item:last-child { border-bottom: none; }
.client-dropdown__item:active { background: var(--c-bg); }

.client-dropdown__name  { font-weight: 600; }
.client-dropdown__sub   { font-size: var(--text-sm); color: var(--c-text-muted); }

/* ── Auth tabs ───────────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: var(--space-5);
}

.tab {
  flex: 1;
  height: var(--tap);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--c-text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  min-width: unset; /* override reset */
}

.tab[aria-selected="true"] {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}

/* ── Logo preview ────────────────────────────────────────────────────────── */

.logo-preview {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-bg);
}

/* ── Error message ───────────────────────────────────────────────────────── */

.form-error {
  color: var(--c-danger);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  min-height: 1.25em;
}
