/* =========================================================================
   Premier Dental Supply — design tokens and shared components.
   Used by the storefront (site.css) and both Blazor panels (panel.css).
   Logical properties (inline-start/end) everywhere, so RTL (Persian) works
   without a second stylesheet.
   ========================================================================= */
:root {
  --brand-950: #06192c;
  --brand-900: #0b2540;
  --brand-800: #0a3a66;
  --brand-700: #0a4c86;
  --brand-600: #0f6fae;
  --brand-500: #1e92d3;
  --brand-300: #8cc9ee;
  --brand-100: #dcefFb;
  --brand-50: #eef6fc;
  --mint-600: #0e9f91;
  --mint-500: #12b5a6;
  --mint-50: #e7f8f6;

  --ink: #0f1b2d;
  --ink-2: #334155;
  --muted: #5b6b7f;
  --line: #e3e8ef;
  --line-2: #cfd8e3;
  --surface: #f5f8fb;
  --surface-2: #eef3f8;
  --card: #ffffff;

  --success: #12805c;
  --success-50: #e7f6ef;
  --warning: #b45309;
  --warning-50: #fff4e5;
  --danger: #c0262d;
  --danger-50: #fdecec;
  --info: #0f6fae;
  --info-50: #eaf4fb;
  --violet: #6d4bd8;
  --violet-50: #f1edfd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06);
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 6px 18px -6px rgba(15, 27, 45, .10);
  --shadow-lg: 0 24px 60px -24px rgba(10, 58, 102, .35);
  --ring: 0 0 0 3px rgba(30, 146, 211, .28);

  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --container: 1240px;
}

[dir="rtl"] {
  --font-body: "Vazirmatn", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-head: "Vazirmatn", "Plus Jakarta Sans", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.01em; color: var(--ink); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: var(--brand-100); }

/* Icons: Material Symbols Rounded */
.ms {
  font-family: "Material Symbols Rounded";
  font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
  display: inline-block; white-space: nowrap; direction: ltr;
  -webkit-font-feature-settings: "liga"; font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  flex-shrink: 0; user-select: none;
}
.ms.filled { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* Text helpers */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.mono { font-family: var(--font-mono); font-size: .88em; letter-spacing: 0; }
.center { text-align: center; justify-content: center; }
.nowrap { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-600); margin: 0 0 .5rem; display: inline-flex; align-items: center; gap: .35rem; }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
.link { color: var(--brand-600); font-weight: 600; }
.link:hover { text-decoration: underline; }
.me-auto { margin-inline-end: auto; }
.mt { margin-top: 1.5rem; }
.pre-line { white-space: pre-line; }
.only-mobile { display: none !important; }
@media (max-width: 860px) {
  .only-mobile { display: inline-flex !important; }
  .only-desktop { display: none !important; }
}
.skip-link { position: absolute; inset-inline-start: 1rem; top: -60px; background: var(--brand-700); color: #fff; padding: .6rem 1rem; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 1rem; }
.hp { position: absolute !important; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px; padding: .55rem 1.1rem; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ms { font-size: 19px; }
.btn-sm { min-height: 34px; padding: .35rem .75rem; font-size: .85rem; border-radius: 9px; }
.btn-lg { min-height: 50px; padding: .7rem 1.4rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); color: #fff; box-shadow: 0 6px 14px -6px rgba(15, 111, 174, .55); }
.btn-primary:hover { background: linear-gradient(180deg, var(--brand-700), var(--brand-800)); }
.btn-secondary { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn-secondary:hover { background: var(--brand-100); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.is-on { color: var(--danger); border-color: #f3c2c4; background: var(--danger-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a31e24; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f3c2c4; }
.btn-danger-ghost:hover { background: var(--danger-50); }
.btn-accent { background: var(--mint-500); color: #fff; }
.btn-accent:hover { background: var(--mint-600); }
.btn-light { background: #fff; color: var(--brand-800); }
.btn-light:hover { background: var(--brand-50); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-outline-light:hover { background: rgba(255,255,255,.1); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Forms */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.form.single { grid-template-columns: 1fr; }
.form .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field label, .label-row label { font-weight: 600; font-size: .86rem; color: var(--ink-2); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .8rem; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type=color] { width: 56px; height: 44px; padding: 4px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; overflow: hidden; }
.input-group:focus-within { border-color: var(--brand-500); box-shadow: var(--ring); }
.input-group input { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
.input-prefix { display: grid; place-items: center; padding: 0 .7rem; background: var(--surface-2); color: var(--muted); font-size: .85rem; font-family: var(--font-mono); white-space: nowrap; }
.field-error, .field-validation-error { color: var(--danger); font-size: .82rem; font-weight: 500; }
.input-validation-error { border-color: var(--danger) !important; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: .25rem; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .92rem; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start .15s; }
.switch input:checked { background: var(--brand-600); }
.switch input:checked::after { inset-inline-start: 19px; }
.switch input:disabled { opacity: .5; }
.password-field { position: relative; }
.password-field input { padding-inline-end: 2.8rem !important; }
.password-field .icon-btn { position: absolute; inset-inline-end: 4px; top: 4px; }
.strength { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.search { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; }
.search .ms { position: absolute; inset-inline-start: .75rem; color: var(--muted); }
.search input { padding-inline-start: 2.4rem !important; }

/* Pills, badges, alerts */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill-success { background: var(--success-50); color: var(--success); }
.pill-warning { background: var(--warning-50); color: var(--warning); }
.pill-danger { background: var(--danger-50); color: var(--danger); }
.pill-info { background: var(--info-50); color: var(--info); }
.pill-brand { background: var(--brand-50); color: var(--brand-700); }
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius); font-size: .92rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert ul { margin: 0; padding-inline-start: 1rem; }
.alert-error { background: var(--danger-50); color: #8c1c21; border-color: #f6caca; }
.alert-error:empty, .validation-summary-valid { display: none; }
.alert-success { background: var(--success-50); color: #0d5f44; border-color: #bfe6d4; }
.alert-info { background: var(--info-50); color: var(--brand-800); border-color: var(--brand-100); }
.alert-warning { background: var(--warning-50); color: #8a4108; border-color: #f7d8b0; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1.1rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.35rem; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1.05rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .65rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafcfe; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; white-space: nowrap; }
.table .actions { text-align: end; white-space: nowrap; }
.table.compact td { padding: .55rem .75rem; }
.table td input { min-height: 36px !important; padding: .35rem .6rem !important; }
.table tr.dimmed { opacity: .6; }
.strike { text-decoration: line-through; margin-inline-end: .35rem; }

/* Toasts */
.toasts { position: fixed; inset-inline-end: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; z-index: 1000; max-width: min(420px, calc(100vw - 2.5rem)); }
.toast { display: flex; align-items: center; gap: .65rem; padding: .75rem .8rem .75rem 1rem; border-radius: var(--radius); background: var(--brand-900); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; }
.toast .icon-btn { color: rgba(255,255,255,.75); width: 30px; height: 30px; }
.toast .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.toast-success .ms:first-child { color: #5fe0b4; }
.toast-error { background: #5b1418; }
.toast-error .ms:first-child { color: #ff9a9f; }
.toast-text { flex: 1; font-size: .92rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6, 25, 44, .45); backdrop-filter: blur(2px); z-index: 900; }
.modal { position: fixed; inset-inline: 0; top: 6vh; margin: 0 auto; width: min(560px, calc(100vw - 2rem)); max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 901; animation: toast-in .2s ease-out; }
.modal-wide { width: min(760px, calc(100vw - 2rem)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 1.35rem; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.35rem; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Empty + skeleton */
.empty { text-align: center; padding: 2.5rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.empty-icon { font-size: 44px; color: var(--brand-300); margin-bottom: .4rem; }
.empty-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.empty .btn { margin-top: .8rem; }
.skeleton { height: 120px; border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--surface-2), #f7f9fc, var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton.tall { height: 380px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; flex-wrap: wrap; }
.pager-buttons { display: flex; align-items: center; gap: .5rem; }
.pager-page, .pager-info { color: var(--muted); font-size: .88rem; }

/* Avatar */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); color: #fff; font-weight: 700; font-size: .82rem; flex-shrink: 0; }

/* Tag chips */
.tag-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--line-2); background: #fff; font-size: .82rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tag-chip .dot, .tag-card .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tag); flex-shrink: 0; }
.tag-chip.on { border-color: color-mix(in srgb, var(--tag) 45%, white); background: color-mix(in srgb, var(--tag) 10%, white); color: color-mix(in srgb, var(--tag) 70%, black); }
