/* app.common.css — Shared styles for Coco (extracted from pawn.html)
   NOTE: Page-specific rules remain inline in pawn.html so visuals/behaviors are identical. */

/* ===== Base & Theme ===== */
:root{
  --ink:#0f172a;
  --muted:#64748b;
  --line:#e2e8f0;
  --bg:#f8fafc;
  --card:#ffffff;
  --accent:#0ea5e9;
  --danger:#b91c1c;
  --good:#059669;
}
*{ box-sizing:border-box; }
html,body{
  margin:0; padding:0; background:var(--bg); color:var(--ink);
  font:14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust:100%; text-size-adjust:100%;
}

/* ===== Cards ===== */
.card{ background:var(--card); border:1px solid var(--line); border-radius:12px; padding:14px; }
.card h3{ margin:0 0 10px; font-size:16px; }

/* ===== Header Bar ===== */
.headerbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--line); background:var(--card);
  margin-bottom:12px;
}
.brand{ font-weight:800; font-size:18px; letter-spacing:.2px; }
.biz{ color:var(--muted); font-size:12px; }
.today{ font-size:12px; color:var(--muted); white-space:nowrap; }

/* ===== Buttons & Toolbars ===== */
.toolbar{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.btn{
  border:1px solid var(--line); background:#fff; padding:8px 12px; border-radius:8px; cursor:pointer; font-weight:600;
}
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.danger{ border-color:var(--danger); color:#fff; background:var(--danger); }
.btn.ghost{ background:#fff; color:#0f172a; }

/* ===== Upload row (Row 2) ===== */
.upload{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; }
.upload input[type="file"]{ padding:6px; border:1px dashed var(--line); border-radius:8px; background:#fff; }

/* ===== Tabs & Tools (Right panel) ===== */
.tabs-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.tab-buttons{ display:flex; flex-wrap:wrap; gap:6px; }
.tab-buttons button{
  padding:6px 10px; border:1px solid var(--line); background:#fff; border-radius:999px; cursor:pointer; font-weight:600;
}
.tab-buttons button.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
.tools{ display:flex; gap:6px; flex-wrap:wrap; }
.tools input[type="search"]{ border:1px solid var(--line); border-radius:999px; padding:8px 12px; min-width:180px; }

/* ===== Record list ===== */
.list{ margin-top:10px; border:1px solid var(--line); border-radius:10px; overflow:hidden; background:#fff; }
.row{ display:grid; grid-template-columns: 1.4fr .8fr .8fr .8fr .8fr; gap:8px; padding:10px; border-top:1px solid var(--line); align-items:center; }
.row.header{ background:#f1f5f9; font-weight:700; position:sticky; top:0; z-index:1; }
.row:hover{ background:#f8fafc; }

/* Badges */
.badge{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid var(--line); }
.badge.ok{ background:#ecfdf5; color:var(--good); border-color:#bbf7d0; }
.badge.due{ background:#eff6ff; color:#1d4ed8; border-color:#bfdbfe; }
.badge.over{ background:#fef2f2; color:#b91c1c; border-color:#fecaca; }

/* ===== Responsive for rows ===== */
@media (max-width: 1024px){
  .row{ grid-template-columns: 1.4fr 1fr 1fr; }
  .row .col-hide-md{ display:none; }
}
@media (max-width: 640px){
  .row{ grid-template-columns: 1fr; }
  .row.header{ display:none; }
  .row > div{ display:flex; justify-content:space-between; gap:8px; border-top:1px dashed var(--line); padding-top:6px; }
  .row > div:first-child{ border-top:none; padding-top:0; }
  .row .label{ color:#334155; font-weight:700; }
}

@media print {
  .right,
  .button-group,
  #search,
  #tabs {
    display: none !important;
  }
  body {
    margin: 0;
    padding: 40px;
    font-family: 'Times New Roman', serif;
    background: #fff;
  }
  .left {
    width: 100% !important;
    border: none;
  }
  .receipt {
    display: block !important;
  }
  table {
    font-size: 12px;
  }
}

body {
  display: flex;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f7f7f7;
}

.left,
.right {
  padding: 20px;
  height: 100vh;
  overflow-y: auto;
  background: #fff;
}

.left {
  width: 60%;
  border-right: 1px solid #e6e6e6;
}

.right {
  width: 40%;
}

h2 {
  margin: 0 0 8px;
}

h3 {
  margin: 16px 0 8px;
  font-size: 16px;
}

label {
  font-size: 13px;
  color: #333;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
input[type="file"] {
  width: 100%;
  height: 28px;
  padding: 4px 6px;
  margin: 4px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 13px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

table,
th,
td {
  border: 1px solid #ccc;
}

th {
  background: #175e7d;
  color: #fff;
  font-size: 12px;
  padding: 6px 8px;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 4px 6px;
}

.table-wrap {
  overflow-x: auto;
}

.totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
}

.totals div {
  text-align: right;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.button-group {
  margin-top: 16px;
}

.button-group button {
  height: 32px;
  padding: 0 14px;
  background: #175e7d;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #e6e6e6;
  margin-bottom: 8px;
}

.tab {
  padding: 6px 10px;
  font-size: 13px;
  color: #333;
  background: #f4f7fa;
  border: 1px solid #d9e2ea;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.tab.active {
  background: #fff;
  font-weight: 600;
  color: #000;
  border-color: #ccd7e0;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.tab-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.tab-tools input[type="text"] {
  flex: 1;
  height: 28px;
}

.btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid #175e7d;
  color: #175e7d;
  background: #fff;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn:hover {
  background: #175e7d;
  color: #fff;
}

.record {
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
}

.muted {
  color: #666;
  font-size: 12px;
}

.badge {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
}

.badge.UNPAID {
  background: #fff2f2;
  color: #a11;
  border: 1px solid #ffd6d6;
}

.badge.PARTIAL {
  background: #e6f7ff;
  color: #1769aa;
  border: 1px solid #bfe6ff;
}

.badge.PAID {
  background: #e6ffe9;
  color: #1a7f37;
  border: 1px solid #bff0c7;
}

.badge.REFUNDED {
  background: #eee;
  color: #555;
  border: 1px solid #ddd;
}

.receipt {
  display: none;
  border: 1px dashed #ccc;
  padding: 12px;
  margin-top: 12px;
}

.files-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.file-chip {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #a11;
}
