/* Design system shared by the storefront and the admin panel. Light is the default theme. */
:root {
  --primary: #0b78d0;
  --accent: #5bbcff;
  --radius: 16px;
  --bg: #f5f8fc;
  --bg-soft: #edf2f9;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --text: #0f1b2d;
  --muted: #5d6b82;
  --border: #e2e8f2;
  --border-strong: #cfd8e6;
  --success: #12a05c;
  --warning: #d98a00;
  --danger: #dc3545;
  --info: #0b78d0;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 3px rgba(15, 27, 45, .05);
  --shadow: 0 6px 24px -6px rgba(15, 27, 45, .12), 0 2px 6px rgba(15, 27, 45, .05);
  --shadow-lg: 0 24px 60px -18px rgba(11, 60, 120, .28);
  --primary-soft: color-mix(in srgb, var(--primary) 11%, var(--surface));
  --primary-strong: color-mix(in srgb, var(--primary) 82%, #000);
  --grad: linear-gradient(135deg, var(--primary), var(--accent));
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a1220;
  --bg-soft: #0f1a2c;
  --surface: #121d31;
  --surface-2: #17243b;
  --text: #e8eef8;
  --muted: #94a3bb;
  --border: #223148;
  --border-strong: #2e405c;
  --success: #34c781;
  --warning: #f0b23a;
  --danger: #f2616f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 28px -8px rgba(0, 0, 0, .55);
  --shadow-lg: 0 28px 70px -20px rgba(0, 0, 0, .7);
  --primary-soft: color-mix(in srgb, var(--primary) 20%, var(--surface));
  --primary-strong: color-mix(in srgb, var(--primary) 70%, #fff);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 15.5px; line-height: 1.6; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; transition: background-color .25s, color .25s; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.18; letter-spacing: -.02em; font-weight: 750; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.3rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--primary) 28%, transparent); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88em; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.hide { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
/* minmax(0, 1fr): a wide table or long word inside must scroll, never stretch the column past the screen */
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.icon { flex: none; vertical-align: -.18em; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: calc(var(--radius) * .7);
  border: 1px solid transparent; font-weight: 620; font-size: .95rem; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s, background-color .2s, border-color .2s, color .2s; position: relative; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-primary:hover { box-shadow: 0 12px 26px -8px color-mix(in srgb, var(--primary) 85%, transparent); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary-strong); }
.btn-soft:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-light { background: #fff; color: #0f1b2d; }
.btn-outline-light { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .45); backdrop-filter: blur(6px); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .2); }
.btn-sm { padding: 6px 12px; font-size: .86rem; border-radius: calc(var(--radius) * .55); }
.btn-lg { padding: 14px 26px; font-size: 1.03rem; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .5);
  border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-ghost.loading::after, .btn-soft.loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .2s, color .2s, transform .15s; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.field { display: grid; gap: 6px; }
.field-label { font-weight: 620; font-size: .88rem; }
.field-hint { font-size: .8rem; color: var(--muted); }
.input, .textarea, select.input { width: 100%; padding: 11px 14px; border-radius: calc(var(--radius) * .65); border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.input:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.check { display: inline-flex; gap: 9px; align-items: center; cursor: pointer; font-weight: 550; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-error { color: var(--danger); font-size: .9rem; font-weight: 550; }

/* searchable dropdown */
.select { position: relative; }
.select-display { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 7px 36px 7px 12px;
  border-radius: calc(var(--radius) * .65); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: left; }
.select-display > .icon { position: absolute; right: 12px; top: 14px; color: var(--muted); transition: transform .2s; }
.select.open .select-display { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
.select.open .select-display > .icon { transform: rotate(180deg); }
.select-placeholder { color: var(--muted); }
.select-panel { display: none; position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface);
  border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); box-shadow: var(--shadow); overflow: hidden; }
.select.open .select-panel { display: block; animation: pop .16s var(--ease); }
.select-search-wrap { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--muted); }
.select-search { border: 0; outline: 0; background: transparent; width: 100%; }
.select-list { max-height: 250px; overflow: auto; padding: 5px; }
.select-option { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.select-option small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.select-option.active, .select-option:hover { background: var(--bg-soft); }
.select-option.selected { color: var(--primary); font-weight: 620; }
.select-empty { padding: 14px; color: var(--muted); text-align: center; font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 10px; background: var(--primary-soft); color: var(--primary-strong);
  border-radius: 999px; font-size: .84rem; font-weight: 600; }
.chip-x { cursor: pointer; font-size: 1.05rem; line-height: 1; opacity: .7; }
.chip-x:hover { opacity: 1; }

/* cards, badges, tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 1.02rem; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 680;
  background: var(--bg-soft); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-completed, .badge-paid, .badge-published, .badge-active, .badge-sent, .badge-open { background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
.badge-processing, .badge-queued, .badge-bot { background: color-mix(in srgb, var(--info) 14%, var(--surface)); color: var(--info); }
.badge-pending, .badge-on_hold, .badge-unpaid, .badge-draft, .badge-waiting, .badge-idle { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); color: var(--warning); }
.badge-cancelled, .badge-failed, .badge-blocked, .badge-refunded { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .76rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 680;
  padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; flex-wrap: wrap; font-size: .9rem; }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-page { font-weight: 620; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 11px 16px; font-weight: 620; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.empty { text-align: center; padding: 54px 20px; }
.empty-icon { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--primary-soft); color: var(--primary); }
.empty h3 { margin-bottom: 6px; }

/* skeletons */
.skeleton-wrap { display: grid; gap: 12px; padding: 22px; }
.skeleton { height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border) 37%, var(--bg-soft) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* loading placeholders only show up when loading is slow, so quick page changes don't blink */
.skeleton-wrap { animation: skeleton-appear .2s ease .2s both; }
@keyframes skeleton-appear { from { opacity: 0; } }
/* page-change progress bar: the current page stays on screen while the next one loads */
.route-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0;
  background: var(--grad, var(--primary)); box-shadow: 0 0 10px var(--primary); transform: scaleX(0); transform-origin: left; }
.route-bar.on { opacity: 1; transform: scaleX(.85); transition: transform 6s cubic-bezier(.08, .7, .2, 1), opacity .15s ease; }
.route-bar.done { opacity: 0; transform: scaleX(1); transition: transform .2s ease, opacity .25s ease .15s; }

/* modal + toast */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(8, 15, 28, .55); backdrop-filter: blur(4px); display: grid; place-items: center;
  padding: 18px; animation: fade .18s ease; overflow-y: auto; }
.modal { width: min(540px, 100%); background: var(--surface); border-radius: calc(var(--radius) * 1.2); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .22s var(--ease); max-height: calc(100vh - 36px); display: flex; flex-direction: column; }
.modal-wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; overflow-y: auto; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.toasts { position: fixed; z-index: 400; right: 18px; top: 18px; display: grid; gap: 10px; max-width: min(400px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-weight: 550; font-size: .93rem; animation: slide-in .28s var(--ease); border-left: 4px solid var(--info); }
.toast-success { border-left-color: var(--success); }
.toast-success .icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error .icon { color: var(--danger); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .3s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

/* order timeline + files (customer account and admin) */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.tl-item.tl-admin .tl-dot { background: var(--bg-soft); color: var(--muted); }
.tl-item.tl-notification .tl-dot { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: var(--warning); }
.tl-msg { white-space: pre-wrap; word-break: break-word; }
.tl-meta { font-size: .8rem; color: var(--muted); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); background: var(--surface-2); }
.file-row .file-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.file-name { font-weight: 620; word-break: break-all; }

@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .card-pad { padding: 18px; }
  .table th, .table td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  /* delays must go too: an element that waits for a delayed animation stays invisible and then pops in */
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important;
    transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .skeleton-wrap { animation-delay: .2s !important; }   /* still hidden when loading is quick */
}
