/* Admin interface: every class is admin- prefixed */
.admin-shell {
  min-height: 100vh; display: flex; flex-direction: column; background: var(--sg-page);
  /* the shared buttons read the tire module variables */
  --tire-navy: var(--sg-navy); --tire-orange: var(--sg-orange); --tire-line: var(--sg-line);
}

.admin-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--sg-navy); color: #fff;
}
.admin-logo { color: #fff; font-weight: 800; text-decoration: none; font-size: 18px; }
.admin-logo span { color: var(--sg-orange); font-weight: 600; margin-left: 4px; }
.admin-logo:hover { color: #fff; }
.admin-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.admin-user form { margin: 0; }
.admin-link-button {
  background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px;
  padding: 4px 12px; font: inherit; cursor: pointer;
}
.admin-link-button:hover { border-color: var(--sg-orange); color: var(--sg-orange); }

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 24px;
  background: #fff; border-bottom: 1px solid var(--sg-line);
}
.admin-nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px; }
.admin-nav a.active { background: var(--sg-navy); color: #fff; }
.admin-nav .admin-nav-store { margin-left: auto; color: var(--sg-muted); }

.admin-main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; }
.admin-main h1 { margin: 8px 0 20px; font-size: clamp(22px, 2.6vw, 30px); }
.admin-main h2 { font-size: 18px; margin: 0 0 12px; }
.admin-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.admin-card {
  background: #fff; border: 1px solid var(--sg-line); border-radius: 12px;
  padding: 20px; margin-bottom: 20px;
}
/* sign-in: a card on a navy band, the header strip is the brand */
.admin-shell:has(.admin-sign-in) {
  background:
    radial-gradient(circle at 15% 0%, rgba(245, 158, 11, .18), transparent 40%),
    linear-gradient(180deg, var(--sg-navy) 0, var(--sg-navy-soft) 320px, var(--sg-page) 320px);
}
.admin-shell:has(.admin-sign-in) .admin-header { background: transparent; }
/* MudBlazor sets the body font from a variable only its theme provider defines, which this page has not */
.admin-shell:has(.admin-sign-in), .admin-sign-in input, .admin-sign-in button { font-family: var(--sg-font); }
.admin-sign-in {
  width: 100%; max-width: 420px; margin: clamp(16px, 6vh, 56px) auto 32px;
  background: var(--sg-card); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 48px -12px rgba(17, 24, 39, .35), 0 0 0 1px rgba(17, 24, 39, .06);
}
.admin-sign-in-head {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 32px 32px 24px;
  text-align: center; border-bottom: 1px solid var(--sg-line);
}
.admin-sign-in-mark {
  width: 56px; height: 56px; padding: 8px; margin-bottom: 10px; border-radius: 50%;
  color: var(--sg-orange); background: var(--sg-navy);
}
.admin-main .admin-sign-in-head h1 { margin: 0; font-size: 24px; }
.admin-sign-in-head p { margin: 0; color: var(--sg-muted); font-size: 14px; }
.admin-sign-in-body { padding: 24px 32px 28px; }
.admin-sign-in .admin-form { gap: 16px; }
.admin-sign-in .admin-field input:not([type=checkbox]) {
  padding: 11px 12px; border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.admin-sign-in .admin-field input:focus {
  outline: none; border-color: var(--sg-orange); box-shadow: 0 0 0 3px rgba(245, 158, 11, .25);
}
.admin-sign-in .admin-form > .tire-button { align-self: stretch; min-height: 46px; margin-top: 4px; font-weight: 700; }
.admin-sign-in .admin-alert { font-size: 14px; }
.admin-entra-button { display: flex; gap: 10px; min-height: 46px; text-align: center; text-decoration: none; }
.admin-entra-button svg { width: 18px; height: 18px; flex: none; }
.admin-separator { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--sg-muted); font-size: 13px; }
.admin-separator::before, .admin-separator::after { content: ""; flex: 1; border-top: 1px solid var(--sg-line); }
.admin-sign-in-back {
  display: block; padding: 14px; text-align: center; font-size: 14px; text-decoration: none;
  color: var(--sg-muted); background: var(--sg-surface); border-top: 1px solid var(--sg-line);
}
.admin-sign-in-back:hover { color: var(--sg-text); }
@media (max-width: 480px) {
  .admin-sign-in-head, .admin-sign-in-body { padding-left: 20px; padding-right: 20px; }
}
.admin-narrow { max-width: 520px; }

.admin-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-columns > .admin-card { margin-bottom: 0; }

.admin-form { display: flex; flex-direction: column; gap: 14px; }
.admin-form > .tire-button { align-self: flex-start; }
.admin-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; min-width: 0; }
.admin-field-row > .admin-field { flex: 1 1 160px; }
.admin-field > span { font-weight: 600; }
.admin-field input:not([type=checkbox]), .admin-field select, .admin-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff;
}
.admin-field input:focus, .admin-field select:focus, .admin-field textarea:focus { outline: 2px solid var(--sg-orange); outline-offset: 0; }
.admin-field .invalid { border-color: #dc2626; }
.admin-field-row { display: flex; flex-wrap: wrap; gap: 14px; }
.admin-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.admin-check input { width: 18px; height: 18px; }
.admin-theme-list { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.admin-theme-list legend { margin-bottom: 8px; font-weight: 700; }
.admin-theme { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--tire-line); border-radius: 12px; cursor: pointer; }
.admin-theme:has(input:checked) { border-color: var(--tire-orange); background: #fffbeb; }
.admin-theme input { width: 18px; height: 18px; flex: none; }
.admin-theme-swatches { display: flex; flex: none; }
.admin-theme-swatches span { width: 26px; height: 26px; margin-right: -6px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--tire-line); }
.admin-theme-text { display: flex; flex-direction: column; gap: 2px; margin-left: 6px; font-size: 14px; }
.admin-theme-text span { color: var(--tire-muted, #6b7280); }
.validation-message { color: #b91c1c; font-size: 13px; }
.validation-errors { color: #b91c1c; margin: 0; padding-left: 18px; font-size: 14px; }

.admin-filter {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  background: #fff; border: 1px solid var(--sg-line); border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.admin-filter .admin-field { flex: 0 1 240px; }
.admin-filter .admin-check { padding-bottom: 8px; }

.admin-alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; font-weight: 600; }
.admin-alert-ok { background: #dcfce7; color: #166534; }
.admin-alert-error { background: #fee2e2; color: #991b1b; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.admin-stat {
  display: flex; flex-direction: column; padding: 16px; border-radius: 12px; background: #fff;
  border: 1px solid var(--sg-line); text-decoration: none;
}
.admin-stat strong { font-size: 28px; line-height: 1.1; }
.admin-stat span { color: var(--sg-muted); font-size: 14px; }
a.admin-stat:hover { border-color: var(--sg-orange); }

.admin-count { color: var(--sg-muted); margin: 0 0 8px; }
.admin-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--sg-line); border-radius: 12px; }
.admin-card .admin-table-wrap { border: 0; border-radius: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--sg-line); vertical-align: middle; }
.admin-table th { background: var(--sg-surface); font-weight: 700; white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--sg-surface); }
.admin-num { text-align: right !important; white-space: nowrap; }
.admin-row-muted td { color: var(--sg-muted); }
.admin-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
/* on a MudBlazor field the class sits on the wrapper: the input itself takes the font over */
.admin-mono .mud-input-slot { font-family: inherit; }
.admin-message { color: var(--sg-muted); font-size: 13px; max-width: 360px; overflow-wrap: anywhere; }
.admin-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px;
  background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 600;
}
.admin-small { min-height: 32px !important; padding: 0 12px !important; font-size: 13px; }

.admin-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.admin-badge-ok { background: #dcfce7; color: #166534; }
.admin-badge-error { background: #fee2e2; color: #991b1b; }
.admin-badge-none { background: var(--sg-page); color: var(--sg-muted); }

.admin-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 14px; font-size: 14px; }
.admin-facts dt { color: var(--sg-muted); }
.admin-facts dd { margin: 0; overflow-wrap: anywhere; }
.admin-facts dl.admin-rules { grid-template-columns: 1fr; gap: 2px; }
.admin-facts dl.admin-rules dt { color: inherit; font-weight: 600; }
.admin-facts dl.admin-rules dd { margin-bottom: 8px; color: var(--sg-muted); }
.admin-note { color: var(--sg-muted); font-size: 13px; }
.admin-images h2 small { color: var(--sg-muted); font-size: 14px; font-weight: 600; }
.admin-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin: 0 0 20px; padding: 0; list-style: none; }
.admin-image-grid li { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--sg-line); border-radius: 12px; }
.admin-image-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #f8fafc; border-radius: 8px; }
.admin-image-grid small { color: var(--sg-muted); }
.admin-image-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-image-actions .tire-button { padding: 6px 12px; font-size: 13px; }
.admin-note summary { cursor: pointer; font-weight: 600; }
.admin-errors { margin: 0; padding-left: 18px; font-size: 14px; max-height: 360px; overflow-y: auto; }

/* ---------- orders ---------- */
.admin-stat-attention { border-color: var(--sg-orange); background: #fffbeb; }
.admin-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; vertical-align: middle; background: #e5e7eb; color: #374151; }
h1 .admin-status { font-size: 15px; }
.admin-status-uj { background: #fef3c7; color: #92400e; }
.admin-status-visszaigazolt { background: #dbeafe; color: #1e40af; }
.admin-status-teljesitett { background: #dcfce7; color: #166534; }
.admin-status-torolt { background: #fee2e2; color: #991b1b; }
.admin-emails { margin-top: 20px; }
.admin-email-pending { background: #fef3c7; color: #92400e; }
.admin-email-sent { background: #dcfce7; color: #166534; }
.admin-email-failed { background: #fee2e2; color: #991b1b; }
.admin-payment-pending { background: #fef3c7; color: #92400e; }
.admin-invoice-pending { background: #fef3c7; color: #92400e; }
.admin-invoice-issued { background: #dcfce7; color: #166534; }
.admin-invoice-failed { background: #fee2e2; color: #991b1b; }
.admin-invoice { margin-top: 20px; }
.admin-invoice form { margin-top: 10px; }
.admin-invoice-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.admin-invoice-actions form { margin-top: 0; }
.admin-correction td input { width: 80px; }
.admin-payment-succeeded { background: #dcfce7; color: #166534; }
.admin-payment-failed, .admin-payment-cancelled, .admin-payment-expired { background: #fee2e2; color: #991b1b; }
.admin-email-error { color: #991b1b; word-break: break-word; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.admin-table tfoot td, .admin-table tfoot th { border-top: 1px solid var(--sg-line); }

@media (max-width: 860px) {
  .admin-columns { grid-template-columns: 1fr; }
  .admin-header, .admin-nav, .admin-main { padding-left: 16px; padding-right: 16px; }
  .admin-user > span { display: none; }
}

/* fitting calendar */
h1 small { font-size: 16px; font-weight: 400; color: var(--sg-muted); margin-left: 8px; }
.admin-day-nav { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.admin-day-nav a[aria-current] { font-weight: 800; }
.admin-day-form { display: flex; align-items: flex-end; gap: 10px; margin-left: auto; }
.admin-empty { color: var(--sg-muted); }
.admin-calendar th[scope="row"] { width: 70px; vertical-align: top; }
.admin-calendar td { vertical-align: top; }
.admin-row-full > th, .admin-row-full > td.admin-num { color: #991b1b; }
.admin-appointment { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 8px 0; }
.admin-appointment + .admin-appointment { border-top: 1px dashed var(--sg-line); }
.admin-appointment .admin-actions { margin-top: 0; }
.admin-appointment.admin-row-muted { color: var(--sg-muted); }
.admin-appointment-note { margin: 4px 0 0; font-size: 14px; white-space: pre-line; }
.admin-status-foglalt { background: #dbeafe; color: #1e40af; }
.admin-status-nem-jott { background: #fde68a; color: #78350f; }

/* newsletter preview and destructive actions */
.admin-preview { white-space: pre-wrap; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; margin: 0 0 16px; }
.admin-danger { margin-top: 16px; }
.admin-danger .admin-link-button { color: #b91c1c; }

.admin-audit details summary { cursor: pointer; }
.admin-changes { display: block; max-width: 40rem; white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; }

.admin-content-preview { max-height: 420px; overflow: auto; padding: 4px 12px; border: 1px solid var(--sg-border, #e5e7eb); border-radius: 8px; font-size: 14px; }
.admin-content-form textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* ---------- feed profile: live check and flow diagram ---------- */
.feed-check { display: grid; gap: 8px; margin-top: 12px; }
.feed-check ul { margin: 4px 0 0; padding-left: 18px; }
.feed-check li + li { margin-top: 2px; }

.feed-flow { margin-top: 28px; padding: 20px; border: 1px solid var(--sg-line); border-radius: 16px; background: #fff; }
.feed-flow h2 { margin: 0 0 16px; font-size: 20px; }

.feed-flow-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; margin: 0 0 22px; padding: 0; list-style: none; counter-reset: feed-stage; }
.feed-flow-stages > li {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px;
  border: 1px solid var(--sg-line); border-top: 4px solid var(--sg-navy); border-radius: 12px; background: var(--sg-surface);
  font-size: 13px; counter-increment: feed-stage;
}
.feed-flow-stages > li > strong::before { content: counter(feed-stage) ". "; color: var(--sg-orange-dark); }
.feed-flow-stages > li:not(:last-child)::after {
  content: ""; position: absolute; top: 50%; right: -17px; width: 12px; height: 12px;
  border-top: 2px solid var(--sg-muted); border-right: 2px solid var(--sg-muted); transform: translateY(-50%) rotate(45deg);
}
.feed-flow-stages > li.feed-flow-stage-end { border-top-color: var(--sg-ok-strong, #16a34a); }
.feed-flow-stages small { color: var(--sg-muted); overflow-wrap: anywhere; }
.feed-flow-list { margin: 0; padding-left: 18px; color: var(--sg-muted); }

.feed-flow-map { display: grid; grid-template-columns: minmax(110px, 1fr) 28px minmax(180px, 2fr) 28px minmax(120px, 1fr) 28px minmax(110px, 1fr); }
.feed-flow-head, .feed-flow-row { display: contents; }
.feed-flow-head > span { padding: 0 6px 8px; color: var(--sg-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.feed-flow-row > * { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 6px; border-top: 1px solid var(--sg-line); }
.feed-flow-row:hover > * { background: var(--sg-hover, #f1f5f9); }
.feed-flow-arrow { position: relative; }
.feed-flow-arrow::before { content: ""; flex: 1; height: 2px; background: #cbd5e1; }
.feed-flow-arrow::after {
  content: ""; width: 7px; height: 7px; margin-left: -9px;
  border-top: 2px solid #94a3b8; border-right: 2px solid #94a3b8; transform: rotate(45deg);
}

.feed-flow-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 9px;
  border: 1px solid var(--sg-line); border-radius: 999px; background: #fff; font-size: 13px; overflow-wrap: anywhere;
}
.feed-flow-chip code { font-size: 12px; }
.feed-flow-source { border-color: #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.feed-flow-op { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.feed-flow-rule { border-color: #ddd6fe; background: #f5f3ff; color: #4c1d95; }
.feed-flow-field { border-color: var(--sg-navy); background: var(--sg-navy); color: #fff; font-weight: 600; }
.feed-flow-field.feed-flow-required::after { content: "*"; color: var(--sg-orange); }
.feed-flow-target { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.feed-flow-none { color: var(--sg-muted); font-size: 12px; font-style: italic; }

.feed-flow-map-details { flex-direction: column; align-items: stretch; border-radius: 12px; }
.feed-flow-map-details summary { cursor: pointer; }
.feed-flow-map-details ul { margin: 6px 0 2px; padding-left: 16px; }

.feed-flow-unused { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 16px 0 0; color: var(--sg-muted); font-size: 13px; }
.feed-flow-unused .feed-flow-chip { color: var(--sg-muted); background: var(--sg-surface); }

@media (max-width: 1100px) {
  .feed-flow-stages { grid-template-columns: 1fr; gap: 18px; }
  .feed-flow-stages > li:not(:last-child)::after { top: auto; right: auto; bottom: -15px; left: 24px; transform: rotate(135deg); }
}
@media (max-width: 760px) {
  .feed-flow-map { grid-template-columns: 1fr; }
  .feed-flow-head { display: none; }
  .feed-flow-row > * { border-top: 0; padding: 3px 0; }
  .feed-flow-row > :first-child { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sg-line); }
  .feed-flow-arrow { display: none; }
}

.admin-review-text { white-space: pre-line; max-width: 60ch; font-size: 0.875rem; }
