/* styles.css — Investment-CV dashboard */
:root {
  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --text:      #1e293b;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --primary:   #3b82f6;
  --primary-d: #2563eb;
  --green:     #16a34a;
  --red:       #dc2626;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius:    14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#0f172a; --surface:#1e293b; --text:#e2e8f0; --muted:#94a3b8;
    --border:#334155; --shadow:0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", "Noto Sans Thai", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
}
.login-card {
  background: var(--surface); padding: 36px 30px; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 6px; text-align: center;
}
.login-logo { font-size: 46px; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; }
.login-sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.login-card label { text-align: left; font-size: 13px; color: var(--muted); display: block; margin-top: 8px; }

/* ---------- Inputs / buttons ---------- */
.input {
  width: 100%; padding: 11px 12px; margin-top: 4px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font-size: 15px;
}
.input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.input.sm { padding: 7px 10px; font-size: 14px; width: auto; }

.btn {
  background: var(--primary); color: #fff; border: 0; padding: 10px 16px;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn:hover { background: var(--primary-d); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.full { width: 100%; margin-top: 14px; padding: 12px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.error-msg { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 6px; }
.error-box { background: #fee2e2; color: #991b1b; padding: 14px; border-radius: 10px; margin: 20px; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 22px; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.uname { font-weight: 600; font-size: 14px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.badge.admin  { background: #fef3c7; color: #92400e; }
.badge.member { background: #dbeafe; color: #1e40af; }

.view { padding: 22px; max-width: 1200px; margin: 0 auto; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi.primary { background: linear-gradient(135deg, var(--primary), var(--primary-d)); border: 0; color: #fff; }
.kpi.primary .kpi-label { color: rgba(255,255,255,.85); }
.kpi-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.kpi-val { font-size: 22px; font-weight: 700; line-height: 1.2; }
.kpi-val small { font-size: 12px; font-weight: 500; opacity: .8; }

/* ---------- Cards / layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 280px; }

/* ---------- Progress ---------- */
.progress { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--green), #22c55e); transition: width .6s; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: var(--bg); }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }

.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.deposit   { background: #dcfce7; color: #166534; }
.tag.withdraw  { background: #fee2e2; color: #991b1b; }
.tag.interest  { background: #ede9fe; color: #5b21b6; }
.tag.pending   { background: #fef3c7; color: #92400e; }
.tag.confirmed { background: #d1fae5; color: #065f46; }

.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0 4px; text-decoration: underline; }
.link-btn.ok { color: var(--green); font-weight: 600; }

/* ---------- Notification (รอยืนยัน) ---------- */
.notif {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px;
}
@media (prefers-color-scheme: dark) {
  .notif { background: #422006; border-color: #92400e; }
}
.notif-head { font-weight: 700; margin-bottom: 10px; }
.notif-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; padding: 8px 0; border-top: 1px dashed rgba(146,64,14,.3);
}
.notif-actions { display: flex; gap: 8px; }

.slip-img { max-width: 100%; max-height: 70vh; border-radius: 10px; display: block; margin: 0 auto; }

.loading { text-align: center; color: var(--muted); padding: 50px; }

tr.clickable { cursor: pointer; }
.muted { color: var(--muted); font-size: 13px; }
.detail-head { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 16px; }
.detail-head h2 { margin: 0; font-size: 22px; }

/* ---------- Modal ---------- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-box { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin: 0 0 14px; }
.modal-body label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
