/* Visual polish for the merchant pages, applied last. One calm system for both themes:
   - text in two strengths (--text, --text-muted); orange is for the main action and the current place only,
     never for ordinary words or numbers;
   - numbers and prices are strong and aligned (tabular figures), with the currency smaller beside them;
   - one card style, one field style, one button style. */

body.workspace, body.account-page { background: var(--bg); color: var(--text); font-size: 15px; }
body.workspace .shell, body.account-page .shell { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
body .topbar { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); box-shadow: none; }
.brand-mark { background: #011026; }
.brand, .brand small { color: var(--text); }
.brand small { color: var(--text-faint); }

/* Headings and small labels */
body h1 { font-size: 26px; font-weight: 800; letter-spacing: -.2px; color: var(--text); }
body h2 { color: var(--text); }
body h3 { color: var(--text); }
.eyebrow, .section-label { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: .2px; }
.eyebrow::before { background: var(--accent); width: 6px; height: 6px; }
.section-label::before { content: none; }
.intro, .hint, .access-card p, body p { color: var(--text-muted); }
body strong { color: var(--text); }
body.workspace .welcome-name { color: var(--text); }
.welcome-edit { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.welcome-edit:hover { color: var(--text); }

/* Links */
body.account-page a:not(.brand):not(.button), body.workspace main a:not(.button):not(.summary-tile):not([data-tab]):not(.channel-inbox-link) {
  color: var(--text); text-decoration-color: var(--line-strong);
}
body.workspace main a:not(.button):hover { text-decoration-color: var(--accent); }

/* Sidebar navigation: the current page is clear, the rest is quiet */
.workspace-sidebar { background: var(--surface); border-inline-start: 1px solid var(--line); }
.workspace-navigation { gap: 2px; }
.workspace-navigation a { color: var(--text-muted); font-weight: 700; border-radius: 10px; }
.workspace-navigation a .nav-icon { opacity: .9; }
.workspace-navigation a:hover { background: var(--surface-3); color: var(--text); }
.workspace-navigation a[aria-current="page"] { background: var(--surface-3); color: var(--text); box-shadow: inset -3px 0 0 var(--accent); }
.workspace-navigation a[aria-current="page"] .nav-icon { color: var(--accent); }
.workspace-sidebar-note { color: var(--text-faint); }

/* Top bar buttons */
.workspace-top-actions a, .workspace-top-actions button { background: var(--surface); border: 1px solid var(--line); color: var(--text); font-weight: 700; }
.workspace-top-actions a:hover, .workspace-top-actions button:hover { background: var(--surface-3); }
body .workspace-top-actions #logout { background: var(--surface); border-color: var(--line); color: var(--text); }
body .workspace-top-actions #logout:hover { border-color: var(--danger); color: var(--danger-text); background: var(--surface); }
.theme-toggle { width: 42px; height: 42px; justify-content: center; padding: 0 !important; }
.theme-toggle .ui-icon { width: 20px; height: 20px; }

/* Cards */
body.workspace .access-card, body.workspace .dashboard-service-card, body.workspace .settings-card, body.workspace .notifications-card,
body.workspace .dashboard-overview, body.workspace .readiness-card, body.workspace .service-card, body.workspace .automation-section {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: none;
}
.access-card h3, .service-card-heading h2, .service-card-heading h3 { color: var(--text); }

/* Numbers: strong, aligned, readable */
.summary-tile strong, body.workspace .summary-tile strong, .catalog-counter strong, .admin-overview strong,
.product-card-price, .catalog-price, .service-price, .subscription-countdown strong {
  font-variant-numeric: tabular-nums; color: var(--text); font-weight: 800;
}
body.workspace .summary-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
body.workspace .summary-tile:hover { border-color: var(--line-strong); box-shadow: none; }
body.workspace .summary-tile strong { font-size: 32px; line-height: 1.2; }
body.workspace .summary-tile small, .summary-tile small { color: var(--text-muted); }
body.workspace .summary-tile.is-alert { background: var(--warning-bg); border-color: var(--warning-line); box-shadow: none; }
body.workspace .summary-tile.is-alert strong { color: var(--warning-text); }
body.workspace .summary-tile.is-alert span::before { background: var(--accent); }

/* Prices: the number strong, the currency smaller and quieter */
.service-price { margin-inline-start: auto; font-size: 16px; }
.service-price small { margin-inline-start: 4px; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.product-card-price, .catalog-price { font-size: 1.25rem; }

/* Lists of rows (delivery zones, guidance) */
.service-list { gap: 0 !important; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.service-list-row { border: 0; border-radius: 0; background: transparent; padding: 13px 16px; font-size: 14px; }
.service-list-row + .service-list-row { border-top: 1px solid var(--line); }
.service-list-row:hover { background: var(--surface-3); }
.service-list-row strong { font-weight: 700; }
.service-text-button { color: var(--text-muted); font-weight: 700; font-size: 13px; border-radius: 6px; padding: 5px 8px; }
.service-text-button:hover { color: var(--text); background: var(--surface-3); }
.service-remove { color: var(--text-muted); }
.service-remove:hover { color: var(--danger-text); background: var(--danger-bg); }
.service-empty { color: var(--text-muted); }

/* Buttons */
.button { background: var(--accent); color: var(--on-accent); border-radius: 10px; font-weight: 800; transition: background .15s, border-color .15s; }
.button:hover { background: var(--accent-hover); }
.button.outline, .button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.button.outline:hover, .button.secondary:hover { background: var(--surface-3); border-color: var(--line-strong); }
.button.danger { background: var(--danger); color: #fff; }
.button:disabled { opacity: .5; }

/* Fields */
body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), body select, body textarea {
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); border-radius: 10px;
}
body input::placeholder, body textarea::placeholder { color: var(--text-faint); }
body input:focus, body select:focus, body textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
body label { color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* Tabs */
.page-tabs { border-bottom-color: var(--line); }
.page-tabs a { color: var(--text-muted); font-weight: 700; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a[aria-current="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* Statuses read as small badges, not as orange text */
.order-status, .merchant-status, .access-status, .status-value {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-line);
}
.channel-requirements li strong, body.workspace .channel-requirements li strong { color: var(--warning-text); }

/* Product cards */
body.workspace .product-card, .catalog-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: none; }
body.workspace .product-card:hover, .catalog-card:hover { border-color: var(--line-strong); }
.product-details-hint, .channel-summary-hint, .merchant-summary-more { color: var(--text-muted); }
.product-detail-information h3 { color: var(--text); }

/* Inbox */
.message-bubble.sender-agent:not(.grouped) .message-sender { color: var(--text-muted); }
.service-text-button:focus-visible, .button:focus-visible, .workspace-navigation a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Store avatar */
.dashboard-store-avatar, .store-icon, .merchant-avatar { color: var(--text); background: var(--surface-3); border-color: var(--line); }

/* Phones: the top bar keeps one line, with icon-only buttons (their text stays for screen readers). */
@media (max-width: 660px) {
  .workspace-top-actions { flex-wrap: nowrap; gap: 6px; }
  .workspace-top-actions a, .workspace-top-actions button { font-size: 0; width: 40px; height: 40px; padding: 0 !important; justify-content: center; gap: 0; }
  .workspace-top-actions .ui-icon { width: 20px; height: 20px; }
  .brand small { display: none; }
}

/* Channel logos keep their own brand colors, on a light tile in both themes */
.channel-provider-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.channel-provider-icon img { width: 30px; height: 30px; }

/* Assistant preview: looks like a familiar chat app (WhatsApp-like), with its own background in both themes. */
:root, [data-theme="dark"] {
  --chat-bg: #0b141a; --chat-dots: rgba(255,255,255,.035); --chat-head: #202c33; --chat-bar: #1f2c34;
  --chat-input: #2a3942; --chat-out: #005c4b; --chat-out-text: #e9edef; --chat-in: #202c33; --chat-in-text: #e9edef; --chat-note: #182229; --chat-note-text: #8696a0;
}
[data-theme="light"] {
  --chat-bg: #efeae2; --chat-dots: rgba(0,0,0,.045); --chat-head: #f0f2f5; --chat-bar: #f0f2f5;
  --chat-input: #ffffff; --chat-out: #d9fdd3; --chat-out-text: #111b21; --chat-in: #ffffff; --chat-in-text: #111b21; --chat-note: #fff5c4; --chat-note-text: #54656f;
}
body.workspace .preview-chat { background: var(--chat-bg); border-color: var(--line); }
.preview-chat .preview-heading { background: var(--chat-head); border-bottom: 0; }
.preview-contact h2 { color: var(--chat-in-text); }
.preview-contact div > span { color: var(--chat-note-text); }
.preview-avatar { background: #011026; }
.preview-messages { background: var(--chat-bg) radial-gradient(circle, var(--chat-dots) 1.2px, transparent 1.4px) 0 0 / 18px 18px; gap: 6px; padding: 18px 6%; }
.preview-chat-note { background: var(--chat-note); color: var(--chat-note-text); font-size: 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
.preview-bubble { max-width: 75%; padding: 7px 11px 8px; border-radius: 9px; font-size: 14.5px; line-height: 1.6; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
.preview-bubble.customer { background: var(--chat-out); color: var(--chat-out-text); border-start-start-radius: 0; }
.preview-bubble.assistant { background: var(--chat-in); color: var(--chat-in-text); border-start-end-radius: 0; }
.preview-bubble.customer + .preview-bubble.customer { border-start-start-radius: 9px; }
.preview-bubble.assistant + .preview-bubble.assistant { border-start-end-radius: 9px; }
.preview-chat #preview-form { background: var(--chat-bar); border-top: 0; }
body.workspace .preview-chat #preview-message { resize: none; background: var(--chat-input); color: var(--chat-in-text); border: 0; border-radius: 22px; }
.preview-chat #preview-message:focus { box-shadow: none; }
body.workspace .preview-chat .preview-image-button { background: transparent; border: 0; color: var(--chat-note-text); }
.preview-chat .preview-image-button:hover { background: color-mix(in srgb, var(--chat-note-text) 15%, transparent); }
.preview-chat #preview-send { background: #00a884; color: #fff; }
.preview-chat #preview-send:hover { background: #06cf9c; }
.preview-chat #preview-status { color: var(--chat-note-text); }

/* Account forms: "forgot password" sits right under the password field; the code step of password recovery */
.forgot-link { display: inline-block; margin: 8px 0 4px; font-size: 13px; font-weight: 700; color: var(--text-muted) !important; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.forgot-link:hover { color: var(--text) !important; text-decoration-color: var(--accent); }
.code-step { margin: 14px 0 0; padding: 0; border: 0; min-width: 0; }
.code-step #code { font-size: 22px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.text-link { margin-top: 10px; padding: 0; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.text-link:hover { color: var(--text); }
.text-link:disabled { opacity: .5; cursor: not-allowed; }
body.account-page .panel-bottom { font-size: 14px; }
body.account-page .panel-bottom a { color: var(--accent-text); }
.code-ok { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--success-bg); border: 1px solid var(--success-line); color: var(--success-text) !important; font-weight: 700; font-size: 14px; }
.code-ok .ui-icon { width: 20px; height: 20px; }

/* Admin: subscriptions ending soon */
.admin-alert { margin: 12px 0; padding: 12px 16px; border-radius: 12px; background: var(--warning-bg); border: 1px solid var(--warning-line); color: var(--warning-text); font-weight: 700; }
.admin-expiring { border-color: var(--warning-line) !important; }
.admin-expiring-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.admin-expiring-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.admin-expiring-name { font-weight: 800; color: var(--text) !important; }
.admin-overview strong.is-text { font-size: 20px; line-height: 1.5; }
.admin-expiring { margin-bottom: 20px; }
