/* 4Safe integration layer for the licensed Materialize admin template.
   Application behaviour remains in the existing protected SPA modules. */
:root {
  --color-primary: #146c63;
  --color-primary-dark: #0c4f49;
  --color-primary-light: #e4f4f0;
  --color-accent: #356ae6;
  --color-bg: #f5f5f9;
  --color-bg-soft: #eef1f5;
  --color-sidebar-bg: #262b43;
  --color-topbar-bg: #fffffff2;
  --color-surface: #fff;
  --color-surface-alt: #f8f8fa;
  --color-border: #e7e7ec;
  --color-border-strong: #d7d8df;
  --text-primary: #262b43;
  --text-secondary: #676a7b;
  --text-muted: #666b7d;
  --shadow: 0 3px 12px rgba(38, 43, 67, .06);
  --radius-md: 7px;
  --radius-lg: 9px;
  --radius-xl: 10px;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tenant-shell-page #app-root,
.admin-shell-page #app-root,
.tenant-shell-page #app { display: block; width: 100%; min-width: 0; }
.tenant-shell-page .app-shell,
.admin-shell-page .app-shell { width: 100%; max-width: none; grid-template-columns: 272px minmax(0, 1fr); background: var(--color-bg); }
.tenant-shell-page .sidebar,
.admin-shell-page .sidebar { background: var(--color-sidebar-bg); border: 0; padding: 24px 12px; }
.tenant-shell-page .brand,
.admin-shell-page .brand { padding: 0 10px 27px; color: #fff; gap: 11px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 9px; background: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.brand strong { display: block; font-size: 18px; letter-spacing: -.02em; line-height: 1.05; }
.brand small { display: block; margin-top: 3px; color: #a7acbd; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.tenant-shell-page .sidebar-heading,
.admin-shell-page .sidebar-heading { color: #b1b5c6; padding: 14px 11px 5px; font-size: 10px; }
.tenant-shell-page .sidebar-section,
.admin-shell-page .sidebar-section { gap: 3px; padding: 0; }
.tenant-shell-page .nav-item,
.admin-shell-page .nav-item { width: 100%; margin: 0; min-height: 39px; padding: 9px 11px; border-radius: 6px; color: #c9cad5; font-size: 13px; font-weight: 600; }
.tenant-shell-page .nav-item .ri,
.admin-shell-page .nav-item .ri { width: 18px; height: 18px; color: #a6a9b8; }
.tenant-shell-page .nav-item:hover,
.admin-shell-page .nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.tenant-shell-page .nav-item.active,
.admin-shell-page .nav-item.active { background: #146c63; box-shadow: none; color: #fff; }
.tenant-shell-page .nav-item.active .ri,
.admin-shell-page .nav-item.active .ri { color: #fff; }

.tenant-shell-page .main-panel,
.admin-shell-page .main-panel { padding: 28px 32px 52px; max-width: none; width: 100%; min-width: 0; margin: 0; }
.tenant-shell-page .topbar,
.admin-shell-page .topbar { min-height: 76px; margin: -28px -32px 28px; padding: 16px 32px; background: var(--color-topbar-bg); border-bottom: 1px solid var(--color-border); }
.tenant-shell-page .topbar h1,
.admin-shell-page .topbar h1 { color: var(--text-primary); font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.security-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #35b287; box-shadow: 0 0 0 3px rgba(53,178,135,.12); }

.tenant-shell-page .panel,
.admin-shell-page .panel { padding: 23px 24px; border-color: var(--color-border); box-shadow: var(--shadow); }
.tenant-shell-page .panel h2,
.admin-shell-page .panel h2 { margin-bottom: 8px; font-size: 16px; letter-spacing: -.01em; }
.admin-shell-page .billing-reconciliation-view > .panel { margin-bottom: 20px; }
.admin-shell-page .billing-reconciliation-view > .metric-grid { margin-bottom: 20px; }
.console-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 28px 30px; border-radius: 10px; background: linear-gradient(112deg, #262b43, #34405c); color: #fff; box-shadow: 0 10px 24px rgba(38,43,67,.14); }
.console-hero .eyebrow { color: #bcc3d5; }
.console-hero h2 { margin: 8px 0 7px; font-size: 24px; letter-spacing: -.025em; }
.console-hero p { color: #d5d9e4; max-width: 580px; font-size: 13px; line-height: 1.5; }
.console-hero .btn-primary { background: #fff; color: #262b43; box-shadow: none; white-space: nowrap; }
.metric-grid { margin-bottom: 22px; }
.metric-card { position: relative; min-height: 145px; display: flex; flex-direction: column; align-items: flex-start; padding: 20px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.metric-card > span:not(.metric-icon) { margin-top: 14px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.metric-card strong { margin-top: 2px; color: var(--text-primary); font-size: 28px; font-weight: 700; letter-spacing: -.04em; }
.metric-card small { margin-top: 4px; color: var(--text-muted); font-size: 11px; }
.metric-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 7px; background: #e4f4f0; color: #146c63; }
.metric-icon .ri { width: 18px; height: 18px; }
.metric-icon.blue { background: #eaf0ff; color: #356ae6; }.metric-icon.amber { background: #fff3dc; color: #d88a00; }.metric-icon.purple { background: #f1eafd; color: #8157cd; }

.btn { min-height: 37px; border-radius: 6px; padding: 8px 14px; font-size: 12px; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }.btn-primary { background: #146c63; box-shadow: 0 3px 8px rgba(20,108,99,.2); }.btn-primary:hover:not(:disabled) { background: #0c4f49; }.btn-outline { background: #fff; }.btn-danger { background: #e64949; }
.tenant-shell-page .btn-secondary:hover:not(:disabled),
.tenant-shell-page .btn-secondary:focus-visible,
.admin-shell-page .btn-secondary:hover:not(:disabled),
.admin-shell-page .btn-secondary:focus-visible { color: #0c4f49; background: #e4f4f0; border-color: #0c4f49; }
.input, select.input, textarea.input { min-height: 40px; border-radius: 6px; background: #fff; }.input:focus { box-shadow: 0 0 0 3px rgba(20,108,99,.12); }
.tenant-shell-page .auth-panel,
.admin-shell-page .auth-panel { min-height: calc(100vh - 180px); background: radial-gradient(circle at 22% 20%, #e4f4f0 0, transparent 27%); }
.tenant-shell-page .form-card,
.admin-shell-page .form-card { padding: 30px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; box-shadow: 0 18px 44px rgba(38,43,67,.1); }.form-card h2 { font-size: 22px; margin-bottom: 6px; }.form-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }
.admin-shell-page #catalog-lifecycle-form { width: min(100%, 560px); margin-top: 22px; padding: 24px; box-shadow: var(--shadow); }
.admin-shell-page #catalog-lifecycle-form h3 { margin: 0 0 10px; font-size: 18px; }
.admin-shell-page #catalog-lifecycle-form p { margin: 0 0 12px; line-height: 1.5; }
.admin-shell-page #catalog-lifecycle-form .field-label { display: block; margin: 16px 0 8px; }
.admin-shell-page #catalog-lifecycle-form textarea { display: block; width: 100%; min-height: 90px; }
.admin-shell-page #catalog-lifecycle-form small { display: block; margin-top: 7px; line-height: 1.45; }
.admin-shell-page #catalog-lifecycle-form .catalog-lifecycle-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; line-height: 1.45; }
.admin-shell-page #catalog-lifecycle-form .catalog-lifecycle-confirm input { flex: none; margin-top: 3px; }
.admin-shell-page #catalog-lifecycle-form .alert { margin: 14px 0 0; }
.admin-shell-page #catalog-lifecycle-form .button-row { margin-top: 20px; }
.admin-shell-page #catalog-lifecycle-form .btn-primary { width: auto; margin-top: 0; }
.admin-shell-page .catalog-price-entry + .catalog-price-entry { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--color-border); }
.admin-shell-page .catalog-price-entry small { display: block; margin-top: 3px; line-height: 1.4; }
.admin-shell-page .catalog-price-entry .btn { margin-top: 6px; }
.admin-shell-page #catalog-provider-price-form { width: min(100%, 560px); margin-top: 22px; padding: 24px; box-shadow: var(--shadow); }
.admin-shell-page #catalog-provider-price-form h3 { margin: 0 0 10px; font-size: 18px; }
.admin-shell-page #catalog-provider-price-form p { margin: 0 0 12px; line-height: 1.5; }
.admin-shell-page #catalog-provider-price-form .field-label { display: block; margin: 16px 0 8px; }
.admin-shell-page #catalog-provider-price-form .catalog-lifecycle-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 0; line-height: 1.45; }
.admin-shell-page #catalog-provider-price-form .catalog-lifecycle-confirm input { flex: none; margin-top: 3px; }
.admin-shell-page #catalog-provider-price-form .alert { margin: 14px 0 0; }
.admin-shell-page #catalog-provider-price-form .button-row { margin-top: 20px; }
.admin-shell-page #catalog-provider-price-form .btn-primary { width: auto; margin-top: 0; }
#promotion-create-panel > summary { cursor: pointer; color: var(--text-primary); font-size: 20px; font-weight: 700; }
#promotion-create-panel[open] > summary { margin-bottom: 18px; }
.tenant-shell-page .auth-shell,
.admin-shell-page .auth-shell { grid-template-columns: minmax(280px, 36%) minmax(0, 1fr); }
.tenant-shell-page .auth-shell .sidebar,
.admin-shell-page .auth-shell .sidebar { display: flex; justify-content: flex-start; padding-top: 40px; background: linear-gradient(160deg, #20263d, #2f3b58); }
.tenant-shell-page .auth-shell .topbar,
.admin-shell-page .auth-shell .topbar { display: none; }
.tenant-shell-page .auth-shell .main-panel,
.admin-shell-page .auth-shell .main-panel { padding: 0; }
.tenant-shell-page .auth-shell .auth-panel,
.admin-shell-page .auth-shell .auth-panel { min-height: 100vh; padding: 32px; background: radial-gradient(circle at 30% 15%, #dff3ee 0, transparent 30%), #f8f8fb; }
.tenant-shell-page .auth-shell .form-card,
.admin-shell-page .auth-shell .form-card { width: min(100%, 430px); }

.table-wrap { border: 1px solid var(--color-border); border-radius: 8px; }.data-table thead { background: #f8f8fa; }.data-table th { padding: 12px 16px; color: #666b7d; font-size: 10px; }.data-table td { padding: 15px 16px; color: #515569; }.data-table tbody tr { transition: background .15s ease; }.data-table tbody tr:hover { background: #fafafa; }
.operations-summary { display: flex; align-items: center; gap: 13px; margin: 0 0 18px; padding: 14px 16px; border-radius: 7px; border: 1px solid #d8eee8; background: #f1faf7; }.operations-summary strong { display: block; color: #0c4f49; font-size: 13px; }.operations-summary p { margin-top: 2px; font-size: 12px; }.status-indicator { width: 9px; height: 9px; border-radius: 50%; background: #35b287; box-shadow: 0 0 0 4px rgba(53,178,135,.13); }.status-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }.status-detail { min-width: 0; padding: 16px; border: 1px solid var(--color-border); border-radius: 8px; background: #fbfbfc; }.status-detail span { display: block; color: var(--text-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }.status-detail strong { display: block; margin-top: 7px; overflow-wrap: anywhere; color: var(--text-primary); font-size: 13px; line-height: 1.45; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 10px 14px; border-radius: 6px; background: #fff; color: #0c4f49; font-weight: 800; opacity: 0; pointer-events: none; transform: translateY(-150%); transition: opacity .15s ease, transform .15s ease; }
.skip-link:focus { opacity: 1; pointer-events: auto; transform: translateY(0); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid #356ae6; outline-offset: 3px; }
.mobile-menu-btn, .mobile-nav-scrim { display: none; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dependent-item-card .section-heading { flex-wrap: wrap; }
.dependent-item-card .section-heading > div { min-width: 0; }
.dependent-item-card .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.button-row, .toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.button-link { display: inline-flex; align-items: center; min-height: 34px; margin: 2px 4px 2px 0; padding: 7px 10px; border: 1px solid var(--color-primary); border-radius: 6px; background: #fff; color: var(--color-primary-dark); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.button-link:hover { background: var(--color-primary-light); }
.toolbar label { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.detail-list { display: grid; grid-template-columns: minmax(120px, auto) minmax(0, 1fr); gap: 10px 18px; }
.detail-list dt { color: var(--text-muted); font-size: 12px; font-weight: 800; }
.detail-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.alert { margin-bottom: 18px; padding: 13px 16px; border: 1px solid #c8d7ff; border-radius: 7px; background: #eef3ff; color: #244789; }
.alert-danger, .alert-error { border-color: #f4caca; background: #fff0f0; color: #9c2626; }
.alert-success { border-color: #bfe4d7; background: #eef9f5; color: #0c5c49; }
.skeleton-line { height: 14px; margin: 12px 0; border-radius: 6px; background: linear-gradient(90deg, #eef0f4 25%, #dfe2e8 50%, #eef0f4 75%); background-size: 200% 100%; animation: fs-shimmer 1.3s ease-in-out infinite; }
.skeleton-line:nth-child(2) { width: 82%; }.skeleton-line:nth-child(3) { width: 64%; }

@media (max-width: 860px) {
  .tenant-shell-page .app-shell, .admin-shell-page .app-shell { grid-template-columns: 1fr; }
  .tenant-shell-page .app-shell:not(.auth-shell) .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(292px, 86vw); min-height: 100dvh; padding: 18px 12px; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 36px rgba(11, 16, 35, .24); }
  .admin-shell-page .app-shell:not(.auth-shell) .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 80; width: min(292px, 86vw); min-height: 100dvh; padding: 18px 12px; overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 36px rgba(11, 16, 35, .24); }
  .tenant-shell-page .app-shell.mobile-nav-open .sidebar { transform: translateX(0); }
  .admin-shell-page .app-shell.mobile-nav-open .sidebar { transform: translateX(0); }
  .tenant-shell-page .app-shell:not(.auth-shell) .sidebar-section { display: grid; }
  .admin-shell-page .app-shell:not(.auth-shell) .sidebar-section { display: grid; }
  .tenant-shell-page .mobile-menu-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--color-border); border-radius: 7px; background: #fff; color: var(--text-primary); }
  .admin-shell-page .mobile-menu-btn { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--color-border); border-radius: 7px; background: #fff; color: var(--text-primary); }
  .tenant-shell-page .mobile-nav-scrim { position: fixed; inset: 0; z-index: 70; border: 0; background: rgba(18, 23, 42, .55); }
  .admin-shell-page .mobile-nav-scrim { position: fixed; inset: 0; z-index: 70; border: 0; background: rgba(18, 23, 42, .55); }
  .tenant-shell-page .app-shell.mobile-nav-open .mobile-nav-scrim { display: block; }
  .admin-shell-page .app-shell.mobile-nav-open .mobile-nav-scrim { display: block; }
  .tenant-shell-page .main-panel, .admin-shell-page .main-panel { padding: 20px 16px 36px; }
  .tenant-shell-page .topbar, .admin-shell-page .topbar { align-items: center; margin: -20px -16px 20px; padding: 12px 16px; }
  .tenant-shell-page .topbar-actions .btn { min-width: 42px; padding-inline: 10px; }
  .tenant-shell-page .auth-shell .sidebar, .admin-shell-page .auth-shell .sidebar { height: auto; min-height: 0; padding: 18px 20px; }
  .tenant-shell-page .auth-shell .auth-panel, .admin-shell-page .auth-shell .auth-panel { min-height: calc(100vh - 80px); padding: 20px 16px; }
  .console-hero { align-items: flex-start; flex-direction: column; padding: 24px; }.console-hero .btn { width: 100%; justify-content: center; }
  .tenant-shell-page .panel { padding: 18px 16px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .button-row .btn { flex: 1 1 140px; justify-content: center; }
  .detail-list { grid-template-columns: 1fr; gap: 4px; }
  .detail-list dd { margin-bottom: 10px; }
  .table-wrap { overflow: visible; border: 0; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .data-table tbody { display: grid; gap: 12px; }
  .data-table tbody tr { padding: 10px 14px; border: 1px solid var(--color-border); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
  .data-table tbody tr:hover { background: #fff; }
  .data-table td { display: grid; grid-template-columns: minmax(105px, 38%) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border); overflow-wrap: anywhere; }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
}

@media (max-width: 420px) {
  .tenant-shell-page .topbar h1 { font-size: 18px; }
  .tenant-shell-page .topbar .eyebrow { display: none; }
  .admin-shell-page .topbar h1 { font-size: 18px; }
  .admin-shell-page .topbar .eyebrow { display: none; }
  .tenant-shell-page .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tenant-shell-page .metric-card { min-height: 118px; padding: 16px; }
  .tenant-shell-page .metric-card strong { font-size: 24px; }
  .data-table td { grid-template-columns: 1fr; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
