/* ─────────────────────────────────────────────────────────────────────────────
   components.css — Shared Reusable UI Components
   Anything used on more than one screen lives here.
───────────────────────────────────────────────────────────────────────────── */

/* ── Screen Router ────────────────────────────────────────────────────────────── */
.screen        { display: none; min-height: 100vh; flex-direction: column; width: 100%; overflow-x: hidden; }
.screen.active { display: flex; }

/* ── Typography ───────────────────────────────────────────────────────────────── */
.t-display  { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.t-heading  { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.t-sub      { font-size: 16px; font-weight: 500; }
.t-body     { font-size: 14px; font-weight: 400; }
.t-medium   { font-size: 14px; font-weight: 500; }
.t-label    { font-size: 13px; font-weight: 500; }
.t-caption  { font-size: 12px; font-weight: 400; color: var(--text-mid); }
.t-num      { font-family: var(--mono); }
.t-brand    { color: var(--brand); }
.t-mid      { color: var(--text-mid); }
.t-err      { color: var(--error); }

/* ── Layout Utilities ─────────────────────────────────────────────────────────── */
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1          { flex: 1; }
.w-full          { width: 100%; }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.overflow-hidden { overflow: hidden; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* ── Divider ──────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); }

/* ── Page Header ──────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 58px;
}
.page-header .back-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  font-size: 16px;
  color: var(--text-mid);
  transition: background .13s;
  flex-shrink: 0;
}
.page-header .back-btn:hover   { background: var(--scaffold); }
.page-header .header-title     { flex: 1; }
.page-header .header-title h1  { font-size: 17px; font-weight: 600; }
.page-header .header-title p   { font-size: 12px; color: var(--text-mid); margin-top: 1px; }
.page-header .header-actions   { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Button ───────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  user-select: none;
  white-space: nowrap;
}
.btn:active                       { transform: scale(.97); }
.btn:disabled                     { opacity: .5; cursor: not-allowed; }
.btn-primary                      { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-outline {
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--scaffold); }
.btn-danger       { background: var(--error); color: #fff; }
.btn-danger:hover { background: #c0303c; }
.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
  font-size: 14px;
}

/* ── Icon Button ──────────────────────────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .13s;
  font-size: 14px;
}
.icon-btn:hover        { background: rgba(45,106,79,.1); }
.icon-btn.danger:hover { background: rgba(230,57,70,.1); }

/* ── Input / Field ────────────────────────────────────────────────────────────── */
.field       { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-dark); }

.input {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-dark);
  background: var(--scaffold);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-light); }
.input:focus        { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(45,106,79,.1); }
.input.error        { border-color: var(--error); }
textarea.input      { resize: vertical; min-height: 72px; }

.field-error         { font-size: 12px; color: var(--error); display: none; }
.field-error.visible { display: block; }

/* ── Select ───────────────────────────────────────────────────────────────────── */
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232D6A4F' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

/* ── Empty State ──────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
  gap: 10px;
}
.empty-icon {
  width: 72px; height: 72px;
  background: var(--brand-surf);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin-bottom: 8px;
}

/* ── Badge ────────────────────────────────────────────────────────────────────── */
.badge-limit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FFF3CD;
  border: 1px solid rgba(255,215,0,.4);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: #856404;
}

/* ── Modal Overlay ────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: fadeIn .15s ease; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: slideUp .2s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--text-mid); font-size: 18px;
  cursor: pointer; border-radius: 6px;
  transition: background .13s;
}
.modal-close:hover { background: var(--scaffold); }

/* ── Alert Dialog ─────────────────────────────────────────────────────────────── */
.alert-box     { max-width: 380px; }
.alert-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Toast ────────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  max-width: 340px;
  text-align: center;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
#toast.show  { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--error); }

/* ── Spinner ──────────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Animations ───────────────────────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; }               to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin    { to   { transform: rotate(360deg); } }

/* ── Responsive Visibility ────────────────────────────────────────────────────── */
@media (max-width: 680px) { .desktop-only { display: none !important; } }
@media (min-width: 681px) { .mobile-only  { display: none !important; } }

/* ── Mobile Form Cards ────────────────────────────────────────────────────────── */
.mobile-form-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}
@media (max-width: 680px) { .mobile-form-card { display: block; } }