

/* ==== Design tokens ======================================================= */
:root{
  --brand:#175e7d;
  --brand-2:#0f4c63;
  --text:#111;
  --muted:#6b7280;
  --bg:#f4f6f9;
  --surface:#ffffff;
  --line:#e5e7eb;
  --shadow:0 6px 16px rgba(17,24,39,.06);
  --good:#16a34a;
  --warn:#b45309;
  --bad:#b91c1c;
}

/* ==== Base ================================================================ */
*{box-sizing:border-box}
html,body{height:100%}
html{font-size:16px}
body{
  margin:0;
  padding:32px 28px;
  background:var(--bg);
  color:var(--text);
  font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}
h1,h2,h3{margin:0 0 12px}
h1{font-size:26px}
h2{font-size:20px}
h3{font-size:16px;color:var(--muted);font-weight:600}
p{margin:0 0 8px}
.muted{color:var(--muted)}

/* ==== Page blocks / cards ================================================= */
.card, .panel, .section{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:var(--shadow);
  padding:18px 16px;
  margin-bottom:16px;
}
.section-title{
  font-size:14px;
  font-weight:700;
  color:#0f172a;
  margin:2px 0 10px;
  letter-spacing:.2px;
}

/* ==== Forms =============================================================== */
label{
  display:block;
  font-size:12px;
  font-weight:600;
  color:#374151;
  margin:10px 0 6px;
}
input[type="text"],input[type="number"],input[type="date"],input[type="email"],
select,textarea{
  width:100%;
  height:40px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  outline:0;
  transition:border-color .15s, box-shadow .15s;
}
textarea{min-height:96px;resize:vertical}
input:focus,select:focus,textarea:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(23,94,125,.15);
}
.readonly, input[readonly], select[disabled]{
  background:#f3f4f6;
  color:#6b7280;
}

/* Grid helpers */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.grid-3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px}

/* Buttons */
button,.btn{
  height:40px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid transparent;
  cursor:pointer;
  font-weight:600;
  background:var(--brand);
  color:#fff;
}
button:hover,.btn:hover{background:var(--brand-2)}
.btn-secondary{
  background:#fff;color:var(--brand);
  border-color:var(--brand)
}
.btn-secondary:hover{background:#f0f9ff}
.btn-outline{
  background:#fff;color:#111;border-color:var(--line)
}
button:disabled{opacity:.55;cursor:not-allowed}

/* Inline badges */
.badge{
  display:inline-block; padding:2px 8px; border-radius:999px;
  font-size:12px; border:1px solid var(--line); background:#fff; color:#111
}
.badge.OK{background:#ecfdf5;border-color:#bbf7d0;color:var(--good)}
.badge.WARN{background:#fffbeb;border-color:#fde68a;color:var(--warn)}
.badge.ERR{background:#fef2f2;border-color:#fecaca;color:var(--bad)}

/* ==== Tables ============================================================== */
.table-wrap{overflow:auto}
table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden
}
th,td{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top
}
th{
  background:#f8fafc;
  position:sticky;
  top:0;
  z-index:1;
  font-size:12px;
  color:#334155
}
tbody tr:nth-child(even){background:#fbfdff}

/* ==== Totals lines ======================================================== */
.totals{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:12px;font-size:14px}
.totals div{text-align:right}
.totals div:nth-child(odd){color:var(--muted);text-align:left}
.totals strong{font-size:16px}

/* ==== Files list chips ==================================================== */
.files-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin-top:6px}
.file-chip{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:#fff}
.file-chip button{height:28px;padding:0 10px}

/* ==== Tabs (if used) ====================================================== */
.tabs{display:flex;gap:8px;border-bottom:1px solid var(--line);margin-bottom:8px}
.tab{
  background:#f3f7fb;border:1px solid var(--line);border-bottom:none;border-radius:10px 10px 0 0;
  padding:8px 12px;font-size:13px;color:#27364a;cursor:pointer
}
.tab.active{background:#fff;font-weight:700;color:#0f172a;border-color:#d0dae4}
.tab-pane{display:none}
.tab-pane.active{display:block}

/* ==== Right records list (cards) ========================================= */
.record{
  background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);
  padding:10px 12px;margin-bottom:10px
}
.record .muted{font-size:12px}

/* ==== Optional 60/40 split (when .left / .right exist) ==================== */
.left,.right{background:transparent;border:0;box-shadow:none;padding:0}
@media (min-width: 1000px){
  body.split, .split{display:flex;gap:24px;align-items:flex-start}
  .left{flex:0 0 60%}
  .right{flex:0 0 40%}
  .left > *, .right > *{margin-bottom:16px}
}

/* narrow inputs used in table cells */
.narrow{max-width:150px}
.x-narrow{max-width:110px}

/* ==== Print =============================================================== */
@media print{
  body{background:#fff;padding:0}
  .right,.tabs,.btn,.btn-secondary,.btn-outline, .buttons, .tab-tools{display:none!important}
  .receipt{display:block!important;border:none;box-shadow:none}
  table{font-size:12px}
}

/* ==== Small utilities ===================================================== */
hr{border:0;border-top:1px solid var(--line);margin:18px 0}
.small-note{font-size:12px;color:var(--muted)}

/* ================== Transactions List 전용 스타일 ================== */

/* 입력창 */
.form-control {
  display: inline-block;
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.form-control:focus {
  border-color: #0ea5e9;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(14,165,233,.25);
}

/* 드롭다운 */
.form-select {
  display: inline-block;
  width: 100%;
  padding: 8px 36px 8px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.24 4.5a.75.75 0 01-1.08 0l-4.24-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
}
.form-select:focus {
  border-color: #0ea5e9;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(14,165,233,.25);
}

/* 버튼 */
.btn {
  display: inline-block;
  font-weight: 600;
  line-height: 1.5;
  color: #1f2937;
  text-align: center;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
  transition: all 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-outline-soft { background:#fff; border-color:#d1d5db; color:#374151; }
.btn-soft { background-color:#0ea5e9; border-color:#0ea5e9; color:#fff; }
.btn-soft:hover { background-color:#0284c7; border-color:#0284c7; }

/* 테이블 */
.table { width:100%; margin-bottom:1rem; color:#374151; border-collapse:collapse; }
.table th, .table td { padding:8px 10px; border-top:1px solid #e5e7eb; }
.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid #e5e7eb;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
}
.table tbody tr:hover { background-color: #f9fafb; }
.table-sm th, .table-sm td { padding: 6px 8px; }

/* 텍스트 유틸리티 */
.text-muted { color: #6b7280 !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-center { text-align: center !important; }

/* ---------------- ADDED: 반응형 래퍼/보조 유틸 ---------------- */
.table-responsive{ /* ADDED */
  max-height:520px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}
.table-responsive .table{ /* ADDED: 이중 보더 방지 */
  margin:0;
  border:0;
}
.small{font-size:12px} /* ADDED: thead에 사용되는 small 클래스 */
.toolbar{display:flex;gap:8px;align-items:center;margin:0 0 10px} /* ADDED */
.table-empty{padding:24px 0} /* ADDED: 빈 상태 행 패딩 */


/* ===== Spot card (centered, emphasized) ===== */
.spot-card { text-align: center; }
.spot-header { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.spot-header #spotMetalLabel{
  margin-left: 6px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid #cfe3ff; background: #eef6ff; color: #0f172a; font-weight: 700;
}
.spot-price{
  display:flex; justify-content:center; align-items:baseline; gap:14px;
  margin: 2px 0 8px;
}
.spot-price .spot-oz, .spot-price .spot-g{
  font-size: 28px; font-weight: 800; letter-spacing: .2px;
}
.spot-price small{ font-size: 13px; color: var(--muted); margin-left:4px; }
.spot-meta{ display:flex; justify-content:center; gap:10px; align-items:center; font-size:12px; color:var(--muted); }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
/* === Spot Price status badges (소문자 대응) === */
.badge.ok {
  color:#065f46; background:#ecfdf5; border:1px solid #bbf7d0;
}
.badge.err {
  color:#7f1d1d; background:#fef2f2; border:1px solid #fecaca;
}

