:root {
  --espresso: #2b211c;
  --coffee: #4a3327;
  --cream: #f4efe6;
  --cream-2: #ece3d3;
  --accent: #c0392b;
  --accent-2: #e6920a;
  --green: #1aa251;
  --ink: #1d1813;
  --muted: #8a7d6e;
  --card: #ffffff;
  --line: #e4dccd;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(43, 33, 28, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: var(--accent); }
.brandbar {
  background: linear-gradient(120deg, var(--espresso), var(--coffee));
  color: var(--cream);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.brandbar .logo { font-weight: 800; letter-spacing: 2px; font-size: 20px; }
.brandbar .sub { opacity: .8; font-size: 13px; }
.brandbar nav { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.brandbar nav a { color: var(--cream); text-decoration: none; font-size: 13px; opacity: .85; padding: 4px 8px; border-radius: 8px; }
.brandbar nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }

.wrap { max-width: 980px; margin: 0 auto; padding: 18px; }
.wrap-narrow { max-width: 560px; }
.wrap-wide { max-width: 1320px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }
.center { text-align: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.grid { display: grid; gap: 12px; }

label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  padding: 13px 18px; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .05s, filter .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--coffee); }
.btn.ghost { background: #fff; color: var(--coffee); border: 1px solid var(--line); }
.btn.green { background: var(--green); }
.btn.danger { background: #b3261e; }
.btn.full { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.gray { background: #eee; color: #555; }
.badge.blue { background: #e3f0ff; color: #1f6fd0; }
.badge.amber { background: #fff2d8; color: #a9700a; }
.badge.green { background: #def3e4; color: #157f3c; }
.badge.red { background: #fde2e0; color: #b3261e; }
.badge.purple { background: #efe1ff; color: #7a35c7; }

.hint { background: var(--cream-2); border-left: 4px solid var(--accent-2); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.warn { background: #fff4e5; border-left: 4px solid #e69c0a; }
.err { background: #fde2e0; border-left: 4px solid #b3261e; color: #7a1b15; }
.ok  { background: #def3e4; border-left: 4px solid #157f3c; }

/* visitor styles */
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.style-card { border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; }
.style-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.style-card .nm { font-weight: 700; font-size: 14px; }
.style-card .ds { font-size: 12px; color: var(--muted); margin-top: 3px; }
.photo-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; background: #fff; }
.preview-img { max-width: 100%; border-radius: 10px; max-height: 320px; display: block; margin: 10px auto; }

/* operator */
table.orders { width: 100%; border-collapse: collapse; font-size: 13px; }
table.orders th, table.orders td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.orders tr:hover { background: var(--cream); cursor: pointer; }
table.orders .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 10px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; }
.imgbox { background: #faf7f0; border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.imgbox img { max-width: 100%; max-height: 460px; border-radius: 8px; }
.codeblock { background: #2b211c; color: #f0e7d8; padding: 12px; border-radius: 10px; font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; }

.modal-bg { position: fixed; inset: 0; background: rgba(20,15,12,.55); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 20px; overflow:auto; }
.modal-bg.open { display: flex; }
.modal { background: var(--cream); border-radius: 16px; max-width: 1100px; width: 100%; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--cream); border-radius: 16px 16px 0 0; }
.modal-body { padding: 18px; }
.close-x { margin-left: auto; cursor: pointer; font-size: 22px; color: var(--muted); background: none; border: none; }

.toast-wrap { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--espresso); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; max-width: 360px; }
.toast.err { background: #b3261e; }
.toast.ok { background: #157f3c; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: 1fr; }
}
