@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn.woff2") format("woff2-variations"), url("fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Brand: Imana Electric (imanaelc.ir) - gold rgb(201,140,0) + navy #1C2434, from the site theme and logo. */
:root {
  --brand-gold: #C98C00;
  --brand-gold-2: #E0A526;
  --brand-navy: #1C2434;

  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --border: #e4e0d4;
  --text: #1C2434;
  --muted: #667085;
  --accent: #8f6400;          /* gold dark enough for text/links on white */
  --accent-2: #a87500;
  --accent-fill: #C98C00;     /* filled buttons: navy text on gold */
  --accent-fill-hover: #d99a0c;
  --on-accent: #1C2434;
  --accent-soft: #fbf1d7;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --ok: #1f8a4c;
  --ok-soft: #e4f5eb;
  --warn: #b35c00;
  --warn-soft: #fff0dc;
  --shadow: 0 1px 2px rgba(28, 36, 52, .06), 0 1px 3px rgba(28, 36, 52, .08);
  --radius: 12px;
  --header-bg: #1C2434;
  --header-text: #e9ecf2;
  --header-muted: #a9b2c3;
  --cat-associate: #2c5a9a; --cat-associate-soft: #e6eef9;
  --cat-manufacturer: #8a4b08; --cat-manufacturer-soft: #fbeedd;
  --cat-customer: #1f8a4c; --cat-customer-soft: #e4f5eb;
  --cat-supplier: #7c3aed; --cat-supplier-soft: #efe7fd;
  --cat-personal: #6b7280; --cat-personal-soft: #eef0f3;
  --cat-other: #475569; --cat-other-soft: #e9edf2;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121722; --surface: #1C2434; --surface-2: #232d40; --border: #313c52;
    --text: #e9ecf2; --muted: #9aa5b8; --accent: #E0A526; --accent-2: #f0b93e; --accent-fill: #E0A526; --accent-fill-hover: #f0b93e;
    --on-accent: #1C2434; --accent-soft: #3a2f14;
    --danger: #ef6a5b; --danger-soft: #3a1f1c; --ok: #4ccb7f; --ok-soft: #173224; --warn: #f0a44b; --warn-soft: #3a2a15;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --header-bg: #0d111a;
    --cat-associate: #7fb0f0; --cat-associate-soft: #1d2d45;
    --cat-manufacturer: #f0b464; --cat-manufacturer-soft: #3a2a15;
    --cat-customer: #5fd08f; --cat-customer-soft: #173224;
    --cat-supplier: #b58cf7; --cat-supplier-soft: #2c2140;
    --cat-personal: #a3adbb; --cat-personal-soft: #262d36;
    --cat-other: #a3adbb; --cat-other-soft: #283042;
  }
}
:root[data-theme="dark"] {
    --bg: #121722; --surface: #1C2434; --surface-2: #232d40; --border: #313c52;
    --text: #e9ecf2; --muted: #9aa5b8; --accent: #E0A526; --accent-2: #f0b93e; --accent-fill: #E0A526; --accent-fill-hover: #f0b93e;
    --on-accent: #1C2434; --accent-soft: #3a2f14;
    --danger: #ef6a5b; --danger-soft: #3a1f1c; --ok: #4ccb7f; --ok-soft: #173224; --warn: #f0a44b; --warn-soft: #3a2a15;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --header-bg: #0d111a;
    --cat-associate: #7fb0f0; --cat-associate-soft: #1d2d45;
    --cat-manufacturer: #f0b464; --cat-manufacturer-soft: #3a2a15;
    --cat-customer: #5fd08f; --cat-customer-soft: #173224;
    --cat-supplier: #b58cf7; --cat-supplier-soft: #2c2140;
    --cat-personal: #a3adbb; --cat-personal-soft: #262d36;
    --cat-other: #a3adbb; --cat-other-soft: #283042;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.4; }
h1 { font-size: 1.3rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--header-bg); color: var(--header-text); border-bottom: 3px solid var(--brand-gold);
  padding: 0 16px; padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: 14px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--header-text); white-space: nowrap; }
.brand img { width: 34px; height: 34px; display: block; flex-shrink: 0; }
.brand .name { color: var(--brand-gold-2); }
.brand small { font-weight: 500; color: var(--header-muted); }
.nav { display: flex; gap: 4px; margin-inline-start: 8px; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--header-muted); font-weight: 600; }
.nav a:hover { color: var(--header-text); background: rgba(255,255,255,.06); }
.nav a.active { color: var(--brand-navy); background: var(--brand-gold); }
.topbar .btn.ghost { color: var(--header-muted); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,.08); color: var(--header-text); }
.topbar .btn.primary { background: var(--brand-gold); border-color: var(--brand-gold); color: var(--brand-navy); }
.topbar .btn.primary:hover { background: var(--brand-gold-2); }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 8px; }
.userbox .who { font-size: .85rem; color: var(--header-muted); white-space: nowrap; }
.main { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
@media (min-width: 760px) { .main { padding-bottom: 32px; } }

.bottomnav {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-auto-flow: column; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; font-size: .72rem; color: var(--muted); }
.bottomnav a.active { color: var(--accent); font-weight: 700; }
.bottomnav svg { width: 22px; height: 22px; }
@media (min-width: 760px) { .bottomnav { display: none; } }
@media (max-width: 759px) { .nav { display: none; } .userbox .who { display: none; } }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.help-heading { display: inline-flex; align-items: center; gap: 7px; position: relative; max-width: 100%; }
.help-trigger { width: 32px; min-width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--accent); cursor: pointer; font-weight: 800; font-size: 1rem; line-height: 1; }
.help-trigger:hover, .help-trigger[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
.help-popover { position: absolute; z-index: 12; inset-inline-start: 0; top: calc(100% + 7px); width: min(360px, calc(100vw - 32px)); padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.help-popover strong { display: block; margin-bottom: 5px; }
.help-popover p, .help-copy p { margin: 0 0 7px; line-height: 1.8; }
.help-popover ol, .help-copy ol { margin: 0 0 8px; padding-inline-start: 20px; line-height: 1.8; }
.help-page { max-width: 760px; }
.help-intro { margin: 6px 0 14px; color: var(--muted); line-height: 1.8; }
.help-filter { display: block; margin-bottom: 12px; }
.help-filter span { display: block; margin-bottom: 5px; font-size: .9rem; font-weight: 600; }
.help-topic { scroll-margin-top: 76px; }
.help-topic h2 { margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat .v { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.link { cursor: pointer; } .stat.link:hover { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; min-height: 38px; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent-fill-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: .85rem; border-radius: 8px; }
.btn.icon { padding: 6px; width: 38px; }
.btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 40px; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.6; }
.input.ltr { direction: ltr; text-align: left; }
.help { font-size: .8rem; color: var(--muted); }
.error { color: var(--danger); font-size: .9rem; }
.error-box { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }

.chips { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.chip.active { background: var(--brand-navy); border-color: var(--brand-navy); color: #fff; }
:root[data-theme="dark"] .chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); } }
.chip .n { opacity: .75; font-size: .75rem; margin-inline-start: 4px; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.7; }
.badge.associate { background: var(--cat-associate-soft); color: var(--cat-associate); }
.badge.manufacturer { background: var(--cat-manufacturer-soft); color: var(--cat-manufacturer); }
.badge.customer { background: var(--cat-customer-soft); color: var(--cat-customer); }
.badge.supplier { background: var(--cat-supplier-soft); color: var(--cat-supplier); }
.badge.personal { background: var(--cat-personal-soft); color: var(--cat-personal); }
.badge.other { background: var(--cat-other-soft); color: var(--cat-other); }
.badge.due { background: var(--danger-soft); color: var(--danger); }
.badge.soon { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.admin { background: var(--accent-soft); color: var(--accent); }

/* search & filters */
.searchbar { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 10; background: var(--bg); padding: 8px 0 6px; margin: -8px 0 6px; }
.search { position: relative; }
.search .input { padding-inline-start: 40px; min-height: 44px; font-size: 1rem; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.search .clear { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }
.saved-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.saved-filters { margin-top: 4px; }
.saved-filter { display: inline-flex; align-items: stretch; flex: none; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); overflow: hidden; }
.saved-filter .chip { border: 0; border-radius: 0; }
.saved-filter .chip.active { border-color: transparent; }
.saved-filter-menu { width: 34px; min-height: 34px; border: 0; border-inline-start: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-size: 1.15rem; line-height: 1; }
.saved-filter:has(.chip.active) { border-color: var(--brand-navy); background: var(--brand-navy); }
.saved-filter:has(.chip.active) .saved-filter-menu { border-color: rgba(255,255,255,.35); color: #fff; }
:root[data-theme="dark"] .saved-filter:has(.chip.active) { border-color: var(--accent-fill); background: var(--accent-fill); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .saved-filter:has(.chip.active) { border-color: var(--accent-fill); background: var(--accent-fill); } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.filters select { flex: 1; min-width: 120px; min-height: 36px; padding: 5px 10px; }

/* contact list */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: inherit; transition: border-color .12s;
}
.item:hover, .item:focus-visible { border-color: var(--accent); cursor: pointer; outline: none; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1rem; color: #fff; background: var(--cat-other); }
.avatar.associate { background: var(--cat-associate); } .avatar.manufacturer { background: var(--cat-manufacturer); }
.avatar.customer { background: var(--cat-customer); } .avatar.supplier { background: var(--cat-supplier); }
.avatar.personal { background: var(--cat-personal); } .avatar.big { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar.user-avatar { background: var(--avatar-color); flex: 0 0 auto; }
.avatar.user-avatar.sm { width: 32px; height: 32px; font-size: .8rem; }
/* the top bar is a fixed-height strip: a full-size avatar there pushes the logout button off the edge */
.avatar.user-avatar.xs { width: 26px; height: 26px; font-size: .68rem; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.item .t { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.item .t .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: .85rem; display: flex; gap: 6px; flex-wrap: wrap; }
.item .phone { direction: ltr; font-variant-numeric: tabular-nums; }
.item .act { display: flex; gap: 4px; }
.call { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); }
.call svg { width: 18px; height: 18px; }
.loadmore { text-align: center; padding: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }

/* contact detail */
.detail-head { display: flex; gap: 14px; align-items: center; }
.detail-head h1 { font-size: 1.25rem; }
.phones { display: flex; flex-direction: column; gap: 8px; }
.phone-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.phone-row .n { direction: ltr; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; flex: 1; text-align: left; }
.phone-row .lbl { color: var(--muted); font-size: .8rem; }
.phone-row .a { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.phone-row .a:hover { color: var(--accent); border-color: var(--accent); }
.phone-row .a svg { width: 17px; height: 17px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; align-items: baseline; }
.kv .k { color: var(--muted); font-size: .85rem; }
.pre { white-space: pre-wrap; }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.tl .ic { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.tl .ic svg { width: 17px; height: 17px; }
.tl .b { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.tl .m { font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl .m .del { margin-inline-start: auto; }

.phone-edit { display: grid; grid-template-columns: 1fr 110px auto auto; gap: 6px; align-items: center; }
@media (max-width: 600px) { .phone-edit { grid-template-columns: 1fr 96px auto auto; } }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }

/* dashboard bars */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-size: .9rem; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent-fill); border-radius: 999px; }
.bar a { color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar a:hover { color: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 380px; }
.auth { background: radial-gradient(1200px 500px at 50% -10%, rgba(201,140,0,.18), transparent 60%), var(--bg); }
.auth .brand { justify-content: center; flex-direction: column; margin-bottom: 18px; color: var(--text); gap: 6px; text-align: center; }
.auth .brand img { width: 72px; height: 72px; }
.auth .brand .name { color: var(--accent); font-size: 1.25rem; }
.auth .brand small { color: var(--muted); }
.auth .card { border-top: 4px solid var(--brand-gold); }
.site-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 14px; }

/* toast */
.toast { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom)); inset-inline: 0; margin: 0 auto; width: max-content; max-width: 90%; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); font-size: .9rem; }
.toast.err { background: var(--danger); color: #fff; }
@media (min-width: 760px) { .toast { bottom: 24px; } }

.skeleton { height: 60px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.fab { position: fixed; bottom: calc(70px + env(safe-area-inset-bottom)); inset-inline-start: 16px; width: 54px; height: 54px; border-radius: 16px; background: var(--brand-gold); color: var(--brand-navy); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(201, 140, 0, .4); z-index: 15; }
.fab svg { width: 26px; height: 26px; }
@media (min-width: 760px) { .fab { display: none; } }

/* changelog & roadmap */
.tabs { display: flex; gap: 6px; margin: 4px 0 14px; }
.version { border-inline-start: 3px solid var(--brand-gold); }
.version h2 { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
/* a release title is a sentence, not a chip: it must wrap, or a long one pushes the page sideways on mobile
   (`.tag` is `white-space: nowrap` for contact tags, which is right there and wrong here) */
.version .tag { font-size: .8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 1px 8px; border-radius: 999px; white-space: normal; }
.version ul, .roadmap ul { margin: 8px 0 0; padding-inline-start: 0; list-style: none; }
.version li, .roadmap li { margin: 6px 0; }
.chg-type { display: inline-block; min-width: 54px; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 0 6px; margin-inline-end: 6px; text-align: center; }
.chg-type.new { background: var(--ok-soft); color: var(--ok); }
.chg-type.fix { background: var(--danger-soft); color: var(--danger); }
.chg-type.improve { background: var(--accent-soft); color: var(--accent); }
.chg-type.data { background: var(--cat-associate-soft); color: var(--cat-associate); }
.roadmap .size { font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; margin-inline-start: 6px; }
.roadmap .why { display: block; color: var(--muted); font-size: .85rem; }
.verlink { color: var(--muted); font-size: .8rem; }
/* avatars: category colours are light in dark mode, so use dark initials there */
:root[data-theme="dark"] .avatar { color: #121722; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: #121722; } }
@media (max-width: 759px) { .topbar .btn.primary { display: none; } .brand small { display: none; } }

/* ---- website integration ---- */
dialog.modal { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(18, 23, 34, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 14px 16px 18px; overflow: auto; }
.grid-stats.mini { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.grid-stats.mini .stat { padding: 8px 10px; }
.stat .v.small-v { font-size: 1rem; }
.ok-box { background: var(--ok-soft); color: var(--ok); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.note-bubble { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; }
.note-bubble .m { font-size: .78rem; color: var(--muted); }
.order-row .avatar, .event-row .avatar { background: var(--accent-soft); color: var(--accent); }
.event-row .avatar svg { width: 20px; height: 20px; }
.event-row { grid-template-columns: 42px 1fr auto; }
.event-row .act { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .event-row { grid-template-columns: 42px 1fr; } .event-row .act { grid-column: 1 / -1; justify-content: flex-start; } }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.prod-img { width: 96px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.price { color: var(--text); }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.spark span { flex: 1; background: var(--accent-fill); border-radius: 3px 3px 0 0; min-width: 2px; }
.dot { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #d64545; color: #fff; font-size: .7rem; line-height: 18px; text-align: center; font-weight: 700; }
.bottomnav a span .dot { margin-inline-start: 2px; }
.chip .n { font-weight: 700; }
tfoot th { color: var(--text); font-size: .9rem; }
.filters input[name=search] { min-width: 200px; }
@media (max-width: 600px) { .filters input[name=search] { flex-basis: 100%; } }
.spark { direction: ltr; }

/* ---- 0.5.0 ---- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 12px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.warn-v { color: var(--warn); }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Jalali date picker */
.jdate { position: relative; display: inline-block; }
.jdate-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-align: start; min-width: 170px; }
.jdate-btn svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.jdate.compact .jdate-btn { min-height: 30px; padding: 3px 10px; min-width: 150px; font-size: .85rem; }
.jdate-pop { position: absolute; z-index: 60; top: calc(100% + 4px); inset-inline-start: 0; width: 272px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 10px; }
.jdate-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.jdate-head button { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; }
.jdate-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jdate-grid .wd { font-size: .75rem; color: var(--muted); padding: 4px 0; }
.jdate-grid button { border: 0; background: transparent; height: 34px; border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; }
.jdate-grid button:hover { background: var(--surface-2); }
.jdate-grid button.today { outline: 1px solid var(--accent-fill); }
.jdate-grid button.sel { background: var(--accent-fill); color: var(--on-accent); font-weight: 700; }
.jdate-foot { display: flex; justify-content: space-between; margin-top: 6px; }

/* notifications */
.bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--header-muted); }
.bell:hover, .bell.active { background: rgba(255,255,255,.08); color: var(--header-text); }
.bell svg { width: 21px; height: 21px; }
.bell .dot { position: absolute; top: 2px; inset-inline-end: 0; }
.item.notif.unread { border-inline-start: 3px solid var(--brand-gold); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.toggle { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.toggle.inline { padding: 0 6px; white-space: nowrap; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent-fill); }

/* admin */
.stack-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; direction: ltr; }
.stack-bars .sb { flex: 1; display: flex; flex-direction: column-reverse; height: 100%; min-width: 4px; }
.stack-bars .sb span { display: block; width: 100%; }
.c1 { background: #2c5a9a; } .c2 { background: #1f8a4c; } .c3 { background: #C98C00; } .c4 { background: #7c3aed; } .c5 { background: #c2410c; } .c6 { background: #94a3b8; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 4px; vertical-align: middle; }
table.perf th, table.perf td { white-space: nowrap; }
table.perf td:first-child { white-space: normal; min-width: 130px; }

/* products */
.pct-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.pct-row select { width: auto; min-height: 36px; padding: 4px 8px; }
.sale-preview { padding-bottom: 6px; }
.item.selectable { grid-template-columns: auto 42px 1fr auto; }
.pick { display: grid; place-items: center; width: 28px; height: 42px; cursor: pointer; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent-fill); }
.sel-bar { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--brand-navy); color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
@media (min-width: 760px) { .sel-bar { bottom: 16px; } }
details summary { cursor: pointer; }
.stack-bars .sb { max-width: 28px; }

/* ---- 0.6.0 ---- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.8; background: var(--surface-2); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.tag button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 2px; font-size: .9rem; line-height: 1; opacity: .7; }
.tag.add { cursor: pointer; border: 1px dashed var(--border); background: transparent; }
.tag.add svg { width: 13px; height: 13px; }
.t-gray { background: #eceff3; color: #475569; } .t-gold { background: #fbf1d7; color: #8f6400; } .t-blue { background: #e6eef9; color: #2c5a9a; }
.t-green { background: #e4f5eb; color: #1f7a45; } .t-red { background: #fdecea; color: #b03a2e; } .t-purple { background: #efe7fd; color: #6d28d9; }
.t-orange { background: #fdeee4; color: #b4480c; } .t-teal { background: #e0f4f2; color: #0f766e; }
:root[data-theme="dark"] .tag:not(.add) { filter: brightness(.85) saturate(1.2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag:not(.add) { filter: brightness(.85) saturate(1.2); } }
.tag-picker { margin-top: 8px; padding: 10px; background: var(--surface-2); border-radius: 10px; }
.item .t .tag { font-size: .7rem; }
.group-h { margin: 14px 0 8px; font-size: 1rem; }
.item.task { grid-template-columns: auto 1fr auto; }
.item.task.done .name { text-decoration: line-through; color: var(--muted); }
.item.task.prio-high { border-inline-start: 3px solid var(--danger); }
.item.task .s a { color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; align-self: flex-start; }
.seg label { cursor: pointer; }
.seg input { display: none; }
.seg span { display: block; padding: 7px 16px; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: var(--brand-navy); color: #fff; }
.seg label:first-child input:checked + span { background: #b03a2e; }
.seg label:last-child input:checked + span { background: #1f7a45; }
.adj-row { margin-bottom: 0; }
.adj-preview { padding-bottom: 6px; }
.nav .dot, .bottomnav .dot { margin-inline-start: 3px; }
.item .s svg { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 600px) { .pct-row .row, form[data-pa-form] .row { flex-wrap: wrap !important; } .pct-row select { max-width: 100%; } }

/* ---- 0.7.0 deals ---- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { flex: 0 0 240px; background: var(--surface-2); border-radius: 12px; padding: 8px; min-height: 120px; }
.col.over { outline: 2px dashed var(--accent-fill); }
.col-h { display: flex; justify-content: space-between; font-weight: 700; padding: 2px 4px 8px; }
.col-b { display: flex; flex-direction: column; gap: 8px; }
.col-empty { color: var(--muted); text-align: center; padding: 14px 0; font-size: .85rem; }
.col-closed { flex-basis: 150px; }
.col-closed .col-drop { color: var(--muted); font-size: .8rem; text-align: center; padding: 18px 6px; border: 1px dashed var(--border); border-radius: 8px; }
.col-closed.lost .col-h span:first-child { color: var(--danger); }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: grab; box-shadow: var(--shadow); }
.deal-card:hover { border-color: var(--accent); }
.deal-card.dragging { opacity: .5; }
.deal-title { display: inline-flex; align-items: center; gap: 6px; }
.deal-stale { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }
.deal-stale.amber { background: #d97706; box-shadow: 0 0 0 2px color-mix(in srgb, #d97706 18%, transparent); }
.deal-stale.red { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-soft); }
.clip1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; top: 100%; inset-inline: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.15); max-height: 260px; overflow: auto; }
.dropdown:empty { display: none; }
.dropdown button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: transparent; cursor: pointer; }
.dropdown button:hover { background: var(--surface-2); }
.field { position: relative; }
table.items td { padding: 4px 4px; }
.sm-in { min-height: 34px; padding: 4px 8px; }
.totals { text-align: start; }
/* printable pre-invoice */
.print-page .topbar, .print-page .bottomnav, .print-page .fab { display: none !important; }
.print-page .main { padding: 0; }
.sheet { max-width: 820px; margin: 0 auto 30px; background: #fff; color: #111; padding: 28px 32px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.sheet-h { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #C98C00; padding-bottom: 12px; }
.sheet-brand { font-size: 1.3rem; font-weight: 800; color: #8f6400; }
.sheet-title { font-size: 1.4rem; font-weight: 800; }
.sheet-meta { text-align: start; }
.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; }
.sheet-parties .k { font-size: .8rem; color: #777; margin-bottom: 2px; }
.sheet-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.sheet-table th, .sheet-table td { border: 1px solid #ccc; padding: 6px 8px; }
.sheet-table th { background: #f3efe4; }
.sheet-table tfoot td { font-weight: 600; }
.sheet-table tr.grand td { background: #fbf1d7; font-weight: 800; font-size: 1.05rem; }
.sheet-notes { margin: 12px 0 0; }
.sheet-f { margin-top: 24px; border-top: 1px solid #ddd; padding-top: 10px; }
@media print { body { background: #fff; } .no-print { display: none !important; } .sheet { border: 0; margin: 0; max-width: none; padding: 0; } #toast { display: none; } @page { size: A4; margin: 14mm; } }
.nav a { white-space: nowrap; padding: 6px 10px; }
.topbar-inner { gap: 10px; }
@media (max-width: 1050px) { .brand small { display: none; } .userbox .who { display: none; } }
/* R20 added «تقویم» to the desktop nav and the bar no longer fit in the page's 1100 px column at 1366 px. The bar
   is full-width anyway, so it may use up to 1300 px; below that the «مخاطب جدید» button drops its label (the +
   stays), then the nav tightens. Never `overflow: hidden` here — it would hide the logout button instead of the
   problem (the visual suite measures what is on screen, not what is clipped). */
@media (max-width: 1359px) { .topbar .btn.primary .lbl { display: none; } }
@media (min-width: 760px) and (max-width: 1200px) {
  .topbar-inner { gap: 6px; }
  .nav { gap: 1px; margin-inline-start: 2px; }
  .nav a { padding-inline: 6px; }
}
/* 760–1023 px (a tablet on its side): even tightened, ten links do not fit — the nav strip scrolls sideways
   instead of pushing the user box off screen. */
@media (min-width: 760px) and (max-width: 1023px) {
  .nav { flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
}
/* 0.8.0 — feedback & suggestions */
.fb-item h3 { font-size: 1.05rem; }
.fb-body { white-space: pre-wrap; margin: 10px 0 6px; line-height: 1.8; }
.fb-note { background: var(--accent-soft); border-inline-start: 3px solid var(--accent); border-radius: 8px; padding: 8px 12px; margin-top: 8px; font-size: .9rem; white-space: pre-wrap; line-height: 1.8; }
.fb-note.dev { background: var(--ok-soft); border-color: var(--ok); }
.fb-review { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
[data-fb-kinds] .chip { display: inline-flex; align-items: center; gap: 6px; }
[data-fb-kinds] .chip svg { width: 15px; height: 15px; }
.fb-image { display: inline-flex; width: min(160px, 100%); margin: 0 0 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.fb-image img { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 9px; }
/* 0.9.0 — login eye toggle, theme toggle, order activity badge */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap .input { flex: 1; padding-inline-start: 40px; }
.pw-eye { position: absolute; inset-inline-start: 4px; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; display: inline-flex; border-radius: 8px; }
.pw-eye:hover { color: var(--text); background: var(--surface-2, rgba(127,127,127,.12)); }
.pw-eye svg { width: 18px; height: 18px; }
.auth .remember { color: var(--muted); cursor: pointer; user-select: none; }
.theme-toggle svg { width: 20px; height: 20px; }
.badge.note-badge { display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.badge.note-badge svg { width: 12px; height: 12px; }
.order-act:not(:empty) { margin-inline-start: 2px; }

/* 0.10: instant catalogue picker (deal / pre-invoice items) */
#prod-q { min-width: 0; width: min(340px, 60vw); }
.dropdown button.active, .dropdown button:focus-visible { background: var(--surface-2); box-shadow: inset -3px 0 0 var(--accent-fill); }   /* RTL: bar on the start (right) edge */
.dropdown .pn { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dropdown .pn small { font-size: .78rem; }
.dropdown .num { white-space: nowrap; }
.dropdown .tag.src-acc, .dropdown .tag.src-site { font-size: .68rem; padding: 0 6px; line-height: 1.6; }
.dropdown .tag.src-site { background: color-mix(in srgb, var(--accent-fill) 14%, transparent); }
.by-chip { display: inline-block; margin-inline-start: 6px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; line-height: 1.6; white-space: nowrap; }
@media (max-width: 640px) { .picker-row { flex: 1 1 100%; } .picker-row #prod-q { flex: 1; width: auto; } }
/* phone numbers never break mid-number; on narrow screens the action buttons wrap below instead */
.phone-row { flex-wrap: wrap; }
.phone-row .n { white-space: nowrap; min-width: 9.5em; }
.phone-row .acts { display: flex; gap: 6px; margin-inline-start: auto; }

/* 0.11: price-list import review */
.pl-rows { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.pl-row { display: grid; grid-template-columns: 28px minmax(0, 1.3fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.pl-row.on { border-color: var(--accent-fill); box-shadow: inset -3px 0 0 var(--accent-fill); }
.pl-row.nomatch { opacity: .75; }
.pl-row .pl-desc { font-weight: 600; overflow-wrap: anywhere; }
.pl-row .pl-dst { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pl-row .pl-dst select { width: 100%; }
.pl-row .pl-price { display: flex; align-items: center; gap: 6px; white-space: nowrap; justify-content: flex-end; }
.pl-row .arrow { color: var(--muted); }
.pl-row .pl-price-in { width: 96px; text-align: end; }
.pl-row .pl-links { display: flex; gap: 4px; align-items: center; }
.pl-row .pl-site, .pl-row .pl-edit { flex: none; white-space: nowrap; font-size: .72rem; padding: 2px 8px; }
.pl-row .pl-edit { padding: 2px 6px; }
.pl-row .pl-dst { position: relative; }
.pl-search { position: relative; }
.pl-search .dropdown { inset-inline: 0; }
.pl-search .dropdown .pn { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-badge { display: inline-flex; }
.pl-check input { width: 20px; height: 20px; }
.badge.small { font-size: .72rem; align-self: flex-start; }
.pl-bar { position: sticky; }
.pl-job .act { display: flex; gap: 6px; }
@media (max-width: 760px) {
  .pl-row { grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "c s" "c d" "c p"; }
  .pl-row .pl-check { grid-area: c; align-self: start; }
  .pl-row .pl-src { grid-area: s; } .pl-row .pl-dst { grid-area: d; } .pl-row .pl-price { grid-area: p; justify-content: flex-start; }
  .pl-controls { grid-template-columns: 1fr 1fr; }
}
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 76px; padding: 12px; border: 2px dashed var(--border); border-radius: 12px; background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-within, .dropzone.has { border-color: var(--accent-fill); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }   /* the real input covers the zone: click + drag-and-drop both work */
.dropzone .dz-t { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.dropzone svg { width: 18px; height: 18px; }

/* roles & permissions (R16): one row per ability — a switch, its name and a plain-Persian line saying
   what it unlocks, so a non-technical manager can read the list top to bottom and understand it. */
.perm { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
.perm:hover { background: var(--surface-2); }
.perm.on { border-color: var(--accent); background: var(--accent-soft); }
.perm input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.perm > span { display: flex; flex-direction: column; gap: 2px; }
.perm.on strong { color: var(--accent); }
.perm input:disabled { opacity: .6; }
.perm:has(input:disabled) { cursor: default; opacity: .8; }
/* the save bar follows the list: 23 permissions is longer than a phone screen, and a button you have to
   scroll to the end to find is a button people miss */
.savebar { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); margin-top: 12px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
@media (min-width: 760px) { .savebar { bottom: 12px; } }

/* cheques: a row is a card; the ones past their date and the ones due this week are called out by a
   coloured edge, because «کدام چک این هفته سررسید دارد» is what the screen is for */
.chq { cursor: pointer; border-inline-start: 4px solid transparent; }
.chq:hover { border-color: var(--accent); }
.chq.soon { border-inline-start-color: var(--warn); }
.chq.overdue { border-inline-start-color: var(--danger); }
.stat .v.error { color: var(--danger); }
.error { color: var(--danger); }

/* an inline icon in running text or a heading (h3, strong, a) — everywhere else icons are sized by their
   container (.btn, .bottomnav, …); without this a bare SVG renders at its full 24-unit box scaled to the line */
h1 svg, h2 svg, h3 svg, strong svg, .small svg, p svg, .row > svg { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }

/* R36: one person's work log — a badge column and the text beside it */
.ur-list .item.ur { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; }
.ur-list .item.ur .badge { margin-top: 2px; }
.ur-list .item.ur .small { overflow-wrap: anywhere; }

/* R20: closed days in the Jalali picker (Friday + official holidays) and the note under the field */
.jdate-grid button.off { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.jdate-grid button.off.sel { color: #fff; }
.jdate-note { display: block; margin-top: 4px; font-size: .74rem; color: var(--danger); }

/* R20: a Jalali month is intentionally a seven-column grid even on a phone.  Cells shrink, never the page. */
.calendar { max-width: 1120px; margin: 0 auto; }
.cal-title { margin-bottom: 10px; }
.cal-title h1 { margin: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 8px 12px; }
.cal-head h2 { margin: 0; font-size: 1.08rem; }
.cal-head .icon { min-width: 36px; min-height: 36px; font-size: 1.25rem; }
.cal-filters { margin-bottom: 10px; }
.cal-year-note { margin: 0 0 10px; padding: 9px 11px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: .86rem; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 0 4px; }
.cal-grid { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: stretch; min-width: 0; min-height: 126px; padding: 7px; border: 0; background: var(--surface); color: var(--text); text-align: start; cursor: pointer; font: inherit; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.other-month { opacity: .52; }
.cal-cell.today .cal-num { outline: 1px solid var(--accent-fill); }
.cal-num { align-self: flex-start; display: grid; place-items: center; min-width: 25px; height: 25px; border-radius: 50%; font-variant-numeric: tabular-nums; font-weight: 700; }
.cal-cell.off { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.cal-closed { display: block; overflow: hidden; margin-top: 3px; color: var(--danger); font-size: .66rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.cal-previews { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin-top: 5px; }
.cal-preview, .cal-more { overflow: hidden; font-size: .72rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.cal-preview.followup { color: #0f766e; }.cal-preview.task { color: #2563eb; }.cal-preview.cheque { color: #b45309; }.cal-preview.order { color: #7c3aed; }
.cal-more { color: var(--muted); }
.cal-counts { display: none; gap: 3px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.cal-dot { display: inline-grid; min-width: 19px; height: 19px; place-items: center; padding: 0 4px; border-radius: 999px; color: #fff; font-size: .66rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-dot.followup { background: #0f766e; }.cal-dot.task { background: #2563eb; }.cal-dot.cheque { background: #b45309; }.cal-dot.order { background: #7c3aed; }
.cal-help { margin: 8px 0 16px; }
.cal-closures h2 { margin: 0; font-size: 1rem; }.cal-closures p { margin: 3px 0 0; }
.cal-closure { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }.cal-closure span { min-width: 0; overflow-wrap: anywhere; }
.cal-day-sheet { display: grid; gap: 16px; }.cal-day-sheet section h3 { margin: 0 0 7px; font-size: .95rem; }.cal-day-closed { margin: 0; padding: 9px 10px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: .86rem; }
.cal-item { display: block; padding: 9px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }.cal-item:last-child { border-bottom: 0; }.cal-item strong, .cal-item span { display: block; }.cal-item span { margin-top: 2px; color: var(--muted); font-size: .82rem; }
@media (max-width: 759px) { .cal-cell { min-height: 80px; padding: 4px; }.cal-num { min-width: 22px; height: 22px; }.cal-closed { font-size: .57rem; }.cal-previews { display: none; }.cal-dot { min-width: 16px; height: 16px; padding: 0 2px; font-size: .58rem; }.cal-counts { display: flex; gap: 2px; } }

/* R42b: the per-brand «we don't stock these» list on the price-list upload form */
.skip-box { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.skip-box summary { cursor: pointer; font-weight: 600; font-size: .85rem; }
.skip-box textarea { margin-top: 4px; }

/* R43: the app-wide search overlay */
#gsearch { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
#gsearch .gs-box { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.3); overflow: hidden; }
#gsearch .gs-in { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
#gsearch .gs-in .input { flex: 1; border: 0; background: transparent; font-size: 1rem; }
#gsearch .gs-in .input:focus { outline: none; box-shadow: none; }
#gsearch .gs-res { max-height: min(60vh, 460px); overflow: auto; }
#gsearch .gs-h { padding: 8px 12px 4px; font-size: .74rem; color: var(--muted); font-weight: 600; }
#gsearch .gs-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; color: inherit; text-decoration: none; }
#gsearch .gs-item:hover, #gsearch .gs-item:focus { background: var(--hover); }
#gsearch .gs-item svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
#gsearch .gs-item span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#gsearch .gs-note { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
#gsearch .gs-note span { font-size: .82rem; color: var(--muted); }

/* Price-list review: the unit warning. The one mistake that would put every price on the site at a tenth of
   its value, so it is loud and sits above the apply button. */
.pl-unit-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; line-height: 1.9;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.pl-unit-warn .btn { margin-inline-start: 6px; }

/* price-list review: the other colours of the matched model that get the same price */
.pl-also { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); cursor: pointer; }
.pl-also.off { text-decoration: line-through; opacity: .7; }
