* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #eef1f7;
  color: #111827;
  line-height: 1.5;
}

body:not(.login-page) {
  animation: appPageIn 0.36s ease both;
}

@keyframes appPageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.login-container {
  max-width: 520px;
}

.login-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 16%, rgba(96, 165, 250, 0.42), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(59, 130, 246, 0.32), transparent 24%),
    linear-gradient(135deg, #eef5ff 0%, #f8fafc 44%, #e8eefb 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-card {
  width: min(980px, 100%);
  min-height: 580px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(18px);
  animation: loginCardIn 0.52s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-visual {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(29, 78, 216, 0.94), rgba(79, 70, 229, 0.88)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.38), transparent 34%);
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 18px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 22px;
}

.login-orb {
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.72;
}

.login-orb-one {
  right: -62px;
  top: -62px;
  width: 220px;
  height: 220px;
  background: rgba(147, 197, 253, 0.62);
}

.login-orb-two {
  left: -56px;
  bottom: 70px;
  width: 160px;
  height: 160px;
  background: rgba(191, 219, 254, 0.34);
}

.login-brand-mark {
  width: 76px;
  height: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
}

.login-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.82;
}

.login-visual h1 {
  margin: 0;
  max-width: 420px;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.login-visual p:last-child {
  max-width: 370px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
  background: rgba(255, 255, 255, 0.82);
}

.login-language-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 36px;
}

.login-copy h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: #0f172a;
}

.login-subtitle {
  margin: 12px 0 0;
  color: #64748b;
  font-weight: 500;
}

.login-alert {
  margin-top: 22px;
  animation: loginAlertIn 0.34s ease both;
}

@keyframes loginAlertIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-form {
  gap: 14px;
  margin-top: 24px;
}

.login-field label {
  margin-top: 0;
}

.login-field input {
  min-height: 48px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
}

.login-submit {
  min-height: 50px;
  margin-top: 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%);
  box-shadow: 0 14px 28px rgba(29, 78, 216, 0.24);
}

.login-submit:hover {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(29, 78, 216, 0.3);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.logout-link {
  text-decoration: none;
  color: #dc2626;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d1d9e6;
  border-radius: 999px;
  background: #f8fafc;
}

.lang-toggle-btn {
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.35px;
  color: #64748b;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
  transition: all 0.18s ease;
}

.lang-toggle-btn:hover {
  background: #e5edff;
  color: #1d4ed8;
}

.lang-toggle-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.lang-toggle-btn.is-active {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(29, 78, 216, 0.35);
}

.role-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 6px 10px;
  border-radius: 999px;
}

.role-admin {
  background: #fee2e2;
  color: #991b1b;
}

.role-editor {
  background: #fef3c7;
  color: #92400e;
}

.role-viewer {
  background: #e5e7eb;
  color: #374151;
}

.logout-link:hover {
  background: #fee2e2;
  color: #991b1b;
}

.card,
.card-shell {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #d7deeb;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.card { margin-bottom: 16px; }

.card:hover {
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

.card h2 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f4f8;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  gap: 12px;
  padding: 12px;
  align-items: start;
  overflow: visible;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 12px;
  height: calc(100vh - 24px);
}

.sidebar > div:first-child {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.brand {
  font-size: 38px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: -0.4px;
  line-height: 1;
}

.brand-sub {
  color: #6b7280;
  margin-top: 4px;
  margin-bottom: 28px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 10px;
  color: #374151;
  border: 1px solid transparent;
  font-weight: 600;
}

.nav-item.active,
.nav-item:hover {
  background: #eef4ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.user-block {
  padding-top: 18px;
  margin-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.user-name { font-weight: 700; }
.user-role { color: #6b7280; font-size: 13px; }

.sidebar-bottom-controls {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-bottom-controls .lang-toggle {
  width: auto;
}

.sidebar-logout-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
}

.sidebar-mobile-toggle,
.sidebar-mobile-close,
.sidebar-mobile-backdrop {
  display: none;
}

.sidebar-mobile-toggle {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #cfd7e6;
  background: #ffffff;
  color: #1f2937;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.14);
}

.sidebar-mobile-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

.sidebar-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1050;
}

.main-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow-y: visible;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-title {
  margin: 0;
  font-size: 32px;
  line-height: 1;
  color: #1d4ed8;
}

.topbar-sub {
  color: #6b7280;
  font-weight: 500;
  margin-top: 4px;
}

.topbar .header-links {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar-help-btn {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.topbar-help-btn__icon {
  flex: 0 0 auto;
}

.topbar-help-btn.is-hidden {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

#clientsPanel {
  grid-template-columns: minmax(0, 1fr);
  overflow-x: hidden;
}

#clientsPanel > * {
  min-width: 0;
}

#usersPanel {
  grid-template-columns: minmax(0, 1fr);
  overflow-x: hidden;
}

#usersPanel > * {
  min-width: 0;
}

#calendarPanel {
  min-height: fit-content;
  overflow-y: visible;
  align-items: start;
  padding-bottom: 14px;
}

#calendarPanel .tools-zone {
  min-height: fit-content;
  height: fit-content;
  overflow: visible;
  align-self: start;
}

.calendar-zone {
  display: grid;
  gap: 8px;
  align-content: start;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-head-planning {
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.calendar-head h2 {
  margin: 0;
  font-size: 30px;
}

.calendar-modes,
.tag-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  background: #edf2ff;
  color: #3657b0;
  border: 1px solid #d5def5;
}

.pill.active { background: #fff; border-color: #b8c5ec; }
.pill.warning { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.pill.success { background: #dcfce7; color: #166534; border-color: #86efac; }
.pill.info { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }
.pill.dark { background: #e2e8f0; color: #1e293b; border-color: #cbd5e1; }
.pill.purple { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.pill.blue { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.pill.is-custom-color {
  background: color-mix(in srgb, var(--tag-color) 16%, #ffffff);
  color: #1f2937;
  border-color: color-mix(in srgb, var(--tag-color) 44%, #d7deeb);
}

.tools-zone h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.tools-zone > .topbar-sub {
  margin-bottom: 10px;
}

.tools-zone {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hint {
  color: #6b7280;
  font-style: italic;
}

.inner-card {
  background: #fbfcff;
}

.hidden-panel {
  display: none;
}

.workspace,
#calendarPanel {
  transition: opacity 0.24s ease, transform 0.24s ease, filter 0.24s ease;
  will-change: opacity, transform;
}

.tab-panel-enter {
  animation: tabPanelEnter 0.28s cubic-bezier(.2,.8,.2,1) both;
}

.tab-panel-exit {
  opacity: 0;
  transform: translateY(8px) scale(0.992);
  filter: blur(1px);
  pointer-events: none;
}

@keyframes tabPanelEnter {
  from { opacity: 0; transform: translateY(10px) scale(0.992); filter: blur(1px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.topbar-title,
.topbar-sub {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.topbar.is-switching .topbar-title,
.topbar.is-switching .topbar-sub {
  opacity: 0;
  transform: translateY(-4px);
}

.schedule-grid-card {
  padding: 0;
  overflow: hidden;
}

.schedule-grid-card:hover {
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.04);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f4f6fb;
  border-bottom: 1px solid #e5eaf5;
}

.weekdays span {
  padding: 12px 10px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 700;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-period-switch {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}

.calendar-month-controls {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
}

.calendar-edit-btn {
  width: auto;
  min-width: max-content;
  height: 36px;
  padding: 7px 16px;
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.calendar-edit-btn.state-edit {
  background: #f59e0b;
  color: #fff;
}

.calendar-edit-btn.state-cancel {
  background: #64748b;
  color: #fff;
}

.calendar-edit-btn.state-save {
  background: #16a34a;
  color: #fff;
}

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid #d5def5;
  background: #edf2ff;
  color: #3657b0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
}

.calendar-nav-btn:hover {
  background: #dfe8ff;
}

.calendar-month-select {
  min-width: 190px;
  padding: 7px 34px 7px 12px;
  height: 36px;
  line-height: 1.25;
  font-weight: 700;
  color: #1f2937;
}

.calendar-year-select {
  min-width: 108px;
  padding: 7px 34px 7px 12px;
  height: 36px;
  line-height: 1.25;
  font-weight: 700;
  color: #1f2937;
}

.calendar-mode-btn {
  cursor: pointer;
  padding: 6px 12px;
}

.calendar-mode-btn.active {
  background: #fff;
  border-color: #b8c5ec;
}

.calendar-render-surface {
  display: grid;
  align-content: start;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f4f6fb;
  border-bottom: 1px solid #e5eaf5;
}

.calendar-weekdays span {
  padding: 8px 8px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 700;
  text-align: center;
}

.calendar-grid.month-view,
.calendar-grid.week-view {
  grid-template-columns: repeat(7, 1fr);
}

.calendar-week-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: stretch;
  border: 1px solid #e5eaf5;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  min-height: 64px;
}

.calendar-week-day {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  border-right: 1px solid #e5eaf5;
}

.calendar-week-lane {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  min-height: 64px;
}

.calendar-week-row.is-today .calendar-week-day {
  color: #1d4ed8;
  background: #eef4ff;
}

.calendar-week-row.is-today .calendar-week-lane {
  background: #f8fbff;
}

.day-cell.is-outside-month {
  background: #f8fafc;
}

.day-cell.is-outside-month .day-num {
  color: #94a3b8;
}

.day-cell.active-day .day-num {
  color: #1d4ed8;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
}

.year-month-card {
  border: 1px solid #e5eaf5;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.year-month-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: #334155;
}

.year-month-switch-btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #dbe5fb;
  border-radius: 8px;
  background: #f5f8ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.year-month-switch-btn:hover {
  background: #eaf0ff;
  border-color: #c8d5f7;
  transform: translateY(0);
  box-shadow: none;
}

.year-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 4px;
}

.year-mini-day {
  font-size: 10px;
  text-align: center;
  color: #64748b;
  line-height: 1.55;
  min-height: 16px;
}

.year-mini-day.is-current {
  color: #1d4ed8;
  font-weight: 700;
}

.day-cell {
  min-height: 146px;
  padding: 6px;
  border-right: 1px solid #edf1f7;
  border-bottom: 1px solid #edf1f7;
}

.day-cell.calendar-drop-target,
.calendar-week-lane.calendar-drop-target {
  outline: 2px dashed #60a5fa;
  outline-offset: -2px;
  background: #eef6ff;
}

.day-num {
  font-weight: 700;
  margin-bottom: 4px;
}

.active-day {
  background: #eef4ff;
}

.event-pill {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  margin-bottom: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  border: 0;
  cursor: default;
  text-align: left;
}

.event-pill-main,
.event-pill-month {
  width: 100%;
  min-width: 0;
}

.event-pill-main {
  line-height: 1.2;
}

.event-pill-month {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  opacity: 0.78;
}

.calendar-event-edit-mode .event-pill:not(.more-pill) {
  cursor: grab;
}

.event-pill.is-dragging {
  opacity: 0.55;
}

.event-pill.is-inactive-order-event {
  opacity: 0.45;
  filter: grayscale(0.35);
  cursor: default !important;
}

.event-pill.is-inactive-order-event:hover {
  transform: none;
  box-shadow: none;
}

.event-pill-trash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  opacity: 0;
  align-self: flex-end;
  margin-left: 0;
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.event-pill:hover .event-pill-trash {
  opacity: 1;
  background: rgba(255, 255, 255, 0.6);
}

.event-pill.is-inactive-order-event .event-pill-trash {
  display: none;
}

.day-events {
  margin-top: 4px;
}

.event-pill.more-pill {
  align-items: center;
  flex-direction: row;
  justify-content: center;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.year-mini-dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 2px;
}

.year-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
}

.year-mini-dot.warning { background: #fb923c; }
.year-mini-dot.success { background: #22c55e; }
.year-mini-dot.info { background: #6366f1; }
.year-mini-dot.dark { background: #64748b; }
.year-mini-dot.purple { background: #9333ea; }
.year-mini-dot.blue { background: #2563eb; }
.year-mini-dot.is-custom-color { background: var(--tag-color); }

.event-pill.purple { background: #f3e8ff; color: #6b21a8; }
.event-pill.blue { background: #dbeafe; color: #1e40af; }
.event-pill.green { background: #dcfce7; color: #047857; }
.event-pill.orange { background: #ffedd5; color: #c2410c; }
.event-pill.dark { background: #e2e8f0; color: #334155; }
.event-pill.warning { background: #ffedd5; color: #9a3412; }
.event-pill.success { background: #dcfce7; color: #166534; }
.event-pill.info { background: #e0e7ff; color: #3730a3; }
.event-pill.is-custom-color {
  background: color-mix(in srgb, var(--tag-color) 18%, #ffffff);
  color: #1f2937;
  border: 1px solid color-mix(in srgb, var(--tag-color) 38%, #d7deeb);
}

.schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  grid-auto-rows: max-content;
}

.schedule-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.schedule-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.schedule-list-head h2 {
  margin: 0;
}

.schedule-list-toolbar label {
  margin: 0;
  white-space: nowrap;
}

.schedule-list-toolbar select {
  width: auto;
  min-width: fit-content;
  max-width: max-content;
  padding: 7px 28px 7px 10px;
  height: 34px;
}

.schedule-list-scrollable {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
}

.tools-zone > .card.inner-card.schedule-list-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.tools-zone > .card.inner-card.schedule-list-card .schedule-list {
  flex: 1 1 auto;
}

.schedule-list li {
  align-content: start;
  gap: 2px;
}

.schedule-list-empty {
  border-bottom: 0 !important;
}

.schedule-list li {
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 10px;
  display: grid;
}

.schedule-list li strong { color: #1d4ed8; }
.schedule-list li span { font-weight: 600; color: #1f2937; }

.tags-card {
  position: relative;
  margin-bottom: 12px;
}

.tags-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.tags-card-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tags-card-head h2 {
  margin: 0;
  border-bottom: 0;
  padding-bottom: 0;
}

.tags-add-btn {
  width: auto;
  min-width: 110px;
  padding: 8px 10px;
}

.tags-reorder-btn {
  width: auto;
  min-width: 110px;
  padding: 8px 10px;
}

.tags-hint {
  margin: 0 0 10px;
}

.calendar-tags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}

.calendar-tag-item {
  display: inline-flex;
  align-items: center;
  cursor: default;
  user-select: none;
}

.tags-card.is-calendar-edit-mode .calendar-tag-item {
  cursor: grab;
}

.tags-card.is-calendar-edit-mode .calendar-tag-item.is-dragging {
  opacity: 0.6;
}

.calendar-tags-empty {
  color: #6b7280;
  font-size: 13px;
  font-style: italic;
}

.calendar-tag-item .pill {
  pointer-events: none;
}

.calendar-tag-item:not(.is-disabled-for-order) .pill {
  opacity: 1;
  filter: none;
}

.calendar-tag-item.is-disabled-for-order .pill {
  opacity: 0.48;
  filter: grayscale(0.45);
}

.calendar-tag-item.is-system-tag .pill::after {
  content: " system";
  font-size: 9px;
  opacity: 0.7;
  margin-left: 4px;
  text-transform: uppercase;
}

.calendar-tag-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d7deeb;
}

.calendar-tag-color-picker {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.calendar-tag-color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.calendar-tag-color-swatch {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
}

.calendar-tag-color-swatch.warning { background: #fb923c; }
.calendar-tag-color-swatch.success { background: #22c55e; }
.calendar-tag-color-swatch.info { background: #6366f1; }
.calendar-tag-color-swatch.dark { background: #64748b; }
.calendar-tag-color-swatch.purple { background: #9333ea; }
.calendar-tag-color-swatch.blue { background: #2563eb; }

.calendar-tag-color-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px #94a3b8, 0 6px 14px rgba(15, 23, 42, 0.14);
}

.calendar-tag-color-swatch.is-selected {
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px #4a65ad;
}

.calendar-tag-custom-color {
  position: relative;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #d7deeb;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.calendar-tag-custom-color-preview {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0) 42%),
    var(--tag-color, #6366f1);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.calendar-tag-custom-color input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.calendar-tag-form-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.calendar-order-schedule-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0;
}

.calendar-order-schedule-actions [data-order-schedule-save] {
  background: #16a34a;
  color: #fff;
}

.calendar-order-schedule-actions [data-order-schedule-save]:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.calendar-order-schedule-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calendar-order-schedule-edit-actions[hidden] {
  display: none !important;
}

.calendar-order-schedule-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.calendar-order-schedule-field {
  min-width: 0;
}

.calendar-order-schedule-status {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
}

.calendar-tag-form-actions .btn-primary,
.calendar-tag-form-actions .btn-secondary {
  width: auto;
  min-width: 104px;
}

.calendar-tag-context-menu {
  position: absolute;
  z-index: 40;
  width: max-content;
  min-width: 140px;
  max-width: calc(100vw - 16px);
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 6px;
  overflow: hidden;
}

.calendar-tag-context-item {
  width: 100%;
  text-align: left;
  padding: 8px 9px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.calendar-tag-context-item:hover {
  transform: translateY(0);
  box-shadow: none;
  background: #f3f6fb;
}

.calendar-tag-context-item.danger {
  color: #b91c1c;
}

.tags-card.is-reorder-mode .calendar-tag-item {
  cursor: grab;
}

.tags-card.is-reorder-mode .calendar-tag-item.is-dragging {
  opacity: 0.5;
}

.tags-card.is-reorder-mode .calendar-tags-list {
  padding: 6px;
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  background: #f8fbff;
}

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 1fr; }

  #calendarPanel {
    overflow-y: visible;
  }

  .tools-zone > .card.inner-card.schedule-list-card {
    flex: 0 0 auto;
  }

  .schedule-list-scrollable {
    flex: 0 0 auto;
    min-height: auto;
    max-height: 300px;
  }

  /* Newsletter layout is controlled via the 1424px + 1420px breakpoints below.
     Avoid duplicating newsletter-specific layout rules here (it caused multiple reflows). */
}

/* At intermediate widths ensure the newsletter tab stacks to avoid overlap
   when the sidebar collapses or when the viewport is narrowed to ~1424px */
@media (max-width: 1424px) {
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    padding: 8px;
    overflow: visible;
  }

  .sidebar {
    position: static;
    top: auto;
    height: auto;
  }

  .main-shell {
    height: auto;
    overflow: visible;
  }

  .topbar,
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-title,
  .brand,
  .tools-zone h2 {
    font-size: 30px;
  }

  .controls-preview-wrapper {
    grid-template-columns: 1fr;
  }

  .calendar-order-schedule-row {
    grid-template-columns: 1fr;
  }

  .schedule-list-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .schedule-list-toolbar {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 760px) {
  .login-shell {
    padding: 18px 12px;
  }

  .login-card {
    min-height: auto;
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .login-visual {
    min-height: 240px;
    padding: 28px;
  }

  .login-visual h1 {
    font-size: 40px;
  }

  .login-panel {
    padding: 28px;
  }

  .login-language-row {
    justify-content: flex-start;
    margin-bottom: 26px;
  }
}

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    padding: 8px;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    z-index: 1101;
    border-radius: 0;
    border: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    padding-top: 60px;
  }

  .sidebar-mobile-toggle,
  .sidebar-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* open state */
  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  /* backdrop: animate opacity and enable pointer events only when open */
  .sidebar-mobile-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 1100;
  }

  body.sidebar-mobile-open .sidebar-mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* prevent background scroll when overlay open */
  body.sidebar-mobile-open {
    overflow: hidden;
  }

  /* ensure the toggle button sits above backdrop */
  .sidebar-mobile-toggle { z-index: 1120; }

  /* when placed inside the header, make it flow inline instead of fixed */
  .topbar .sidebar-mobile-toggle {
    position: relative;
    left: auto;
    top: auto;
    margin-right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }
  /* hide the header toggle while the sidebar overlay is open */
  body.sidebar-mobile-open .topbar .sidebar-mobile-toggle {
    display: none;
  }

  /* ensure the toggle is at the left and other header content flows next to it */
  .topbar {
    justify-content: flex-start;
  }

  /* keep header-links pinned to the right */
  .topbar .header-links {
    margin-left: auto;
  }

  .topbar-help-btn span {
    display: none;
  }

  /* force horizontal alignment (HStack) for header on small screens */
  .topbar {
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px;
    width: 100%;
  }

  /* keep title and subtitle stacked but inline next to the toggle */
  .topbar > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* Newsletter layout is handled by the dedicated Newsletter scoped breakpoints below
     (e.g. @media (max-width: 1424px) in the Newsletter section). */

  .main-shell {
    height: auto;
    overflow: visible;
  }

  .clients-help-sheet__panel {
    width: 100%;
    border-left: 0;
  }

  .clients-help-sheet__header,
  .clients-help-sheet__content {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.controls-preview-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Hide template selector everywhere (keep backend ID present for JS) */
#newsletterPanel label[for="templateCode"],
#newsletterPanel #templateCode {
  display: none !important;
}

.campaign-controls {
  grid-column: span 1;
}

.preview-section {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
}

.preview-section iframe {
  flex: 1;
  min-height: 500px;
}

@media (max-width: 768px) {
  .preview-section iframe {
    min-height: 600px;
  }
}

.status-section {
  margin-bottom: 0;
}

/* =============================
   Newsletter tab scoped layout
   ============================= */
#newsletterPanel {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
}

#newsletterPanel .calendar-zone {
  min-height: 0;
  height: auto;
  align-content: stretch;
  grid-template-rows: auto 1fr auto;
}

#newsletterPanel .controls-preview-wrapper {
  min-height: 0;
  height: auto;
  align-items: stretch;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
}

#newsletterPanel .campaign-controls {
  margin-bottom: 0;
  height: auto;
  max-height: none;
  overflow: visible;
}

#newsletterPanel .campaign-controls [data-orders-only="1"].is-hidden {
  display: none;
}

.newsletter-note {
  position: relative;
  margin: 10px 0 0;
}

.newsletter-note-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #d7deeb;
  border-radius: 12px;
  background: #f8fafc;
  color: #1d293d;
  cursor: pointer;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 700;
}

.newsletter-note-summary::-webkit-details-marker {
  display: none;
}

.newsletter-note-summary::marker {
  display: none;
}

.newsletter-note-summary-icon {
  font-size: 14px;
  transition: transform 0.18s ease;
}

.newsletter-note.is-open .newsletter-note-summary-icon {
  transform: rotate(180deg);
}

.newsletter-note-panel {
  max-height: 0;
  margin-top: 0;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #ffffff;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    max-height 0.24s ease,
    margin-top 0.24s ease,
    padding 0.24s ease,
    border-color 0.24s ease,
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.24s ease;
}

.newsletter-note.is-open .newsletter-note-panel {
  max-height: 560px;
  margin-top: 10px;
  padding: 14px;
  border-color: #d7deeb;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.newsletter-note-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #24324a;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}

.newsletter-note-toggle input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

.newsletter-note-editor-wrap.is-disabled {
  opacity: 0.55;
}

.newsletter-note-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.newsletter-note-format-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.newsletter-note-tool {
  flex: 0 0 auto;
  width: auto;
  min-width: 42px;
  padding: 8px 10px;
  border: 1px solid #d7deeb;
  border-radius: 10px;
  background: #f8fafc;
  color: #1d293d;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.newsletter-note-tool:hover {
  background: #eef4ff;
}

.newsletter-note-tool:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.newsletter-note-preset-title {
  color: #1e40af;
  font-weight: 700;
  text-transform: uppercase;
}

.newsletter-note-preset-caption {
  color: #64748b;
  font-size: 13px;
}

.newsletter-note-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.newsletter-note-color-label {
  flex: 0 0 auto;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.newsletter-note-color-picker {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: auto;
  margin: 0;
}

.newsletter-note-color-picker .calendar-tag-color-swatches {
  gap: 8px;
}

.newsletter-note-color-picker .calendar-tag-color-swatch {
  width: 24px;
  height: 24px;
  min-width: 24px;
}

.newsletter-note-color-default {
  background: #1d293d;
}

.newsletter-note-custom-color {
  margin: 0;
  padding: 5px 9px;
  text-transform: none;
  letter-spacing: normal;
}

.newsletter-note-custom-color .calendar-tag-custom-color-preview {
  width: 18px;
  height: 18px;
}

.newsletter-note-editor {
  min-height: 150px;
  padding: 14px;
  border: 1px solid #d7deeb;
  border-radius: 12px;
  background: #ffffff;
  color: #1d293d;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.newsletter-note-editor:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.newsletter-note-editor[contenteditable="false"] {
  background: #f8fafc;
  cursor: not-allowed;
}

.newsletter-note-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.newsletter-note-editor p {
  margin: 0 0 10px;
}

.newsletter-note-editor p:last-child {
  margin-bottom: 0;
}

.newsletter-note-editor ul,
.newsletter-note-editor ol {
  margin: 0 0 10px 20px;
  padding: 0;
}

.newsletter-note-editor a {
  color: #1e40af;
}

.newsletter-note-editor [data-note-preset="title"] {
  color: #1e40af;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.newsletter-note-editor [data-note-preset="body"] {
  color: #1d293d;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  text-transform: none;
}

.newsletter-note-editor [data-note-preset="caption"] {
  color: #4b5565;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  text-transform: none;
}

@media (max-width: 520px) {
  .newsletter-note-color-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .newsletter-note-color-picker {
    width: 100%;
  }
}

#newsletterPanel .preview-section {
  margin-bottom: 0;
  min-width: 0;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
}

#newsletterPanel .preview-section h2 {
  margin-bottom: 12px;
}

#newsletterPanel #previewFrame {
  width: 100%;
  height: auto;
  min-height: 520px;
  min-width: 0;
  flex: 1 1 auto;
  background: #ffffff;
  color-scheme: only light;
}

#newsletterPanel .status-section {
  margin-bottom: 0;
  /* Prevent the status card from stretching vertically when the parent uses a fixed-height grid. */
  align-self: start;
  height: fit-content;
}

/*
  Keep the Newsletter tab stacked layout in sync across the whole “narrow” range,
  even when the sidebar is still visible.

  NOTE: We intentionally use 1424px here (instead of 1420px) to match the UI
  breakpoint you referenced.
*/
@media (max-width: 1424px) {
  /*
    When stacked (single column), stop using the fixed-height 3-row grid model.
    Otherwise the iframe's min-height can overflow and visually sit under the status card.
  */
  #newsletterPanel .calendar-zone {
    height: auto;
    grid-template-rows: auto auto auto;
    align-content: start;
  }

  #newsletterPanel .controls-preview-wrapper {
    grid-template-columns: 1fr;
    height: auto;
  }

  #newsletterPanel .campaign-controls {
    max-height: none;
    overflow: visible;
  }

  #newsletterPanel .preview-section {
    height: auto;
  }

  /* Match the “sidebar overlay” (<=1100px) behavior: don’t force a vh-based height,
     just ensure the iframe never collapses too small. */
  #newsletterPanel #previewFrame {
    height: 75vh;
    max-height: 900px;
    min-height: 520px;
  }
}

/*
  Keep Newsletter preview sizing consistent across the stacked layout.
  If you want a different behavior on very small screens, re-introduce a
  dedicated rule here, but make sure it matches your “identical layout” goal.
*/
@media (max-width: 900px) {
  #newsletterPanel #previewFrame {
    height: 75vh;
    max-height: 900px;
    min-height: 520px;
  }
}

label {
  display: block;
  margin: 12px 0 6px 0;
  font-weight: 600;
  font-size: 12px;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.required-asterisk {
  color: #dc2626;
  font-weight: 900;
  margin-left: 4px;
}

input,
select,
textarea,
button {
  width: 100%;
  font-size: 14px;
  font-family: inherit;
}

input,
select,
textarea {
  padding: 12px 14px;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  background: #ffffff;
  transition: all 0.2s ease;
  color: #1a202c;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  filter: grayscale(0.12);
}

button:disabled:hover,
.btn-primary:disabled:hover,
.btn-secondary:disabled:hover,
.btn-danger:disabled:hover {
  transform: none;
  box-shadow: none;
}

select:disabled,
input:disabled,
textarea:disabled {
  background: #f4f7fb;
  border-color: #d5dce8;
  color: #5f6b7c;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #4a65ad;
  box-shadow: 0 0 0 3px rgba(74, 101, 173, 0.1);
  background: #f9fafc;
}

input::placeholder {
  color: #9ca3af;
}

input.field-missing,
select.field-missing,
textarea.field-missing {
  border-color: #ef4444;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 1px solid #cfd7e6;
  border-radius: 8px;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  padding: 0;
}

.password-toggle:hover {
  background: #eef2ff;
  border-color: #b9c7ec;
  transform: translateY(-50%);
}

.password-toggle .icon-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle .icon-eye svg {
  width: 16px;
  height: 16px;
  display: block;
}

.password-toggle .icon-eye-closed {
  display: none;
}

.password-toggle[data-state="shown"] .icon-eye-open {
  display: none;
}

.password-toggle[data-state="shown"] .icon-eye-closed {
  display: inline-flex;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.actions button {
  flex: 1;
  min-width: 120px;
}

button {
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: #4a65ad;
  color: #fff;
}

.btn-primary:hover {
  background: #3b5494;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 101, 173, 0.3);
}

.btn-secondary {
  background: #64748b;
  color: #fff;
}

.btn-secondary:hover {
  background: #4b5563;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

button:active {
  transform: translateY(0);
}

iframe {
  width: 100%;
  min-height: 520px;
  border: 1px solid #d8dfec;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #f3f4f6;
  border-bottom: 2px solid #e5e7eb;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
}

tbody tr:hover {
  background: #f9fafc;
  transition: background 0.2s ease;
}

.status-box {
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  background: #f9fafc;
  font-weight: 500;
  color: #4b5563;
  transition: all 0.3s ease;
}

.status-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.status-error {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

.status-warn {
  border-color: #fbbf24;
  background: #fffbeb;
  color: #92400e;
}

.alert {
  margin-bottom: 14px;
  border-radius: 10px;
  padding: 12px 14px;
  border-left: 4px solid;
  font-weight: 500;
}

.alert-error {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.users-page-shell {
  width: 100%;
  margin: 0;
}

.users-page-shell.users-page-shell,
.users-page-shell.card-shell {
  padding: 20px;
}

.users-page-shell > .status-box,
.users-page-shell > .alert {
  margin-bottom: 22px;
}

.users-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 22px;
}

.users-section:last-of-type {
  margin-bottom: 0;
}

.users-section.users-section-table {
  background: #ffffff;
  border-color: #dbe4f0;
}

.users-section.users-section-create {
  max-width: 760px;
}

.users-create-form {
  width: 100%;
}

.users-create-form > label {
  margin: 10px 0 0 0;
  padding-left: 5px;
}

.users-create-form input,
.users-create-form select {
  border-radius: 10px;
}

.users-create-form select {
  padding-left: 14px;
  padding-right: 42px;
  line-height: 1.3;
}

.users-create-form > button {
  margin-top: 10px;
  width: auto;
  min-width: 220px;
  justify-self: start;
}

.users-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f4f8;
}

.form-inline {
  display: grid;
  gap: 8px;
}

.hidden-form {
  display: none;
}

.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.users-toolbar .hint {
  font-size: 13px;
}

.users-toolbar button {
  width: auto;
  min-width: 170px;
}

.users-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.users-toolbar-actions button {
  width: auto;
}

.users-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.users-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

/* Column selector */
.clients-columns {
  position: relative;
}

.clients-columns-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  min-width: 120px;
  margin: 0;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.2px;
  color: #fff;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
  cursor: pointer;
}

.clients-columns-summary::-webkit-details-marker {
  display: none;
}

.clients-columns-summary::marker {
  display: none;
}

.clients-columns-summary-label {
  font-weight: 700;
}

.clients-columns-summary-icon {
  font-size: 14px;
  transform: translateY(-1px);
  transition: transform 0.18s ease;
}

.clients-columns.is-open .clients-columns-summary-icon {
  transform: translateY(-1px) rotate(180deg);
}

.clients-columns-summary:hover {
  background: #4b5563;
}

.clients-columns-summary:focus-visible {
  outline: 2px solid rgba(74, 101, 173, 0.35);
  outline-offset: 2px;
}

.clients-columns-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: 220px;
  background: #ffffff;
  border: 1px solid #d7deeb;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  padding: 10px;
  display: grid;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.clients-columns.is-open .clients-columns-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.clients-columns-panel {
  transform-origin: top right;
}

.clients-columns-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.clients-columns-item input {
  width: 16px;
  height: 16px;
}

/* Column visibility */

.clients-table [data-client-col] {
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.clients-table [data-client-col].is-col-collapsing {
  opacity: 0;
  transform: translateY(-2px);
}

.clients-table [data-client-col].is-col-hidden {
  display: none;
}

/* Ensure cells stay one-line and width fits content (scroll if needed) */
.clients-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.clients-table th,
.clients-table td {
  white-space: nowrap;
}

.clients-table input[type="text"],
.clients-table input[type="email"] {
  width: max-content;
  min-width: 120px;
}

.clients-table .client-copy-field.client-empty-dash.is-empty.is-readonly::placeholder {
  color: #94a3b8;
  opacity: 1;
}

.users-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  table-layout: auto;
}

.users-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.users-table tbody td {
  vertical-align: middle;
  background: #fff;
}

.users-table th,
.users-table td {
  white-space: nowrap;
}

.users-table .col-id {
  font-weight: 700;
  white-space: nowrap;
  color: #1f2937;
}

.users-table .col-select {
  width: 68px;
  text-align: center;
}

.users-table .user-select-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.users-table .delete-user-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
}

.users-table .select-disabled {
  color: #94a3b8;
  font-weight: 700;
}

.users-table .col-user strong {
  display: block;
  color: #0f172a;
}

.users-table .col-user {
  min-width: 140px;
  white-space: normal;
}

.users-table .row-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.users-table .col-email,
.users-table .col-last-login {
  color: #475569;
  white-space: nowrap;
}

.users-table .col-access {
  width: 1%;
}

.users-table .col-role {
  min-width: 170px;
}

.users-table .col-status {
  min-width: 130px;
}

.users-table .access-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
  gap: 10px;
  align-items: end;
}

.users-table .field-wrap {
  display: grid;
  gap: 6px;
}

.users-table .field-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.users-table .field-wrap select {
  width: auto;
  min-width: 140px;
  padding: 7px 10px;
  border-radius: 8px;
  line-height: 1.2;
}

.users-table .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.users-table .inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.users-table .checkbox-wrap {
  align-content: end;
}

.users-table .col-reset {
  min-width: 220px;
}

.users-table .reset-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.users-table .reset-form input[type="password"] {
  min-width: 0;
}

.users-table .reset-form button {
  width: auto;
  white-space: nowrap;
}

.users-table .static-access {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
}

.state-active {
  background: #dcfce7;
  color: #166534;
}

.state-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.users-table tr.row-changed td {
  background: #fffbeb;
}

.users-table tr.row-changed .col-id {
  color: #92400e;
}

.users-table .field-changed {
  border-color: #f59e0b;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

@media (max-width: 900px) {
  .users-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .users-toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .users-toolbar button {
    width: 100%;
  }
}

.clients-page-shell {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
}

.clients-page-shell.clients-page-shell,
.clients-page-shell.card-shell {
  padding: 20px;
}

.clients-page-shell > .status-box,
.clients-page-shell > .alert {
  margin-bottom: 22px;
}

.clients-help-sheet[hidden] {
  display: none !important;
}

.clients-help-sheet {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: block;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.clients-help-sheet.is-open,
.clients-help-sheet.is-closing {
  pointer-events: auto;
}

.clients-help-sheet.is-open {
  opacity: 1;
}

.clients-help-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 220ms ease;
}

.clients-help-sheet.is-open .clients-help-sheet__backdrop {
  opacity: 1;
}

.clients-help-sheet__panel {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(620px, 100%);
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  border-left: 1px solid #dbe4f0;
  box-shadow: -16px 0 40px rgba(15, 23, 42, 0.16);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  outline: none;
  overflow: hidden;
  overscroll-behavior: contain;
  transform: translateX(28px);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
}

.clients-help-sheet.is-open .clients-help-sheet__panel {
  transform: translateX(0);
  opacity: 1;
}

.clients-help-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 18px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  min-height: 0;
}

.clients-help-sheet__header h2 {
  margin: 4px 0 8px;
  font-size: 26px;
  line-height: 1.15;
  color: #0f172a;
}

.clients-help-sheet__eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2563eb;
}

.clients-help-sheet__intro {
  margin: 0;
  color: #475569;
  line-height: 1.5;
}

.clients-help-sheet__close {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #dbe4f0;
  background: #fff;
  color: #1f2937;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.clients-help-sheet__close:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: none;
  box-shadow: none;
}

.clients-help-sheet__content {
  min-height: 0;
  padding: 20px 24px calc(120px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
}

.clients-help-sheet__content::after {
  content: "";
  display: block;
  height: calc(80px + env(safe-area-inset-bottom, 0px));
}

.clients-help-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
}

.clients-help-card:last-of-type {
  margin-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

.clients-help-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #0f172a;
}

.clients-help-card p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.clients-help-example {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px dashed #bfdbfe;
}

.clients-help-example__label {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1d4ed8;
}

body.clients-help-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .clients-help-sheet,
  .clients-help-sheet__backdrop,
  .clients-help-sheet__panel {
    transition: none;
  }
}

.clients-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  min-width: 0;
  padding: 16px;
  margin-bottom: 22px;
}

.clients-section:last-of-type {
  margin-bottom: 0;
}

.clients-section.clients-section-table {
  background: #ffffff;
  border-color: #dbe4f0;
}

.clients-section h2 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f4f8;
}

.clients-form-grid {
  max-width: 620px;
}

.clients-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.clients-add-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.clients-add-card label {
  margin: 6px 0 3px 0;
}

.clients-add-card .clients-form-grid > label:first-of-type {
  margin-top: 0;
}

.clients-add-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.clients-add-divider {
  height: 1px;
  background: #e5e7eb;
  margin-bottom: 12px;
}

.clients-add-card .clients-form-grid {
  max-width: none;
  gap: 8px;
}

.clients-add-card input[type="text"],
.clients-add-card input[type="email"],
.clients-add-card input:not([type]),
.clients-add-card select {
  width: 100%;
  min-width: 180px;
  height: 34.5px;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.2;
}

.inline-check-compact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 600;
}

.inline-check-compact input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.visually-hidden-input {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.custom-file-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.clients-add-card .actions {
  margin-top: 12px;
}

.clients-add-card .hint {
  margin-top: 6px;
}

.custom-file-trigger {
  text-align: left;
  border: 1px solid #cfd7e6;
  background: #fff;
  color: #1f2937;
  height: 34.5px;
  min-height: 34.5px;
  padding: 7px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.custom-file-trigger:hover {
  border-color: #9fb1d9;
  background: #f8fbff;
  transform: none;
  box-shadow: none;
}

.custom-file-clear {
  width: 34.5px;
  min-width: 34.5px;
  height: 34.5px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.custom-file-clear:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  transform: none;
  box-shadow: none;
}

.custom-file-clear.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.clients-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.clients-toolbar-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.clients-toolbar-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.clients-toolbar button {
  width: auto;
  min-width: 132px;
}

.clients-toolbar button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.clients-search {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.clients-search input {
  height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
}

.clients-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.clients-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.clients-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.clients-table tbody td {
  vertical-align: middle;
  background: #fff;
}

.clients-table .col-id {
  font-weight: 700;
  white-space: nowrap;
  color: #1f2937;
}

.clients-table th:nth-child(5),
.clients-table td:nth-child(5) {
  text-align: center;
}

.clients-table .col-id-select {
  white-space: nowrap;
  width: 1%;
  text-align: left;
  padding-left: 14px;
  padding-right: 10px;
}

.clients-table .id-select-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.clients-table thead th:first-child {
  text-align: left;
  width: 1%;
  white-space: nowrap;
  padding-left: 14px;
  padding-right: 10px;
}

.clients-table .client-select-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.clients-table .client-row-select {
  width: 16px;
  height: 16px;
  margin: 0;
}

.clients-table input[type="text"],
.clients-table input[type="email"] {
  width: 100%;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clients-table .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
}

.clients-table .active-edit-toggle.is-hidden {
  display: none;
}

.clients-table .inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.clients-table .client-copy-field[type="checkbox"] {
  accent-color: #4a65ad;
  opacity: 1;
}

.clients-table .client-copy-field[type="checkbox"]:disabled {
  accent-color: #4a65ad;
  opacity: 1;
  filter: none;
}

.clients-table .client-copy-field.is-readonly {
  cursor: pointer;
  background: #f8fafc;
}

/* Copy hint badge removed; click-to-copy still works without UI badge */

.active-state-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.active-state-dot.is-active {
  background: #22c55e;
}

.active-state-dot.is-inactive {
  background: #ef4444;
}

.active-state-dot.is-hidden {
  display: none;
}

.client-edit-btn[data-state="edit"] {
  background: #f59e0b;
  color: #fff;
}

.client-edit-btn[data-state="edit"]:hover {
  background: #d97706;
}

.client-edit-btn[data-state="done"] {
  background: #4a65ad;
  color: #fff;
}

.client-edit-btn[data-state="done"]:hover {
  background: #3b5494;
}

.client-edit-btn[data-state="save"] {
  background: #16a34a;
  color: #fff;
}

.client-edit-btn[data-state="save"]:hover {
  background: #15803d;
}

.client-delete-icon-btn {
  min-width: 40px !important;
  width: 40px !important;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.clients-table .client-copy-field.field-copied {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.clients-table tr.row-changed td {
  background: #fffbeb;
}

.clients-table tr.row-changed .col-id {
  color: #92400e;
}

.clients-table tbody tr:last-child td {
  border-bottom: 0;
}

/* =============================
   Newsletter recipients section
   ============================= */
.recipients-section {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.recipients-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.recipients-head h2 {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.recipients-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.recipients-actions button {
  width: auto;
  min-width: 120px;
  white-space: normal;
}

.recipients-search {
  display: grid;
  gap: 8px;
}

.recipients-search input {
  height: 38px;
  padding: 9px 12px;
  border-radius: 10px;
}

.recipients-one-time {
  display: grid;
  gap: 10px;
}

.recipients-one-time-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.recipients-one-time-row input {
  height: 38px;
  padding: 9px 12px;
}

.recipients-one-time-row button {
  width: auto;
  min-width: 160px;
}

.recipients-one-time-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.one-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid #d7deeb;
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  font-size: 13px;
}

.one-time-chip button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  padding: 0;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.one-time-chip button:hover {
  background: #fee2e2;
  transform: none;
  box-shadow: none;
}

.recipients-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  max-height: 420px;
  overflow-y: auto;
  position: relative;
}

.recipients-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
  table-layout: fixed;
}

.recipients-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.recipients-table tbody td {
  vertical-align: middle;
  background: #fff;
}

.recipients-table .col-select {
  width: 44px;
}

.recipients-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.recipients-table td,
.recipients-table th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stable column widths to avoid shifting when rows re-render */
.recipients-table .col-select { width: 44px; }
.recipients-table [data-recipient-col="client"] { width: 260px; }
.recipients-table [data-recipient-col="email"] { width: 240px; }
.recipients-table [data-recipient-col="contact_person"] { width: 180px; }
.recipients-table [data-recipient-col="city"] { width: 120px; }
.recipients-table [data-recipient-col="position"] { width: 120px; }
.recipients-table [data-recipient-col="direction"] { width: 120px; }
.recipients-table [data-recipient-col="active"] { width: 80px; }

.recipients-table [data-recipient-col].is-col-hidden {
  display: none;
}

.recipients-table [data-recipient-col].is-col-collapsing {
  opacity: 0;
  transform: translateY(-2px);
}

.recipients-table [data-recipient-col] {
  transition: opacity 0.14s ease, transform 0.14s ease;
}

@media (max-width: 900px) {
  .recipients-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .recipients-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .recipients-actions button {
    width: 100%;
  }
  .recipients-one-time-row {
    grid-template-columns: 1fr;
  }
  .recipients-one-time-row button {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .clients-add-grid {
    grid-template-columns: 1fr;
  }

  .clients-add-upload {
    order: 1;
  }

  .clients-add-manual {
    order: 2;
  }

  .clients-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .clients-toolbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .clients-toolbar button {
    width: 100%;
  }
}
