:root {
  --green-900: #123d2b;
  --green-800: #18523a;
  --green-700: #1f6b49;
  --green-600: #278457;
  --green-500: #35a66d;
  --green-100: #e8f5ed;
  --green-50: #f4faf6;
  --orange: #ff5a00;
  --ink: #14211b;
  --muted: #65726b;
  --line: #dce3df;
  --canvas: #f3f5f4;
  --white: #fff;
  --danger: #c83b36;
  --warning: #b76a00;
  --shadow: 0 12px 34px rgba(20, 50, 35, .09);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green-700); }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: 224px;
  background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  transition: width .2s ease; overflow: hidden;
}
.sidebar-head { height: 64px; flex: 0 0 64px; display: flex; align-items: center; border-bottom: 1px solid var(--line); position: relative; }
.brand { height: 64px; min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 0 0 16px; white-space: nowrap; text-decoration: none; color: var(--ink); cursor: pointer; }
.brand-mark { width: 34px; height: 34px; background: url("../logo/aleresgal_icon_master_clean.png") center/contain no-repeat; display: block; flex: 0 0 auto; font-size: 0; color: transparent; }
.brand-mark .brand-bang { display: none; }
.brand-name { color: var(--orange); font-size: 25px; font-weight: 750; letter-spacing: -.5px; }
.brand-name em { color: var(--ink); font-style: normal; }
.nav { padding: 8px 8px 46px; display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.nav-spacer { flex: 1 1 auto; min-height: 18px; }
.nav-caption { height: 40px; flex: 0 0 40px; padding: 18px 10px 6px; border-top: 1px solid #edf1ef; color: #8b948f; text-transform: uppercase; font-size: 9px; letter-spacing: 1.15px; white-space: nowrap; display: flex; align-items: flex-end; }
.nav-caption:first-of-type { margin-top: 2px; }
.nav a { position: relative; height: 40px; flex: 0 0 40px; display: flex; align-items: center; gap: 10px; padding: 0 10px; color: #3b4942; text-decoration: none; border-radius: 6px; white-space: nowrap; font-size: 13px; }
.nav a:hover { background: var(--green-50); color: var(--green-700); }
.nav a.active { background: var(--green-100); color: var(--green-800); font-weight: 650; box-shadow: inset 3px 0 var(--green-600); }
.nav-icon { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; }
.nav-icon svg, .account-symbol svg, .chevron svg { width: 18px; height: 18px; stroke: currentColor; }
.sidebar-footer { padding: 8px; border-top: 1px solid var(--line); white-space: nowrap; position: relative; flex: 0 0 auto; background: #fff; }
.account-menu-button { width: 100%; height: 40px; border: 0; border-radius: 6px; background: transparent; display: flex; align-items: center; gap: 10px; padding: 0 10px; color: var(--ink); cursor: pointer; text-align: left; font-size: 13px; }
.account-menu-button:hover, .account-menu-button[aria-expanded="true"] { background: var(--green-50); }
.account-menu-button .chevron { margin-left: auto; height: 18px; transition: transform .18s ease; }
.account-menu-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.account-submenu { display: none; position: absolute; left: 8px; right: 8px; bottom: 56px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: var(--shadow); z-index: 30; }
.account-submenu.open { display: grid; }
.account-submenu a { min-height: 36px; padding: 9px 10px; border-radius: 5px; color: #425048; text-decoration: none; font-size: 12px; }
.account-submenu a:hover, .account-submenu a:focus-visible { color: var(--green-700); background: var(--green-50); outline: 0; }
.account-symbol { width: 18px; height: 18px; color: var(--green-800); display: grid; place-items: center; flex: 0 0 auto; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--green-900); color: white; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.user-meta small { color: var(--muted); display: block; margin-top: 2px; }

.main { margin-left: 224px; min-width: 0; transition: margin-left .2s ease; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.top-title { display: none; font-weight: 700; }
.top-spacer { flex: 1; }
.top-account { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-left: 1px solid var(--line); }
.header-user-wrap { position: relative; margin-left: 8px; }
.header-user { display: flex; align-items: center; gap: 9px; padding: 6px 8px 6px 14px; border: 0; border-left: 1px solid #edf1ef; border-radius: 0 6px 6px 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.header-user:hover, .header-user[aria-expanded="true"] { background: var(--green-50); }
.header-user .avatar { width: 32px; height: 32px; font-size: 12px; }
.header-user strong { display: block; font-size: 13px; }
.header-user small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.header-user .chevron { width: 16px; height: 16px; margin-left: 3px; color: var(--muted); transition: transform .18s ease; }
.header-user[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.header-account-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); width: 220px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; box-shadow: var(--shadow); z-index: 40; }
.header-account-menu.open { display: grid; }
.header-account-menu a { min-height: 38px; padding: 10px; border-radius: 5px; color: #425048; text-decoration: none; font-size: 13px; }
.header-account-menu a:hover, .header-account-menu a:focus-visible { color: var(--green-700); background: var(--green-50); outline: 0; }
.header-account-menu .logout-item { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); border-radius: 0 0 5px 5px; color: var(--danger); font-weight: 700; }
.header-account-menu .logout-item:hover, .header-account-menu .logout-item:focus-visible { color: #a52e2a; background: #fff0ef; }
.allegro-a { color: var(--orange); font: 700 22px Georgia; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; color: #53605a; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--green-50); color: var(--green-700); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn[aria-pressed="true"] { background: var(--green-100); color: var(--green-700); }
.sidebar-toggle { font-size: 20px; }

body.nav-collapsed .sidebar { width: 60px; overflow: visible; }
body.nav-collapsed .main { margin-left: 60px; }
body.nav-collapsed .sidebar-head { overflow: visible; background: #fff; }
body.nav-collapsed .brand { display: flex; padding: 0 0 0 13px; }
body.nav-collapsed .sidebar .brand-name, body.nav-collapsed .nav-caption, body.nav-collapsed .nav-label, body.nav-collapsed .user-meta { display: none; }
body.nav-collapsed .nav { padding: 8px 6px 46px; overflow: visible; }
body.nav-collapsed .nav a { justify-content: center; padding: 0; overflow: visible; }
body.nav-collapsed .nav a.active { box-shadow: inset 3px 0 var(--green-600); }
body.nav-collapsed .nav a::after { content: attr(data-tooltip); position: absolute; left: 52px; top: 50%; transform: translateY(-50%) translateX(-4px); padding: 7px 9px; border-radius: 5px; background: var(--green-900); color: #fff; font-size: 12px; font-weight: 500; line-height: 1; opacity: 0; visibility: hidden; pointer-events: none; transition: .14s ease; box-shadow: var(--shadow); z-index: 50; }
body.nav-collapsed .nav a:hover::after, body.nav-collapsed .nav a:focus-visible::after { opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0); }
body.nav-collapsed .account-menu-button { justify-content: center; padding: 0; }
body.nav-collapsed .account-menu-button .nav-label, body.nav-collapsed .account-menu-button .chevron { display: none; }
body.nav-collapsed .account-submenu { left: 60px; right: auto; bottom: 8px; width: 210px; }
.nav a:focus-visible, .account-menu-button:focus-visible, .header-user:focus-visible, .brand:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }

.content { max-width: 1600px; margin: 0 auto; padding: 34px 38px 60px; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: var(--green-700); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; margin-bottom: 8px; }
h1 { font-size: 32px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -.8px; font-weight: 720; }
.lead { margin: 0; color: var(--muted); max-width: 760px; line-height: 1.55; }
.helper-link { border: 0; padding: 0; color: var(--green-700); background: transparent; text-decoration: underline; cursor: pointer; }
.page-actions { display: flex; gap: 10px; align-items: center; }
.updated { color: var(--muted); font-size: 12px; white-space: nowrap; }

.btn { min-height: 42px; border-radius: 4px; padding: 10px 17px; border: 1px solid var(--green-700); background: #fff; color: var(--green-800); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--green-50); }
.btn.primary { background: var(--green-700); color: #fff; }
.btn.primary:hover { background: var(--green-800); }
.btn.orange { border-color: var(--orange); color: var(--orange); }
.btn.orange:hover { background: #fff3eb; }
.btn.claude { border-color: #d77655; color: #a8492e; }
.btn.claude:hover { background: #fdf3ef; }
.btn-icon { width: 18px; height: 18px; border-radius: 4px; flex: 0 0 auto; }
.btn.danger { border-color: #e7b9b7; color: var(--danger); }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }

.card { background: #fff; border: 1px solid #e5eae7; box-shadow: 0 2px 5px rgba(25,55,39,.03); }
.card + .card { margin-top: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.card-header h2 { margin: 0; font-size: 18px; }
.card-body { padding: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 18px; }
.stat { background: white; padding: 18px; }
.stat strong { display: block; font-size: 26px; margin: 5px 0; }
.stat small { color: var(--muted); }
.account-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 18px; }
.account-summary-card { border: 0; box-shadow: none; }
.account-summary-card .card-body { display: grid; gap: 6px; min-height: 130px; align-content: start; }
.account-summary-card small { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.account-summary-card strong { display: block; font-size: 22px; line-height: 1.2; }
.account-form .modal-actions { border-top: 1px solid var(--line); }
.account-form-wide { grid-column: 1 / -1; }
.account-users-table { min-width: 860px; }

.filters { background: #fff; border: 1px solid var(--line); padding: 18px; margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 10px; align-items: end; }
.offers-filter-grid,
.inbox-filter-grid,
.employees-filter-grid { grid-template-columns: minmax(190px, 1.35fr) minmax(190px, 1fr) minmax(220px, 1fr) minmax(150px, .85fr) minmax(150px, .8fr); }
.companies-filter-grid,
.users-filter-grid { grid-template-columns: minmax(190px, 1.35fr) minmax(190px, 1fr) minmax(220px, 1fr) minmax(150px, .85fr) minmax(150px, .8fr); }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { color: #56625c; font-size: 12px; font-weight: 650; }
.input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #aeb8b2; border-radius: 3px; background: white; padding: 9px 11px; color: var(--ink); outline: 0; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #5f6b65 50%), linear-gradient(135deg, #5f6b65 50%, transparent 50%);
  background-position: calc(100% - 19px) 18px, calc(100% - 13px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.input:focus, select:focus, textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(39,132,87,.12); }
.search-wrap { position: relative; }
.admin-search-wrap { width: min(100%, 390px); margin-bottom: 18px; }
.search-wrap .input { padding-left: 38px; }
.search-wrap span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; color: var(--muted); font-size: 12px; }
.saved-note { color: var(--green-700); }
.multi-select { position: relative; }
.multi-select summary {
  width: 100%;
  min-height: 42px;
  border: 1px solid #aeb8b2;
  border-radius: 3px;
  background: #fff;
  padding: 9px 38px 9px 11px;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
  position: relative;
}
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid #7a8580;
  border-bottom: 2px solid #7a8580;
  transform: translateY(-70%) rotate(45deg);
}
.multi-select[open] summary { border-color: #7e8883; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.multi-panel {
  position: absolute;
  z-index: 60;
  top: calc(100% - 1px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  border: 1px solid #7e8883;
  background: #fff;
  box-shadow: 0 16px 30px rgba(20, 50, 35, .12);
  padding: 8px 0 12px;
}
.multi-panel label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 7px 16px;
  color: #2f3a35;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.multi-panel label:hover { background: var(--green-50); }
.multi-panel input {
  width: 23px;
  height: 23px;
  margin: 0;
  accent-color: #4f6dff;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: #94a099; }
.status-dot.active { background: #2aa669; box-shadow: 0 0 0 3px #def4e7; }
.status-dot.waiting { background: #e7a11b; box-shadow: 0 0 0 3px #fff0cf; }
.status-dot.ended { background: #d04b45; box-shadow: 0 0 0 3px #fae3e2; }
.status-dot.scheduled { background: #5977ff; box-shadow: 0 0 0 3px #e5eaff; }
.status-dot.draft { background: #9aa39e; box-shadow: 0 0 0 3px #eef1ef; }
.multi-apply {
  display: block;
  margin: 10px auto 0;
  border: 0;
  background: transparent;
  color: #08796b;
  font-weight: 850;
  letter-spacing: 3px;
  cursor: pointer;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}
.table-wrap::-webkit-scrollbar,
html::-webkit-scrollbar { width: 12px; height: 12px; }
.table-wrap::-webkit-scrollbar-track,
html::-webkit-scrollbar-track { background: #e3e8e5; }
.table-wrap::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb { background: #7b837f; border-radius: 6px; }
.table-wrap::-webkit-scrollbar-thumb:hover,
html::-webkit-scrollbar-thumb:hover { background: #69716d; }
.table-wrap::-webkit-scrollbar-corner,
html::-webkit-scrollbar-corner { background: #e3e8e5; }
table { border-collapse: collapse; width: 100%; min-width: 1320px; }
th { padding: 13px 12px; background: #f8faf9; border-bottom: 1px solid #aeb8b2; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #53605a; white-space: nowrap; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--green-700); }
td { padding: 15px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: #fbfdfc; }
.config-group-row td { background: #f3f6f8; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.config-group-row:hover { background: #f3f6f8; }
.row-check { width: 18px; height: 18px; accent-color: var(--green-700); }
.account { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.account .allegro-a { font-size: 17px; }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a099; }
.status.active::before { background: #2aa669; box-shadow: 0 0 0 3px #def4e7; }
.status.pending::before { background: #e7a11b; box-shadow: 0 0 0 3px #fff0cf; }
.status.activating::before { background: #5977ff; box-shadow: 0 0 0 3px #e5eaff; }
.status.inactive::before { background: #9aa39e; box-shadow: 0 0 0 3px #eef1ef; }
.status.waiting::before { background: #e7a11b; box-shadow: 0 0 0 3px #fff0cf; }
.status.scheduled::before { background: #5977ff; box-shadow: 0 0 0 3px #e5eaff; }
.status.draft::before { background: #9aa39e; box-shadow: 0 0 0 3px #eef1ef; }
.status.ended::before { background: #d04b45; box-shadow: 0 0 0 3px #fae3e2; }
.offer-cell { display: flex; gap: 12px; min-width: 310px; align-items: center; }
.thumb { width: 54px; height: 54px; border-radius: 4px; display: grid; place-items: center; font-size: 27px; flex: 0 0 auto; border: 1px solid #d8e6dc; background: linear-gradient(145deg, #f6fbf6, #d8eadb); }
.offer-title { font-weight: 680; line-height: 1.3; color: var(--ink); text-decoration: none; }
.offer-title:hover { color: var(--green-700); text-decoration: underline; }
.sub { color: var(--muted); font-size: 11px; margin-top: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 12px; padding: 4px 8px; background: #e6f4eb; color: #17613f; font-size: 11px; font-weight: 700; margin: 2px; white-space: nowrap; }
.tag.pink { background: #fae6ec; color: #9b3455; }
.tag.blue { background: #e5eff9; color: #275f91; }
.stars { color: #e29b16; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d8dedb; }
.rating-link { border: 0; background: transparent; padding: 3px 0; cursor: pointer; color: var(--ink); font-weight: 700; }
.rating-link { text-decoration: none; }
.rating-link:hover { color: var(--green-700); }
.rating-star { color: #e29b16; }
.offer-thumb { width: 48px; height: 48px; font-size: 24px; }
.offer-main { min-width: 260px; max-width: 360px; }
.offer-stats { display: grid; gap: 4px; min-width: 92px; color: var(--muted); font-size: 12px; text-align: right; }
.offer-stats strong { color: var(--ink); }
.offers-table-wrap { overflow: visible; }
.offers-table-wrap tbody tr:nth-last-child(-n+2):not(:first-child) .action-menu { top: auto; bottom: calc(100% + 4px); }
.promotion-cell { display: grid; gap: 5px; min-width: 92px; align-items: start; }
.promo-badge { display: inline-flex; width: max-content; max-width: 116px; padding: 2px 5px; border-radius: 3px; background: #18a999; color: #fff; font-size: 11px; font-weight: 800; line-height: 1.1; }
.promo-renewal { color: var(--muted); font-size: 11px; line-height: 1.35; }
.promo-renewal a { color: var(--green-800); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.shipping-time { display: inline-flex; align-items: center; white-space: nowrap; color: #18251e; }
.row-actions { position: relative; }
.row-actions summary {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  list-style: none;
  font-size: 22px;
  line-height: 1;
  color: #4d5953;
}
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions summary:hover { background: var(--green-50); color: var(--green-700); }
.row-actions summary svg { width: 18px; height: 18px; }
.action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 168px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.action-menu button {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 4px;
  padding: 7px 9px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.action-menu button:hover { background: var(--green-50); color: var(--green-700); }
.tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.tab { min-height: 44px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 10px 18px; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.tab:hover { color: var(--green-700); background: var(--green-50); }
.tab.active { color: var(--green-800); border-bottom-color: var(--green-600); background: #fff; }
.admin-panel[hidden] { display: none; }
.action-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.action-icon { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #4d5953; cursor: pointer; display: inline-grid; place-items: center; }
.action-icon:hover { background: var(--green-50); color: var(--green-700); }
.action-icon svg { width: 18px; height: 18px; }

/* Inbox */
.inbox-table { min-width: 760px; table-layout: fixed; }
.inbox-table th:first-child { width: 72px; }
.inbox-table th:nth-child(2) { width: 245px; }
.inbox-table th:last-child { width: 155px; }
.inbox-row { cursor: pointer; }
.inbox-row:hover { background: var(--green-50); }
.inbox-row.unread td { background: #f3faf6; }
.inbox-row.unread td:first-child { box-shadow: inset 3px 0 0 var(--green-600); }
.inbox-row .message-title, .inbox-row .sender-cell > strong { font-weight: 400; }
.inbox-row.unread .message-title, .inbox-row.unread .sender-cell > strong { font-weight: 600; }
.sender-cell { display: grid; gap: 5px; min-width: 0; }
.sender-cell > strong { overflow: hidden; text-overflow: ellipsis; }
/* Ikona typu jest przełącznikiem przeczytane/nieprzeczytane. */
.message-type-toggle { position: relative; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; }
.message-type-toggle:hover, .message-type-toggle:focus-visible { background: var(--green-100); outline: 0; }
.message-type-toggle:hover .message-type-icon, .message-type-toggle:focus-visible .message-type-icon { color: var(--green-700); }
.inbox-row.unread .message-type-icon { color: var(--green-600); }
.unread-marker { position: absolute; top: 1px; right: 1px; width: 10px; height: 10px; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 2px #f3faf6; display: none; }
.inbox-row.unread .unread-marker { display: block; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-600); display: inline-block; flex: 0 0 auto; }
.filter-chip > span { min-height: 42px; width: 100%; }
.filter-chip input:checked + span .unread-dot { box-shadow: 0 0 0 3px rgba(39,132,87,.18); }
.message-type-icon { width: 40px; height: 40px; display: grid; place-items: center; color: #aeb3b1; }
.message-type-icon .message-type-glyph { width: 30px; height: 30px; }
.message-type-glyph { display: block; width: 100%; height: 100%; background: currentColor; -webkit-mask: var(--message-type-icon) center / contain no-repeat; mask: var(--message-type-icon) center / contain no-repeat; }
.message-count { display: inline-grid; min-width: 22px; height: 22px; padding: 0 5px; place-items: center; border-radius: 11px; background: var(--green-100); color: var(--green-900); font-size: 11px; }
.inbox-preview { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal.thread-modal { width: min(900px, 100%); height: 90vh; max-height: 820px; display: flex; flex-direction: column; overflow: hidden; }
.thread-modal .modal-head, .thread-modal .modal-actions { flex: 0 0 auto; }
.thread-modal .modal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.thread-meta { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 12px 16px; margin-bottom: 18px; background: #f5f7f6; border: 1px solid var(--line); font-size: 12px; }
.thread-history { flex: 1 1 auto; min-height: 0; display: grid; align-content: start; gap: 14px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.thread-message { width: min(82%, 650px); padding: 14px 16px; border: 1px solid var(--line); background: #fff; border-radius: 8px; }
.thread-message.inbound { justify-self: start; }
.thread-message.outbound { justify-self: end; background: var(--green-50); border-color: #c9dfd2; }
.thread-message.system { justify-self: center; background: #f5f6f8; border-style: dashed; }
.thread-message-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.thread-message-head time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.thread-message p { margin: 0; line-height: 1.55; overflow-wrap: anywhere; }
.thread-message-context { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; align-items: center; margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; }
.thread-message-context img, .thread-context-icon { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; }
.thread-context-icon { display: grid; place-items: center; background: #f0f3f1; font-size: 23px; }
.thread-message-context > div { min-width: 0; display: grid; gap: 2px; }
.thread-context-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.thread-message-context a, .thread-message-context strong { overflow: hidden; color: var(--green-700); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.thread-context-price { color: var(--ink); font-weight: 700; }
.robot-badge { display: inline-flex; margin-left: 8px; padding: 2px 7px; border-radius: 10px; background: #e3efe8; color: var(--green-900); font-size: 10px; font-weight: 700; }
.thread-attachment { display: block; margin-top: 9px; font-size: 12px; }
.thread-attachments { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: 9px; }
.thread-attachments .thread-attachment { margin-top: 0; }
.thread-attachment-image { display: block; }
.thread-attachment-image img { display: block; max-width: 140px; max-height: 140px; border: 1px solid #d5ded8; border-radius: 8px; background: #f0f3f1; }
.thread-attachment-image:hover img { border-color: var(--green-700); }

/* Autoresponder */
.priority-helper { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; padding: 16px 18px; border: 1px solid #c9dfd2; background: var(--green-50); color: var(--green-900); }
.priority-helper-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); font-size: 20px; font-weight: 800; }
.priority-helper p { margin: 4px 0 0; color: #53685d; line-height: 1.5; }
.responder-table { min-width: 1080px; table-layout: fixed; }
.responder-table th:first-child { width: 105px; }
.responder-table th:nth-child(2) { width: 230px; }
.responder-table th:nth-child(3) { width: 330px; }
.responder-table th:nth-child(4) { width: 215px; }
.responder-table th:nth-child(5), .responder-table th:last-child { width: 135px; }
.priority-cell { white-space: nowrap; cursor: grab; user-select: none; }
.priority-cell:active { cursor: grabbing; }
.priority-cell:focus-visible { outline: 2px solid var(--green-600); outline-offset: -3px; }
.priority-drag-handle { display: inline-flex; align-items: center; gap: 9px; min-height: 34px; }
.priority-number { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; background: #edf2ef; color: var(--green-900); font-weight: 800; }
.priority-grip { width: 28px; height: 30px; display: inline-grid; place-items: center; border-radius: 4px; color: var(--green-700); }
.priority-grip svg { width: 21px; height: 21px; }
.priority-cell:hover .priority-grip, .priority-cell:focus-visible .priority-grip { background: var(--green-100); }
.autoresponder-row.dragging { opacity: .42; }
.autoresponder-row.dragging .priority-cell { cursor: grabbing; }
.responder-actions form, td > form { margin: 0; }
.responder-preview { display: -webkit-box; max-width: 320px; overflow: hidden; color: #53605a; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.responder-accounts { display: grid; gap: 5px; }
.responder-actions { display: flex; gap: 4px; }
.danger-action { color: var(--danger); }
.status-toggle { border: 0; background: transparent; padding: 7px 0; display: inline-flex; align-items: center; gap: 9px; color: var(--ink); cursor: pointer; }
.status-toggle > span { width: 34px; height: 18px; border-radius: 10px; background: #afb8b3; position: relative; }
.status-toggle > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; transition: .18s; }
.status-toggle.active > span { background: var(--green-600); }
.status-toggle.active > span::after { transform: translateX(16px); }
.responder-modal { width: min(900px, 100%); }
.responder-form-body { display: grid; gap: 18px; background: #f5f7f6; }
.form-section { padding: 20px; border: 1px solid var(--line); background: #fff; display: grid; gap: 18px; }
.form-section-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.form-section h3 { margin: 0; font-size: 17px; }
.form-section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.switch-field { display: inline-flex; gap: 9px; align-items: center; cursor: pointer; white-space: nowrap; }
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 40px; height: 22px; border-radius: 12px; background: #aeb8b2; position: relative; }
.switch::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .18s; }
.switch-field input:checked + .switch { background: var(--green-600); }
.switch-field input:checked + .switch::after { transform: translateX(18px); }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choice-chip { cursor: pointer; }
.choice-chip input { position: absolute; opacity: 0; }
.choice-chip > span { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); background: #fff; border-radius: 5px; }
.choice-chip input:checked + span { border-color: var(--green-600); background: var(--green-50); box-shadow: inset 0 0 0 1px var(--green-600); }
.choice-type-icon { width: 22px; height: 22px; display: inline-grid; flex: 0 0 auto; place-items: center; color: #aeb3b1; }
.choice-chip input:checked + span .choice-type-icon { color: var(--green-700); }
.days-grid .choice-chip > span { min-width: 52px; justify-content: center; }
.check-row { display: flex; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); cursor: pointer; }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: var(--muted); }
.responder-message { resize: vertical; line-height: 1.55; }
.editor-meta { display: flex; justify-content: flex-end; color: var(--muted); font-size: 11px; }
@media (max-width: 700px) { .thread-message { width: 94%; } .form-section-head { flex-direction: column; } }
.link-button { border: 0; background: transparent; color: var(--green-700); padding: 0; font-weight: 750; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

.bulkbar { display: none; align-items: center; gap: 10px; padding: 12px 16px; background: var(--green-900); color: white; margin-bottom: 12px; position: sticky; top: 84px; z-index: 5; }
.bulkbar.show { display: flex; }
.bulkbar .btn { margin-left: auto; }
.pagination { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.page-size-control { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.page-size-control select { width: auto; min-height: 34px; padding: 6px 28px 6px 9px; border-color: var(--line); color: var(--ink); background-position: calc(100% - 16px) 14px, calc(100% - 10px) 14px; }
.pagination-controls { display: inline-flex; align-items: center; gap: 10px; }
.page-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--green-800); font-size: 18px; cursor: pointer; }
.page-btn:hover:not(:disabled) { background: var(--green-50); border-color: var(--green-600); }
.page-btn:disabled { opacity: .4; cursor: default; }

.integration-card { padding: 22px; display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: start; }
.integration-logo { width: 52px; height: 52px; border: 1px solid var(--line); display: grid; place-items: center; background: white; font-size: 26px; }
.integration-card h3 { margin: 1px 0 6px; font-size: 17px; }
.integration-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.integration-accounts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.account-chip { border: 1px solid var(--line); padding: 8px 10px; display: inline-flex; gap: 8px; align-items: center; background: #fafcfb; }
.connected { color: var(--green-700); font-size: 12px; font-weight: 700; }
.integrations-table-wrap { overflow: visible; }
.integrations-table { min-width: 860px; }
.integrations-table td:last-child, .integrations-table th:last-child { width: 82px; text-align: right; }
.integrations-table .row-actions { display: inline-block; text-align: left; }
.integrations-table tbody tr:last-child:not(:first-child) .action-menu { top: auto; bottom: calc(100% + 4px); }
.integration-warning { display: flex; gap: 14px; padding: 16px; background: #fff3eb; border: 1px solid #ffd7c2; }
.integration-warning p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.integration-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 10px; }
.modal-helper { margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.login-screen { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-columns: minmax(380px, 43%) 1fr; background: white; }
.login-panel { display: grid; place-items: center; min-height: 100vh; padding: clamp(36px, 6vw, 100px); }
.login-content { width: min(100%, 460px); }
.login-panel .login-brand { height: auto; min-height: 56px; padding: 0; margin: 0 0 42px; border: 0; display: flex; flex: 0 0 auto; cursor: default; }
.login-panel .login-brand .brand-mark { width: 58px; height: 58px; }
.login-panel .login-brand .brand-bang { font-size: 27px; margin-left: 2px; }
.login-panel .login-brand .brand-name { font-size: 40px; letter-spacing: -.8px; }
.login-panel .login-logo { width: 190px; max-height: 55px; object-fit: contain; object-position: left center; margin-bottom: 36px; }
.login-panel h1 { font-size: 36px; }
.login-form { margin-top: 28px; display: grid; gap: 17px; width: 100%; max-width: none; }
.login-visual { background: var(--green-900); color: white; position: relative; overflow: hidden; display: grid; place-items: center; padding: 60px; }
.login-visual::before, .login-visual::after { content: ""; position: absolute; width: 500px; height: 500px; border-radius: 47% 53% 58% 42%; border: 1px solid rgba(255,255,255,.14); }
.login-visual::before { right: -120px; top: -140px; transform: rotate(25deg); }
.login-visual::after { left: -180px; bottom: -250px; transform: rotate(-15deg); }
.plant-art { text-align: center; position: relative; z-index: 1; }
.plant-art .plant { font-size: 110px; filter: drop-shadow(0 18px 24px rgba(0,0,0,.2)); }
.plant-art h2 { font-size: 28px; margin: 26px 0 8px; }
.plant-art p { max-width: 480px; color: #cbe3d4; line-height: 1.6; }
.login-error { display: none; color: var(--danger); background: #fff0ef; padding: 10px; }
.login-error.show { display: block; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(14,29,21,.55); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { background: white; width: min(620px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.modal-body { padding: 22px; }
.modal-actions { padding: 16px 22px; background: #f7f9f8; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-actions.split { justify-content: space-between; }
.modal-actions .btn { max-width: 100%; white-space: normal; text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 120; padding: 14px 18px; color: white; background: var(--green-900); box-shadow: var(--shadow); transform: translateY(120px); opacity: 0; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.popover { position: absolute; z-index: 50; width: min(420px, calc(100vw - 40px)); background: white; border: 1px solid var(--line); padding: 18px 46px 18px 18px; box-shadow: var(--shadow); display: none; line-height: 1.55; }
.popover.open { display: block; }
.popover-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: #66736c; font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.popover-close:hover, .popover-close:focus-visible { background: var(--green-50); color: var(--green-800); outline: 0; }
.empty { padding: 44px; text-align: center; color: var(--muted); }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-list li { border-left: 2px solid var(--green-200, #cce5d5); padding: 0 0 18px 16px; }
.history-list strong { display: block; }
.score-bars { display: grid; grid-template-columns: 50px 1fr 38px; gap: 8px 12px; align-items: center; }
.bar { height: 8px; background: #edf0ee; overflow: hidden; }
.bar i { display: block; height: 100%; background: #e5a01d; }

@media (max-width: 1000px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .account-summary-grid { grid-template-columns: 1fr; }
  .account-form-wide { grid-column: auto; }
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .sidebar { width: 60px; overflow: visible; }
  .main { margin-left: 60px; }
  .sidebar-head { overflow: visible; }
  .brand { display: flex; padding-left: 13px; }
  .nav { padding: 8px 6px 46px; overflow: visible; }
  .nav a { justify-content: center; padding: 0; overflow: visible; }
  .sidebar .brand-name, .nav-caption, .nav-label, .user-meta { display: none; }
  .nav a::after { content: attr(data-tooltip); position: absolute; left: 52px; top: 50%; transform: translateY(-50%); padding: 7px 9px; border-radius: 5px; background: var(--green-900); color: #fff; font-size: 12px; opacity: 0; visibility: hidden; pointer-events: none; z-index: 50; }
  .nav a:hover::after, .nav a:focus-visible::after { opacity: 1; visibility: visible; }
  .account-menu-button { justify-content: center; padding: 0; }
  .account-menu-button .nav-label, .account-menu-button .chevron { display: none; }
  .account-submenu { left: 60px; right: auto; bottom: 8px; width: 210px; }
  .content { padding: 24px 16px 50px; }
  .topbar { padding: 0 12px; }
  .topbar > .icon-btn { display: none; }
  .header-user .user-copy, .header-user .chevron { display: none; }
  .header-user-wrap { margin-left: 0; }
  .header-user { padding: 6px 0 6px 10px; }
  .header-account-menu { right: 0; width: 210px; }
  .filter-grid { grid-template-columns: 1fr; }
  .inbox-filters .inbox-filter-grid { grid-template-columns: 1fr; }
  .employees-filter-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 32px 24px; }
  h1 { font-size: 27px; }
}

/* ===== Dopiski aplikacyjne AleResgal (poza mockup.css) ===== */

/* Nagłówki sortowania jako linki (server-side) — wygląd jak w mockupie */
th.sortable a { color: inherit; text-decoration: none; display: inline-flex; gap: 5px; }
th.sortable a:hover { color: var(--green-700); }

/* Komunikaty flash renderowane do toastów przez JS */
.flash-data { display: none; }

/* Strony błędów 403/404 */
.error-page { text-align: center; padding: 90px 20px; }
.error-page h1 { font-size: 64px; color: var(--green-700); margin: 0 0 10px; }
.error-page p { color: var(--muted); margin: 0 0 22px; }

/* Widok zablokowanej funkcji (aleResgal Plus) */
.plus-icon-badge { width: 56px; height: 56px; border-radius: 16px; background: #fff4e8; color: var(--orange); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.plus-icon-badge svg { width: 26px; height: 26px; stroke: currentColor; }

/* Miniaturki ofert jako obrazki */
img.thumb { object-fit: cover; }

/* Wiersz historii bez zmian */
.history-list .sub { display: block; margin-top: 3px; }
.history-list p { margin: 6px 0 0; color: var(--muted); }

/* Tabele z menu akcji (kebab): przy ostatnich wierszach menu odbija w górę. */
.menu-table-wrap tbody tr:nth-last-child(-n+2):not(:first-child) .action-menu { top: auto; bottom: calc(100% + 4px); }

/* Dialog komunikatów serwera (sukces/błąd): wyśrodkowany, nie znika sam. */
.alert-backdrop { z-index: 95; }
.alert-modal { width: min(480px, 100%); text-align: center; }
.alert-modal .modal-body { padding: 34px 30px 24px; }
.alert-icon {
  width: 58px; height: 58px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 800; margin-bottom: 14px;
}
.alert-success .alert-icon { background: #def4e7; color: var(--green-700); }
.alert-error .alert-icon { background: #fae3e2; color: var(--danger); }
.alert-title { margin: 0 0 10px; font-size: 22px; font-weight: 750; }
.alert-error .alert-title { color: var(--danger); }
.alert-success .alert-title { color: var(--green-800); }
.alert-messages { color: #3b4942; line-height: 1.55; font-size: 15px; }
.alert-messages p { margin: 4px 0; }
.alert-actions { justify-content: center; }
.alert-actions .btn { min-width: 120px; }

/* Modal przebiegu synchronizacji „Pobierz teraz" */
.sync-account { margin-bottom: 20px; }
.sync-account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sync-log { list-style: none; margin: 0 0 8px; padding: 10px 14px; background: #f7f9f8; border: 1px solid var(--line); font-size: 12px; max-height: 220px; overflow-y: auto; }
.sync-log li { padding: 3px 0; color: #3b4942; }
.sync-log li.warning { color: var(--warning); }
.sync-log li.error { color: var(--danger); font-weight: 700; }
.sync-summary { margin: 0; font-weight: 700; }
.sync-summary.success { color: var(--green-800); }
.sync-summary.failed { color: var(--danger); }
.sync-summary.skipped { color: var(--warning); }

/* Lista kroków w popoverze pomocy */
.popover-list { margin: 8px 0; padding-left: 20px; }
.popover-list li { margin-bottom: 6px; }
