:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-input: #1c2128;
  --border: #30363d;
  --text-main: #e6edf3;
  --text-muted: #7d8590;
  --primary: #4493f8;
  --success: #3fb950;
  --danger: #f85149;
  --radius: 10px;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --border: #d0d7de;
  --text-main: #1f2328;
  --text-muted: #656d76;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.6; padding: 1.5rem 1rem 3rem; }
.tool-wrapper { max-width: 800px; margin: 0 auto; }

.tool-header { text-align: center; margin-bottom: 2rem; }
.tool-header__badge { display: inline-flex; align-items: center; gap: 0.4rem; background: rgba(68,147,248,0.1); border: 1px solid rgba(68,147,248,0.3); color: var(--primary); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.8rem; border-radius: 20px; margin-bottom: 1rem; }
.tool-header h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-main); margin-bottom: 0.5rem; }
.tool-header p { color: var(--text-muted); max-width: 560px; margin: 0 auto; font-size: 0.9rem; }

.calc-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card-heading { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 1rem; }

.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; margin-bottom: 1.25rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; margin-bottom: 1.25rem; }
.full-width  { grid-column: 1 / -1; }
.form-field  { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.input-field { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-size: 0.9rem; padding: 0.55rem 0.75rem; width: 100%; transition: border-color 0.15s; }
.input-field:focus { outline: none; border-color: var(--primary); }

.primary-btn   { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 0.6rem 1.5rem; font-size: 0.88rem; font-weight: 700; cursor: pointer; transition: opacity 0.15s; }
.primary-btn:hover { opacity: 0.88; }
.secondary-btn { background: transparent; color: var(--primary); border: 1px solid rgba(68,147,248,0.5); border-radius: 8px; padding: 0.6rem 1.25rem; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.secondary-btn:hover { background: rgba(68,147,248,0.08); }
.danger-btn    { background: transparent; color: var(--danger); border: 1px solid rgba(248,81,73,0.4); border-radius: 8px; padding: 0.6rem 1.25rem; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.danger-btn:hover { background: rgba(248,81,73,0.08); }

/* List section */
.list-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.85rem; }
.list-header .card-heading { margin-bottom: 0; }
.list-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.count-badge { background: rgba(68,147,248,0.15); color: var(--primary); font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 20px; vertical-align: middle; margin-left: 0.25rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--bg-input); color: var(--text-muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); font-size: 0.86rem; color: var(--text-main); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.sold-row td { opacity: 0.45; text-decoration: line-through; }
.sold-row .action-cell { text-decoration: none; opacity: 1; }

.action-cell { display: flex; gap: 0.4rem; white-space: nowrap; }
.sold-btn { background: rgba(63,185,80,0.1); color: var(--success); border: 1px solid rgba(63,185,80,0.3); border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sold-row .sold-btn { background: rgba(255,255,255,0.05); color: var(--text-muted); border-color: var(--border); }
.del-btn { background: rgba(248,81,73,0.1); color: var(--danger); border: 1px solid rgba(248,81,73,0.3); border-radius: 6px; padding: 0.2rem 0.5rem; font-size: 0.72rem; font-weight: 600; cursor: pointer; }

.summary-strip { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; }
.summary-strip strong { color: var(--text-main); }

.empty-state { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; font-size: 0.9rem; }

/* Print modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 999; display: flex; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto; }
.modal-inner { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 800px; }
.modal-controls { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; }

/* Print preview (always light) */
.print-preview { background: #ffffff; color: #1a1a1a; padding: 2rem; border-radius: 8px; }
.print-header  { border-bottom: 3px solid #1a1a1a; padding-bottom: 1rem; margin-bottom: 1.5rem; }
.print-title   { font-size: 1.5rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; color: #1a1a1a; margin-bottom: 0.25rem; }
.print-artist  { font-size: 0.88rem; color: #555; }
.print-grid    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.print-card    { border: 1px solid #ccc; border-radius: 8px; padding: 0.9rem; }
.print-card.sold-card { opacity: 0.4; }
.print-num     { font-size: 0.7rem; color: #999; margin-bottom: 0.2rem; }
.print-name    { font-size: 0.95rem; font-weight: 700; color: #1a1a1a; margin-bottom: 0.2rem; }
.print-meta    { font-size: 0.78rem; color: #555; margin-bottom: 0.4rem; }
.print-price   { font-size: 1.05rem; font-weight: 800; color: #1a1a1a; }
.print-notes   { font-size: 0.72rem; color: #777; margin-top: 0.3rem; font-style: italic; }

@media print {
  .no-print { display: none !important; }
  .modal { position: static; padding: 0; background: none; overflow: visible; }
  .modal-inner { border: none; padding: 0; box-shadow: none; }
  .print-preview { padding: 0; }
  body > .tool-wrapper { display: none; }
}

@media (max-width: 620px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .print-grid { grid-template-columns: repeat(2, 1fr); }
  .list-header { flex-direction: column; align-items: flex-start; }
}
