/* PrintByte Admin – Stylesheet (an Shopify Admin / Polaris angelehnt) */
:root {
  --bg: #f1f2f4; --surface: #ffffff; --surface-muted: #f7f7f7; --border: #e3e3e3; --border-strong: #8a8a8a;
  --text: #303030; --muted: #616161; --link: #005bd3;
  --primary: #303030; --primary-hover: #1a1a1a; --danger: #e51c00; --danger-hover: #b31000;
  --success-bg: #cdfee1; --success-text: #0c5132; --warning-bg: #ffd6a4; --warning-text: #5e4200;
  --critical-bg: #fed1d1; --critical-text: #8e0b21; --info-bg: #e0f0ff; --info-text: #00527c;
  --attention-bg: #ffeb78; --attention-text: #4f4700; --neutral-bg: #e3e3e3; --neutral-text: #303030;
  --radius: 8px; --radius-lg: 12px; --shadow: 0 1px 0 rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05);
  --topbar: 56px; --sidebar: 232px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; font-size: 13px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 8px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-muted); padding: 1px 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.hidden, [hidden] { display: none !important; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 16px; padding: 0 16px; background: #1a1a1a; color: #fff; }
.topbar__brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 14px; }
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: #00a8ff; color: #fff; font-size: 12px; font-weight: 700; }
.topbar__spacer { flex: 1; }
.topbar__link { color: #d4d4d4; }
.topbar__user { color: #d4d4d4; }
.topbar__menu { display: none; background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
.btn--inverse { color: #fff; }

/* Layout */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
.sidebar { background: #ebebeb; border-right: 1px solid var(--border); padding: 12px; position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav__link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); font-weight: 500; }
.nav__link:hover { background: #e0e0e0; text-decoration: none; }
.nav__link.is-active { background: #fff; box-shadow: var(--shadow); }
.nav__icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.nav__link.is-active .nav__icon { color: var(--text); }
.nav__count { margin-left: auto; background: var(--text); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.content { padding: 20px 24px 48px; max-width: 1240px; width: 100%; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: var(--topbar) 0 0 0; z-index: 25; height: auto; }
  .sidebar.is-open { display: block; }
  .topbar__menu { display: block; }
  .topbar__user, .topbar__link { display: none; }
  .content { padding: 16px; }
}

/* Seitenkopf */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-header__title { font-size: 20px; }
.page-header__back { display: inline-block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.page-header__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Karten */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 16px; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 0; }
.card__body { padding: 16px 20px; }
.card__body + .card__body { border-top: 1px solid var(--border); }
.card__footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card--flush .card__body { padding: 0; }
.card--muted { background: var(--surface-muted); box-shadow: none; border: 1px dashed var(--border-strong); }

/* Raster */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .grid--2, .grid--3, .grid--4, .grid--main { grid-template-columns: 1fr; } }
@media (min-width: 600px) and (max-width: 900px) { .grid--4 { grid-template-columns: 1fr 1fr; } }

/* Kennzahlen */
.stat { padding: 16px 20px; }
.stat__label { color: var(--muted); font-size: 12px; }
.stat__value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat__sub { color: var(--muted); font-size: 12px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-muted); }
.table .right { text-align: right; }
.table--compact th, .table--compact td { padding: 6px 8px; }
.row-link { color: var(--text); font-weight: 500; }
.cell-product { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-muted); flex-shrink: 0; }
.thumb--placeholder { display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.thumb--lg { width: 56px; height: 56px; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge--success { background: var(--success-bg); color: var(--success-text); }
.badge--warning { background: var(--warning-bg); color: var(--warning-text); }
.badge--critical { background: var(--critical-bg); color: var(--critical-text); }
.badge--info { background: var(--info-bg); color: var(--info-text); }
.badge--attention { background: var(--attention-bg); color: var(--attention-text); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: #fff; color: var(--text); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.btn:hover { background: #f7f7f7; text-decoration: none; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); }
.btn--outline-danger { color: var(--danger); border-color: var(--danger); }
.btn--plain { border: 0; background: none; box-shadow: none; padding: 4px 6px; color: var(--link); }
.btn--plain:hover { background: none; text-decoration: underline; }
.btn--sm { min-height: 26px; padding: 2px 8px; font-size: 12px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; }

/* Formulare */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field__label { display: block; font-weight: 500; margin-bottom: 4px; }
.field__help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.input, .select, .textarea { width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: var(--link); }
.textarea { min-height: 96px; resize: vertical; }
.input--sm { min-height: 28px; padding: 3px 8px; }
.input--num { width: 90px; text-align: right; }
.input--code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group__addon { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-muted); color: var(--muted); }
.checkbox { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.checkbox input { margin-top: 3px; }
.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.error-list { margin: 0 0 16px; padding: 12px 16px 12px 32px; background: var(--critical-bg); color: var(--critical-text); border-radius: var(--radius); }

/* Filterleiste */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input, .toolbar .select { width: auto; min-width: 180px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500; }
.tab:hover { background: var(--surface-muted); text-decoration: none; }
.tab.is-active { background: var(--neutral-bg); color: var(--text); }

/* Medien */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.media-item { position: relative; }
.media-item__img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-muted); }
.media-item:first-child .media-item__img { outline: 2px solid var(--link); }
.media-item:first-child::after { content: "Titelbild"; position: absolute; top: 6px; left: 6px; background: var(--link); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.media-item__actions { display: flex; gap: 2px; margin-top: 4px; justify-content: center; }
.media-item__name { font-size: 10px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); }
.dropzone input { margin-top: 8px; }

/* Varianten-Tabelle */
.variants-table { min-width: 900px; }
.variants-table .input { min-height: 30px; padding: 3px 8px; }
.variants-table .input--option { min-width: 150px; width: 100%; }
.variants-table th[data-option-col], .variants-table td[data-option-col] { min-width: 170px; }
.variants-table td { padding: 6px 8px; }
.variants-table .input--num { width: 84px; }
.variants-table .input--sku { width: 130px; }
.variants-table select.select { min-height: 30px; padding: 3px 8px; }

/* Mengen */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.qty button { width: 28px; height: 30px; border: 0; background: var(--surface-muted); cursor: pointer; }
.qty input { width: 56px; height: 30px; border: 0; text-align: center; }
.qty input:focus { outline: none; }
.low-stock td:first-child { box-shadow: inset 3px 0 0 var(--warning-text); }

/* Bestellungen */
.order-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.order-items td .props { color: var(--muted); font-size: 12px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; max-width: 360px; margin-left: auto; }
.totals .total { font-weight: 600; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; }
.address { line-height: 1.5; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 4px 0 4px 18px; font-size: 12px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.timeline time { color: var(--muted); margin-right: 6px; }
.sortable { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sortable li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface-muted); border-radius: var(--radius); }
.sortable li .grow { flex: 1; }

/* Flash */
.flash { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; }
.flash--success { background: var(--success-bg); color: var(--success-text); }
.flash--error { background: var(--critical-bg); color: var(--critical-text); }
.flash--info { background: var(--info-bg); color: var(--info-text); }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: 18px; line-height: 1; color: inherit; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card { width: 100%; max-width: 360px; }
.login__brand { text-align: center; margin-bottom: 20px; font-size: 16px; font-weight: 600; }
.login__logo { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: #00a8ff; color: #fff; font-weight: 700; margin-bottom: 8px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Einstellungen */
.tabs--settings { margin-bottom: 16px; padding: 4px; background: var(--neutral-bg); border-radius: var(--radius-lg); display: inline-flex; }
.tabs--settings .tab.is-active { background: #fff; box-shadow: var(--shadow); }
.hero-preview { display: block; width: 100%; max-width: 360px; border-radius: var(--radius); border: 1px solid var(--border); }
.policy-editor { min-height: 480px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; }
.user-row form { display: inline; }
