/* ============================================================
   PoinKu — style.css
   Aesthetic: Warm off-white, ink-dark, editorial
   Font: Sora (headings) + DM Sans (body) + DM Mono (numbers)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=DM+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --ink:        #141210;
  --ink-2:      #3a3630;
  --ink-3:      #7a736a;
  --ink-4:      #b5afa8;
  --ink-5:      #e4dfd9;

  --cream:      #faf8f5;
  --cream-2:    #f3f0eb;
  --cream-3:    #ece8e1;

  --accent:     #c8401a;
  --accent-2:   #f5ede8;
  --green:      #2a7a4b;
  --green-soft: #eaf4ee;
  --amber:      #b86e00;
  --amber-soft: #fef4e4;
  --blue:       #1d5fa8;
  --blue-soft:  #e8f0fb;

  --radius:     14px;
  --radius-sm:  9px;
  --radius-xs:  6px;

  --shadow-sm:  0 1px 3px rgba(20,18,16,.06), 0 2px 8px rgba(20,18,16,.04);
  --shadow-md:  0 4px 16px rgba(20,18,16,.08), 0 1px 3px rgba(20,18,16,.05);
  --shadow-lg:  0 24px 64px rgba(20,18,16,.15), 0 4px 16px rgba(20,18,16,.08);

  --t:          .17s ease;
  --font:       'DM Sans', sans-serif;
  --font-head:  'Sora', sans-serif;
  --font-mono:  'DM Mono', monospace;
}

[v-cloak] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Page ─────────────────────────────────── */
.pk-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ─── Header ───────────────────────────────── */
.pk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
  flex-wrap: wrap;
}

.pk-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pk-brand-mark {
  width: 48px; height: 48px;
  background: var(--ink);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--cream);
  font-size: 24px;
  flex-shrink: 0;
}

.pk-brand h1 {
  font-family: var(--font-head);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--ink);
  line-height: 1;
}

.pk-brand span {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .3px;
  display: block;
  margin-top: 2px;
}

/* ─── Toolbar ──────────────────────────────── */
.pk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pk-search {
  flex: 1;
  min-width: 180px;
  max-width: 300px;
  position: relative;
}

.pk-search i {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  font-size: 13px;
  pointer-events: none;
}

.pk-search input { padding-left: 34px; }

/* ─── Buttons ──────────────────────────────── */
.pk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 17px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.pk-btn:disabled { opacity: .5; cursor: not-allowed; }

.pk-btn-dark  { background: var(--ink); color: var(--cream); }
.pk-btn-dark:hover:not(:disabled) { background: var(--ink-2); }

.pk-btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1.5px solid var(--ink-5);
}
.pk-btn-ghost:hover:not(:disabled) { background: var(--cream-2); border-color: var(--ink-4); }

.pk-btn-accent  { background: var(--accent); color: #fff; }
.pk-btn-accent:hover:not(:disabled) { filter: brightness(.92); }

.pk-btn-green   { background: var(--green); color: #fff; }
.pk-btn-green:hover:not(:disabled) { filter: brightness(.92); }

.pk-btn-sm  { padding: 6px 11px; font-size: 12px; }
.pk-btn-icon { padding: 7px 9px; }

/* ─── Input ────────────────────────────────── */
.pk-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .1px;
  margin-bottom: 5px;
}

.pk-input {
  width: 100%;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink-5);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}

.pk-input:focus {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(20,18,16,.07);
}

.pk-input-error {
  border-color: var(--accent) !important;
  background: var(--accent-2);
}

.pk-input::placeholder { color: var(--ink-4); }

.pk-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ─── Table (desktop) ──────────────────────── */
.pk-table-wrap {
  background: #fff;
  border: 1px solid var(--cream-3);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pk-table thead th {
  padding: 11px 18px;
  background: var(--cream-2);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .7px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--cream-3);
  white-space: nowrap;
}

.pk-table tbody tr {
  border-bottom: 1px solid var(--cream-2);
  cursor: pointer;
  transition: background var(--t);
}

.pk-table tbody tr:last-child { border-bottom: none; }
.pk-table tbody tr:hover { background: var(--cream); }

.pk-table tbody td {
  padding: 13px 18px;
  vertical-align: middle;
}

/* ─── Mobile cards ─────────────────────────── */
.pk-card-list { display: flex; flex-direction: column; gap: 8px; }

.pk-cust-card {
  background: #fff;
  border: 1px solid var(--cream-3);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
  display: flex;
  align-items: center;
  gap: 12px;
}

.pk-cust-card:active {
  border-color: var(--ink-3);
  box-shadow: var(--shadow-md);
}

/* ─── Avatar ───────────────────────────────── */
.pk-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--cream-3);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -.5px;
}

.pk-avatar-lg {
  width: 50px; height: 50px;
  font-size: 17px;
}

/* ─── Badges ───────────────────────────────── */
.pk-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.pk-badge-debt   { background: var(--accent-2);  color: var(--accent); }
.pk-badge-clear  { background: var(--green-soft); color: var(--green); }
.pk-badge-pts    { background: var(--amber-soft); color: var(--amber); }
.pk-badge-plus   { background: var(--green-soft); color: var(--green); }
.pk-badge-minus  { background: var(--accent-2);   color: var(--accent); }
.pk-badge-pay    { background: var(--blue-soft);  color: var(--blue); }

/* ─── Mono ─────────────────────────────────── */
.pk-num {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Pagination ───────────────────────────── */
.pk-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border-top: 1px solid var(--cream-3);
}

.pk-pg {
  min-width: 30px; height: 30px;
  padding: 0 7px;
  border: 1.5px solid var(--ink-5);
  border-radius: var(--radius-xs);
  background: #fff;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}

.pk-pg:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.pk-pg.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.pk-pg:disabled { opacity: .35; cursor: not-allowed; }

/* ─── Empty ────────────────────────────────── */
.pk-empty {
  padding: 50px 20px;
  text-align: center;
}

.pk-empty i {
  font-size: 40px;
  color: var(--ink-5);
  display: block;
  margin-bottom: 12px;
}

.pk-empty h3 {
  font-family: var(--font-head);
  font-size: 16px;
  color: var(--ink-3);
  margin-bottom: 3px;
}

.pk-empty p { font-size: 13px; color: var(--ink-4); }

/* ─── Spinner ──────────────────────────────── */
.pk-spin {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--ink-5);
  border-top-color: var(--ink-3);
  border-radius: 50%;
  animation: s .55s linear infinite;
  vertical-align: middle;
}
@keyframes s { to { transform: rotate(360deg); } }

/* ─── Modal ────────────────────────────────── */
.pk-overlay {
  position: fixed; inset: 0;
  background: rgba(20,18,16,.42);
  backdrop-filter: blur(5px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fo .15s ease;
}
@keyframes fo { from { opacity: 0 } to { opacity: 1 } }
@keyframes ri { from { opacity: 0; transform: translateY(16px) scale(.99) } to { opacity: 1; transform: none } }

.pk-modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  animation: ri .2s ease;
}

.pk-modal-wide { max-width: 700px; }

.pk-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px 15px;
  border-bottom: 1px solid var(--cream-3);
  position: sticky; top: 0;
  background: #fff;
  z-index: 1;
}

.pk-modal-head h2 {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0;
}

.pk-modal-x {
  background: none; border: none;
  color: var(--ink-3); font-size: 17px;
  cursor: pointer; padding: 3px 5px;
  border-radius: 6px; line-height: 1;
  transition: background var(--t), color var(--t);
}
.pk-modal-x:hover { background: var(--cream-2); color: var(--ink); }

.pk-modal-body { padding: 20px; }

.pk-modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--cream-3);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Detail band ──────────────────────────── */
.pk-detail-band {
  background: var(--ink);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 20px 16px;
  color: var(--cream);
}

.pk-detail-band .d-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
}

.pk-detail-band .d-meta {
  font-size: 12px;
  color: var(--ink-4);
  margin-top: 3px;
}

.pk-stat-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.pk-stat-pill {
  flex: 1;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  padding: 9px 12px;
  text-align: center;
}

.pk-stat-pill .sv {
  font-family: var(--font-mono);
  font-size: 14px;
  color: #fff;
}

.pk-stat-pill .sl {
  font-size: 10px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-top: 2px;
}

/* ─── Tabs ─────────────────────────────────── */
.pk-tabs {
  display: flex;
  border-bottom: 2px solid var(--cream-3);
  margin-bottom: 14px;
}

.pk-tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--t);
  display: flex; align-items: center; gap: 5px;
}

.pk-tab:hover { color: var(--ink); }

.pk-tab.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Type toggle ──────────────────────────── */
.pk-toggle {
  display: flex;
  background: var(--cream-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 16px;
}

.pk-toggle-btn {
  flex: 1;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: all var(--t);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

.pk-toggle-btn.on-add  { background: #fff; color: var(--green);  box-shadow: var(--shadow-sm); }
.pk-toggle-btn.on-sub  { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }
.pk-toggle-btn.on-pay  { background: #fff; color: var(--blue);   box-shadow: var(--shadow-sm); }

/* ─── Preview ──────────────────────────────── */
.pk-preview {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
}

.pk-preview-ok  { background: var(--green-soft); color: var(--green); }
.pk-preview-err { background: var(--accent-2);   color: var(--accent); }
.pk-preview-warn { background: var(--amber-soft); color: var(--amber); }

/* ─── Toast ────────────────────────────────── */
.pk-toasts {
  position: fixed;
  bottom: 22px; right: 18px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 7px;
  pointer-events: none;
}

.pk-toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  min-width: 190px;
  box-shadow: var(--shadow-md);
  animation: ri .2s ease;
}

.pk-toast-ok  { background: var(--ink); }
.pk-toast-err { background: var(--accent); }

/* ─── Tx rows (inside detail) ──────────────── */
.pk-tx {
  padding: 9px 0;
  border-bottom: 1px solid var(--cream-2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pk-tx:last-child { border-bottom: none; }

/* ─── Report ───────────────────────────────── */
.pk-report {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
}

.pk-report-section {
  border: 1px solid var(--cream-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pk-report-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--cream-2);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: .6px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--cream-3);
}

.pk-report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cream-2);
}

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

.pk-report-row-main { background: #fff; }

.pk-report-row-total {
  background: var(--cream);
  padding: 11px 14px;
}

.pk-report-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.pk-report-label.pk-report-sub { color: var(--ink-3); font-size: 12px; }

.pk-report-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.pk-report-value.pk-report-sub { font-size: 12px; color: var(--ink-3); }

.pk-report-row-total .pk-report-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.pk-report-row-total .pk-report-value {
  font-size: 15px;
  font-weight: 500;
}

.pk-report-sub-val {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  font-family: var(--font);
  margin-top: 2px;
}

.pk-report-divider {
  height: 1px;
  background: var(--cream-3);
}

/* ─── Responsive ───────────────────────────── */
@media (max-width: 640px) {
  .pk-page { padding: 16px 12px 36px; }

  .pk-modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 94vh;
  }

  .pk-overlay { align-items: flex-end; padding: 0; }
  .pk-modal-wide { max-width: 100%; }

  @keyframes ri { from { opacity: 0; transform: translateY(100%) } to { opacity: 1; transform: none } }

  .hide-sm { display: none !important; }
}

@media (min-width: 641px) {
  .hide-md { display: none !important; }
}
