/* Skinuri Barcode Generator — renderer styles */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #e3e6eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-logo { height: 60px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.app-header h1 { font-size: 18px; margin: 0; }
.subtitle { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.1fr);
  gap: 18px;
  padding: 22px;
  max-width: 1200px;
  margin: 0 auto;
}
.history-card { grid-column: 1 / -1; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.opt { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.control {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid #d3d7df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.control:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
.control.narrow { width: 88px; }
.control.mono { font-family: "Consolas", "Courier New", monospace; letter-spacing: 1px; }
.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.checkbox { font-weight: 500; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }

/* Segmented control */
.seg { display: inline-flex; background: #eef1f6; border-radius: 9px; padding: 3px; margin-bottom: 16px; }
.seg-btn {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 7px;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Buttons */
.primary-btn {
  border: 0; background: var(--brand); color: #fff; font: inherit; font-weight: 600;
  padding: 11px 16px; border-radius: 9px; cursor: pointer; transition: background .15s;
}
.primary-btn:hover { background: var(--brand-dark); }
.primary-btn:disabled { background: #aab4c4; cursor: not-allowed; }
.ghost-btn {
  border: 1px solid #d3d7df; background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  padding: 9px 13px; border-radius: 9px; cursor: pointer;
}
.ghost-btn:hover { background: #f6f8fb; }

/* Preview */
.preview-card { display: flex; flex-direction: column; }
.preview-empty {
  flex: 1; min-height: 150px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); border: 2px dashed #e1e5ec; border-radius: 10px; text-align: center; padding: 20px;
}
.preview-stage {
  display: flex; align-items: center; justify-content: center;
  background: repeating-conic-gradient(#f0f2f5 0% 25%, #fff 0% 50%) 50% / 18px 18px;
  border: 1px solid var(--line); border-radius: 10px; padding: 18px; min-height: 150px;
}
.label-paper {
  background: #fff; border: 1px solid #e6e8ee; border-radius: 4px;
  box-shadow: 0 4px 14px rgba(16,24,40,.12);
  padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 180px; max-width: 100%;
}
.label-shop { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.label-shop:empty, .label-name:empty, .label-price:empty { display: none; }
.label-name { font-size: 13px; font-weight: 600; text-align: center; }
.label-price { font-size: 16px; font-weight: 800; }
.label-barcode { max-width: 100%; height: auto; }

.label-controls { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; align-items: center; }
.label-controls .inline { font-size: 13px; }

/* History */
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.history-tools { display: flex; gap: 10px; align-items: center; }
.history-tools .control { width: 230px; }
.table-wrap { margin-top: 12px; position: relative; }
table.records { width: 100%; border-collapse: collapse; font-size: 13px; }
.records th, .records td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #eef0f4; }
.records th { color: var(--muted); font-weight: 600; font-size: 12px; }
.records td.code { font-family: "Consolas", monospace; letter-spacing: .5px; }
.actions-col { width: 1%; white-space: nowrap; }
.records-empty { padding: 24px; text-align: center; color: var(--muted); }
.icon-btn {
  border: 1px solid #d3d7df; background: #fff; border-radius: 7px; padding: 5px 9px;
  cursor: pointer; font: inherit; margin-left: 6px;
}
.icon-btn:hover { background: #f6f8fb; }
.icon-btn.danger { color: var(--danger); border-color: #f3c5c5; }
.icon-btn.danger:hover { background: #fef2f2; }

/* Settings modal */
.overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 22px; width: 440px; max-width: 100%;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.modal h2 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 11px 18px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 30; font-weight: 600; max-width: 90%;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

.app-footer {
  text-align: center;
  padding: 6px 22px 20px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .2px;
}
.app-footer strong { color: var(--brand); font-weight: 700; }

.hidden { display: none !important; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}
