/* ══════════════════════════════════════════════════════════════
   SLOT DETAIL PAGE STYLES
   /cabinet/schedule/{id} — slot details with tabs, attendance, notes
   ══════════════════════════════════════════════════════════════ */

:root {
  --sd-accent: #F59E0B;
  --sd-accent-deep: #C87A0A;
  --sd-accent-tint: #FFF3DC;
  --sd-accent-soft: #FFF8EC;
  --sd-accent-border: #FBE3B8;
  --sd-green: #2E8B57;
  --sd-green-bg: #E6F5EB;
  --sd-red: #DC2626;
  --sd-red-bg: #FDECEC;
  --sd-muted: #9C948C;
  --sd-ink: #1A1A1A;
  --sd-line: #F0ECE5;
  --sd-shadow: 0 1px 2px rgba(20,16,10,0.04), 0 4px 10px rgba(20,16,10,0.03);
}

.sd-shell { background: #F5F3EE; min-height: 100vh; box-sizing: border-box; padding-bottom: 32px; }

/* ── Header ── */
.sd-top { display: flex; align-items: flex-start; gap: 12px; padding: 22px 0 4px; }
.sd-top-body { flex: 1; min-width: 0; }
.sd-branch { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--sd-muted); margin: 0 0 6px; }
.sd-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; color: var(--sd-ink); margin: 0; }
.sd-statusline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sd-status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.sd-status-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.sd-status-chip.scheduled { background: var(--sd-accent-tint); color: var(--sd-accent-deep); }
.sd-status-chip.in_progress { background: var(--sd-green); color: #fff; }
.sd-status-chip.attendance_pending { background: var(--sd-accent-tint); color: var(--sd-accent-deep); }
.sd-status-chip.completed { background: var(--sd-green-bg); color: var(--sd-green); }
.sd-status-chip.cancelled { background: var(--sd-red-bg); color: var(--sd-red); }
.sd-when { font-size: 13px; color: var(--sd-muted); font-weight: 500; }

/* ── Flash ── */
.sd-flash { border-radius: 14px; padding: 11px 14px; font-size: 13px; font-weight: 500; margin-top: 14px; }
.sd-flash.ok { background: var(--sd-green-bg); color: var(--sd-green); }
.sd-flash.err { background: var(--sd-red-bg); color: var(--sd-red); }

/* ── Online primary CTA ── */
.sd-enter {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; box-sizing: border-box; margin-top: 16px;
  padding: 14px; border-radius: 14px;
  background: var(--sd-accent); color: #fff; border: none; cursor: pointer;
  font-weight: 700; font-size: 14.5px; text-decoration: none;
  box-shadow: 0 2px 4px rgba(20,16,10,0.06), 0 8px 20px rgba(200,122,10,0.18);
}
.sd-enter:hover { background: var(--sd-accent-deep); }

/* ── Details (always visible) ── */
.sd-details { margin-top: 16px; }

/* ── Layout: tabs + content ── */
.sd-layout { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }

/* tabs */
.sd-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sd-tabs--4 { grid-template-columns: repeat(4, 1fr); }
.sd-tabs--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) {
  .sd-tabs--4 { grid-template-columns: repeat(2, 1fr); }
}
.sd-tab {
  background: #fff; border: 1px solid transparent; border-radius: 14px;
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; text-align: center; color: var(--sd-muted);
  box-shadow: var(--sd-shadow); transition: background .15s, color .15s, border-color .15s;
  position: relative;
}
.sd-tab:hover { color: var(--sd-ink); }
.sd-tab.is-active { background: var(--sd-accent-soft); border-color: var(--sd-accent-border); color: var(--sd-accent-deep); }
.sd-tab svg { display: block; }
.sd-tab-label { font-size: 11.5px; font-weight: 600; line-height: 1.15; }
.sd-tab-count {
  position: absolute; top: 8px; right: 10px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--sd-accent); color: #fff; font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.sd-tab.is-active .sd-tab-count { background: var(--sd-accent-deep); }

/* panels */
.sd-panel { display: none; }
.sd-panel.is-active { display: block; animation: sdFade .18s ease; margin: 20px 0; }
@keyframes sdFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (min-width: 999px) {
  .sd-panel.is-active { margin: 0; }
}

/* content wrapper */
.sd-content {
  min-width: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 768px) {
  .sd-content {
    padding: 0;
    gap: 14px;
  }
}

@media (min-width: 769px) {
  .sd-content {
    padding: 0;
    gap: 16px;
  }
}

/* ── Card / section ── */
.sd-card { background: #fff; border-radius: 16px; box-shadow: var(--sd-shadow); overflow: hidden; }
.sd-card + .sd-card { margin-top: 12px; }
.sd-card-pad { padding: 14px 14px; }
.sd-student-card { overflow: visible; }
.sd-student-card + .sd-student-card { margin-top: 10px; }
.sd-attend-progress-card { padding: 12px 14px; }
.sd-attend-footer-card { padding: 14px; }
.sd-section-title {
  font-size: 11px; font-weight: 600; color: var(--sd-muted);
  text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 2px 8px;
}
.sd-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--sd-line);
}
.sd-card-head-title { font-size: 13px; font-weight: 700; color: var(--sd-ink); }
.sd-edit-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #E8E2DA; border-radius: 10px;
  padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: var(--sd-accent-deep);
  cursor: pointer; transition: background .15s;
}
.sd-edit-btn:hover { background: var(--sd-accent-soft); }

/* info rows */
.sd-info-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--sd-line); font-size: 14px; }
.sd-info-row:last-child { border-bottom: none; }
.sd-info-label { color: var(--sd-muted); min-width: 130px; font-size: 13px; }
.sd-info-value { font-weight: 600; color: var(--sd-ink); }
.sd-info-value.muted { font-weight: 500; color: var(--sd-muted); }
.sd-link { color: var(--sd-accent-deep); font-weight: 600; text-decoration: none; }
.sd-link:hover { text-decoration: underline; }

/* Redesign: Logical grouping with spacing */
.sd-info-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sd-line);
}
.sd-info-group:last-child { border-bottom: none; }
.sd-info-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--sd-muted);
  margin-bottom: 4px;
}
.sd-info-group-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  flex-wrap: wrap;
}
.sd-info-group-content > * {
  flex: 1 1 100%;
  min-width: 0;
}
.sd-info-label {
  flex: 0 0 auto;
  min-width: 130px;
}
.sd-info-group-value { font-weight: 600; color: var(--sd-ink); }
.sd-info-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
/* кнопка-ссылка с иконкой карандаша (<x-sd-edit-link />) */
.sd-edit-link,
.sd-edit-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--sd-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.2;
}
.sd-edit-link:hover,
.sd-edit-icon:hover { color: var(--sd-ink); text-decoration: none; }
.sd-edit-link__icon { flex: none; display: block; opacity: .7; }
.sd-edit-link:hover .sd-edit-link__icon { opacity: 1; }

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .sd-info-group-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .sd-info-label {
    min-width: auto;
    width: 100%;
    margin-bottom: 2px;
  }
  .sd-info-group-value,
  .sd-link,
  .sd-info-group-value.muted {
    width: 100%;
  }
  .sd-student-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .sd-attend-main {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .sd-attend-identity {
    font-size: 14px;
  }
  .sd-att-select {
    flex: none;
    min-width: 96px;
    max-width: 46%;
  }
  .sd-att-status {
    padding: 5px 8px;
    font-size: 12px;
  }
  .sd-sale-fields {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .sd-abo-list {
    gap: 4px;
  }
  .sd-abo-opt {
    padding: 8px 6px;
  }
}

/* attendance progress */
.sd-attend-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sd-attend-progress-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--sd-muted);
  letter-spacing: 0.01em;
}
.sd-attend-progress-track {
  height: 3px;
  border-radius: 999px;
  background: var(--sd-line);
  overflow: hidden;
}
.sd-attend-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--sd-accent);
  transition: width .2s ease;
}

/* ── Student card blocks ── */
.sd-block { margin-top: 10px; }
.sd-block:first-child { margin-top: 0; }
.sd-block-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--sd-muted);
  margin-bottom: 4px;
}
.sd-block-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--sd-ink);
  line-height: 1.35;
}
.sd-block-main { margin-top: 10px; }

/* attendance rows */
.sd-attend-row { padding: 0; }
.sd-attend-head { display: flex; flex-direction: column; gap: 0; }
.sd-attend-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.sd-new-badge {
  display: inline-block;
  align-self: flex-start;
  width: fit-content;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4338CA;
  background: #EEF2FF;
  border-radius: 999px;
  padding: 2px 7px;
  line-height: 1.3;
}
.sd-waitlist-badge {
  display: inline-block;
  align-self: flex-start;
  width: fit-content;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #92400E;
  background: #FEF3C7;
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.3;
}
.sd-attend-identity {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sd-ink);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.sd-attend-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sd-abo-remain {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--sd-muted);
  line-height: 1.35;
  letter-spacing: 0;
}
.sd-attend-row.is-collapsed .sd-abo-remain { display: none; }
.sd-attend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding-top: 1px;
}
.sd-attend-summary {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
}
.sd-attend-row.is-collapsed .sd-attend-summary { display: flex; }
.sd-attend-row.is-collapsed .sd-attend-body { display: none; }
.sd-attend-row:not(.is-collapsed) .sd-attend-summary { display: none; }
.sd-summary-text {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--sd-muted);
  line-height: 1.35;
}
.sd-summary-hint {
  font-size: 12px;
  font-weight: 400;
  color: #B8AFA4;
}
.sd-attend-body { margin-top: 10px; }
.sd-meta-edit.sd-edit-link { font-size: 11.5px; }
.sd-attend-row:not(.is-collapsed) .sd-meta-edit { display: none; }
.sd-student-link { color: inherit; text-decoration: none; font-weight: 600; }
.sd-student-link:hover { text-decoration: underline; }
.sd-student-age { font-weight: 400; color: var(--sd-muted); }

/* contact phone + messenger badges */
.sd-contact-wrap {
  position: relative;
  align-self: flex-start;
  margin-top: 2px;
}
.sd-contact-phone {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--sd-muted);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.sd-contact-phone:hover { color: var(--sd-ink); }
.sd-contact-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 120;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid var(--sd-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 16, 10, .12);
}
.sd-contact-wrap.is-open .sd-contact-menu { display: flex; animation: sdFade .14s ease; }
.sd-contact-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  text-decoration: none;
  flex: none;
  transition: background .12s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.sd-contact-badge:hover { transform: translateY(-1px); }
.sd-contact-badge img { display: block; width: 18px; height: 18px; object-fit: contain; }
.sd-contact-badge--wa { background: #E8FBEF; }
.sd-contact-badge--wa:hover { background: #D1F5E0; }
.sd-contact-badge--tg { background: #E8F4FC; }
.sd-contact-badge--tg:hover { background: #D6EBFA; }
.sd-contact-badge--max { background: #F0EBFF; padding: 0; overflow: hidden; }
.sd-contact-badge--max:hover { background: #E4DAFF; }
.sd-contact-badge--max svg { display: block; width: 18px; height: 18px; border-radius: 5px; }
.sd-contact-badge--tel { background: #F3F4F6; color: #6B7280; }
.sd-contact-badge--tel:hover { background: #E5E7EB; color: #374151; }

/* ── Выписавшиеся (отказ от подтверждения присутствия) ── */
.sd-declined-list { display: flex; flex-direction: column; gap: 10px; }
.sd-declined-row { display: flex; flex-direction: column; gap: 4px; }
.sd-declined-row + .sd-declined-row { padding-top: 10px; border-top: 1px solid var(--sd-line); }
.sd-declined-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-declined-head .sd-student-link { color: var(--sd-muted); font-weight: 500; }
.sd-declined-badge {
  display: inline-flex; align-items: center; flex: none;
  border: 1px solid var(--sd-red-bg); background: var(--sd-red-bg);
  color: var(--sd-red); border-radius: 999px; padding: 3px 10px;
  font-size: 11.5px; font-weight: 600; line-height: 1.2; font-family: inherit;
}
button.sd-declined-badge { cursor: pointer; transition: filter .15s; }
button.sd-declined-badge:hover { filter: brightness(0.97); }
.sd-declined-detail { font-size: 12.5px; color: var(--sd-muted); line-height: 1.35; padding-left: 2px; }

/* comment: строка после сохранения / однострочный ввод */
.sd-lesson-comment-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sd-line); }
.sd-comment-view {
  display: none;
  min-width: 0;
  max-width: 100%;
}
.sd-comment-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}
.sd-comment-text {
  min-width: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--sd-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sd-comment-edit.sd-edit-link {
  flex: none;
  vertical-align: middle;
}
.sd-edit-link--icon-only { gap: 0; }
.sd-comment-edit-wrap { display: block; }
.sd-lesson-comment-block.is-saved .sd-comment-view { display: block; }
.sd-lesson-comment-block.is-saved .sd-comment-edit-wrap { display: none; }
.sd-lesson-comment-block.is-editing .sd-comment-view { display: none; }
.sd-comment-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #E8E2DA;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  background: #FBF9F5;
  color: var(--sd-ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.sd-comment-input:focus {
  border-color: var(--sd-accent);
  background: #fff;
}
.sd-comment-input::placeholder { color: var(--sd-muted); }
.sd-attend-row.is-collapsed .sd-lesson-comment-block { margin-top: 8px; padding-top: 8px; }
.sd-cancel-form { margin: 0; display: inline-flex; }
.sd-cancel-row { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--sd-line); }

.sd-attend-footer {
  padding: 0;
  border-top: none;
  background: transparent;
}
.sd-attend-footer-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--sd-muted);
  font-weight: 400;
  text-align: center;
}

/* legacy aliases (другие секции страницы) */
.sd-student-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sd-student-name { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 14px; font-weight: 600; color: var(--sd-ink); }
.sd-student-payment { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.sd-payment-group { display: flex; align-items: center; gap: 6px; }

/* кастомный селект статуса посещаемости */
.sd-att-select { position: relative; flex: none; min-width: 108px; }
.sd-att-status {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; box-sizing: border-box; font-family: inherit; line-height: 1.2;
  border: 1px solid #E8E2DA; border-radius: 9px; padding: 6px 9px;
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.sd-att-status--confirmed { background: #fff; color: #5C544B; }
.sd-att-status--attended { background: var(--sd-green-bg); color: var(--sd-green); border-color: #C8E6D4; }
.sd-att-status--missed { background: var(--sd-red-bg); color: var(--sd-red); border-color: #F5C6C6; }
.sd-att-readonly {
  display: inline-flex; align-items: center; flex: none;
  border: 1px solid #E8E2DA; border-radius: 9px; padding: 6px 9px;
  font-size: 13px; font-weight: 500; line-height: 1.2;
}
.sd-att-select.open .sd-att-status { border-color: var(--sd-accent); box-shadow: 0 0 0 3px var(--sd-accent-tint); }
.sd-select-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-select-arrow { flex: none; opacity: .55; transition: transform .18s; }
.sd-att-select.open .sd-select-arrow { transform: rotate(180deg); }
.sd-select-menu {
  display: none; position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 100%; width: max-content; background: #fff; padding: 4px;
  border: 1px solid #ECE6DE; border-radius: 11px;
  box-shadow: 0 10px 28px rgba(20,16,10,.14); z-index: 50;
}
.sd-att-select.open .sd-select-menu { display: block; animation: sdFade .14s ease; }
.sd-select-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; color: var(--sd-ink);
}
.sd-select-opt[data-value="confirmed"] { color: #5C544B; }
.sd-select-opt[data-value="attended"]  { color: var(--sd-green); }
.sd-select-opt[data-value="missed"]    { color: var(--sd-red); }
.sd-select-opt:hover { background: #F6F3EE; }
.sd-select-opt::after { content: '✓'; font-size: 12px; opacity: 0; }
.sd-select-opt[data-selected="true"]::after { opacity: 1; }
.sd-cancel-link { background: none; border: none; color: var(--sd-red); font-size: 12px; cursor: pointer; padding: 6px 0; font-weight: 600; font-family: inherit; }
.sd-cancel-link:hover { text-decoration: underline; }

/* свёрнутое (уже сохранённое) состояние строки */
.sd-att-edit.sd-edit-link {
  padding: 6px 0;
  display: none;
}
.sd-att-edit.sd-edit-link:hover { text-decoration: underline; }
.sd-attend-row.is-collapsed .sd-att-edit.sd-edit-link { display: inline-flex; align-items: center; }
.sd-attend-row.is-collapsed:has(.sd-meta-edit) .sd-att-edit.sd-edit-link { display: none; }
.sd-attend-row.is-collapsed .sd-att-pay,
.sd-attend-row.is-collapsed .sd-abo-panel,
.sd-attend-row.is-collapsed .sd-sale-panel,
.sd-attend-row.is-collapsed .sd-attend-body { display: none !important; }

.sd-btn-secondary {
  width: auto;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid #E8E2DA;
  background: #fff;
  color: var(--sd-accent-deep);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.sd-btn-secondary:hover {
  background: var(--sd-accent-soft);
  border-color: var(--sd-accent-border);
}

.sd-toggle { display: flex; gap: 6px; margin-top: 4px; }
.sd-toggle-opt {
  flex: 1; padding: 8px 10px; border: 1px solid #E8E2DA; border-radius: 9px; background: #fff;
  font-size: 13px; font-weight: 500; color: #6B6259; cursor: pointer; text-align: center; transition: all .15s;
}
.sd-toggle-opt.is-active { background: var(--sd-accent-soft); border-color: var(--sd-accent-border); color: var(--sd-accent-deep); }
.sd-toggle-opt:disabled { background: #F6F3EE; color: #C8C0B6; cursor: not-allowed; border-color: #EFEAE2; }
.sd-att-pay { margin-top: 10px; }

/* ── Панели под табами оплаты (абонемент / продажа) ── */
.sd-abo-panel,
.sd-sale-panel {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--sd-line);
}
.sd-abo-panel.is-open,
.sd-sale-panel.is-open { display: block; animation: sdFade .18s ease; }

/* ── Панель продаж ── */
.sd-sale-fields {
  display: grid;
  grid-template-columns: minmax(90px,1fr) minmax(80px,1.2fr) minmax(72px,.9fr) minmax(80px,1.2fr);
  gap: 8px; padding: 6px 0 0;
}
.sd-sale-col { display: flex; flex-direction: column; gap: 5px; }
.sd-sale-label { font-size: 10.5px; font-weight: 600; color: var(--sd-muted); white-space: nowrap; }
.sd-sale-input {
  width: 100%; box-sizing: border-box; border: 1px solid #E8E2DA; border-radius: 8px;
  padding: 7px 9px; font-size: 13px; font-weight: 600; color: var(--sd-ink);
  background: #fff; outline: none; text-align: right;
  transition: border-color .15s, box-shadow .15s;
}
.sd-sale-input:focus { border-color: var(--sd-accent); box-shadow: 0 0 0 3px var(--sd-accent-tint); }
.sd-sale-input[readonly] { background: #F6F3EE; color: #5C544B; cursor: default; }
.sd-sale-input::placeholder, .sd-sale-step-val::placeholder { color: #B8AFA4; font-weight: 600; }
/* убрать стрелки-спиннеры у числовых полей */
.sd-sale-input::-webkit-outer-spin-button,
.sd-sale-input::-webkit-inner-spin-button,
.sd-sale-step-val::-webkit-outer-spin-button,
.sd-sale-step-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sd-sale-input[type=number], .sd-sale-step-val[type=number] { -moz-appearance: textfield; appearance: textfield; }
.sd-sale-stepper { display: flex; align-items: center; gap: 0; border: 1px solid #E8E2DA; border-radius: 8px; background: #fff; overflow: hidden; }
.sd-sale-step-btn {
  width: 30px; flex: none; background: none; border: none; cursor: pointer;
  font-size: 16px; font-weight: 500; color: #6B6259; padding: 6px 0;
  transition: background .12s; line-height: 1;
}
.sd-sale-step-btn:hover { background: var(--sd-accent-tint); }
.sd-sale-step-val {
  flex: 1; text-align: center; font-size: 13px; font-weight: 700; color: var(--sd-ink);
  border: none; outline: none; background: transparent; min-width: 0; padding: 0;
}
.sd-sale-total-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 4px; font-size: 13px;
}
.sd-sale-total-label { font-weight: 500; color: var(--sd-muted); }
.sd-sale-total-val { font-size: 17px; font-weight: 800; color: var(--sd-ink); letter-spacing: -0.02em; }
.sd-sale-subtotal-val { font-size: 14px; font-weight: 700; color: var(--sd-ink); }

/* ── Панель списания с абонемента ── */
.sd-abo-list { display: flex; flex-direction: column; gap: 0; }
.sd-abo-opt {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 6px 2px; border-radius: 8px;
  cursor: pointer; transition: background .14s ease;
}
.sd-abo-opt:hover { background: #FAF8F4; }
.sd-abo-opt.is-active { background: #F6F3EE; }
.sd-abo-radio { accent-color: var(--sd-ink); width: 15px; height: 15px; flex: none; cursor: pointer; margin-top: 2px; }
.sd-abo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sd-abo-name { min-width: 0; font-size: 14px; font-weight: 400; color: var(--sd-ink);
  letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-abo-note {
  font-size: 12px; font-weight: 400; color: var(--sd-muted);
  display: block; letter-spacing: -0.005em;
}
.sd-abo-expired {
  display: inline-block; vertical-align: middle; margin-left: 7px;
  padding: 1px 7px; border-radius: 6px; background: #FDECEC; color: #C0392B;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; text-transform: uppercase;
}
.sd-abo-empty { padding: 4px 0; font-size: 12.5px; color: var(--sd-muted); line-height: 1.4; }

/* ── Инфо-подсказка о возврате визита на абонемент ── */
.sd-refund-note {
  display: none; align-items: flex-start; gap: 9px;
  margin-bottom: 10px; padding: 10px 12px;
  border-radius: 10px; background: #F6F3EE;
  font-size: 12.5px; font-weight: 400; line-height: 1.4; color: #5C544B;
}
.sd-refund-note.is-visible { display: flex; animation: sdFade .18s ease; }
.sd-refund-note svg { flex: none; margin-top: 1px; color: var(--sd-muted); }
.sd-refund-note b { font-weight: 600; }

/* ── История списаний с абонемента на занятии ── */
.sd-abo-audit-card { margin-top: 12px; }
.sd-abo-audit-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.sd-abo-audit-item {
  padding: 10px 12px; border-radius: 10px; background: #FBF9F5;
  border: 1px solid #EDE8E0; font-size: 13px; line-height: 1.45;
}
.sd-abo-audit-item--writeoff { border-left: 3px solid #2E8B57; }
.sd-abo-audit-item--accrual { border-left: 3px solid #D97706; background: #FFFBF5; }
.sd-abo-audit-main {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px;
  color: var(--sd-muted); font-size: 12.5px;
}
.sd-abo-audit-time { font-variant-numeric: tabular-nums; color: var(--sd-ink); font-weight: 500; }
.sd-abo-audit-sep { opacity: .45; }
.sd-abo-audit-who { color: var(--sd-ink); }
.sd-abo-audit-pupil { font-weight: 500; }
.sd-abo-audit-detail { margin-top: 4px; color: var(--sd-ink); }
.sd-abo-audit-balance { color: var(--sd-muted); font-weight: 400; margin-left: 4px; }
.sd-abo-audit-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--sd-muted); }

/* на мобилке 4 колонки не влезают — перестраиваем в 2 */
@media (max-width: 560px) {
  .sd-sale-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 8px;
  }
}

/* add student form */
.sd-field {
  width: 100%; box-sizing: border-box; border: 1px solid #E8E2DA; border-radius: 11px;
  padding: 11px 13px; font-size: 14px; background: #FBF9F5; color: var(--sd-ink);
  outline: none; transition: border-color .15s, background .15s;
}
.sd-field:focus { border-color: var(--sd-accent); background: #fff; }
.sd-field + .sd-field { margin-top: 10px; }
.sd-book-btn {
  margin-top: 12px; width: 100%; padding: 12px; border: 1px solid #E8E2DA; border-radius: 11px;
  background: #fff; color: var(--sd-muted); font-weight: 600; font-size: 14px;
  cursor: not-allowed; transition: all .2s;
}
.sd-book-btn.ready { background: var(--sd-accent); color: #fff; border-color: var(--sd-accent); cursor: pointer; box-shadow: 0 6px 16px rgba(200,122,10,0.16); }
.sd-book-btn.ready:hover { background: var(--sd-accent-deep); }
.sd-chosen {
  margin-top: 8px; padding: 12px 14px; background: var(--sd-accent-soft); border: 1px solid var(--sd-accent-border);
  border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--sd-accent-deep);
  display: none; align-items: center; justify-content: space-between;
}
.sd-chosen-x { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--sd-muted); padding: 0; line-height: 1; }

/* textareas (notes) */
.sd-note-label { font-size: 12px; font-weight: 600; color: #6B6259; margin: 0 0 6px; }
.sd-textarea + .sd-note-label { margin-top: 16px; }
.sd-textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #E8E2DA; border-radius: 11px;
  padding: 11px 13px; font-size: 14px; resize: none; overflow: hidden; min-height: 84px; background: #FBF9F5; color: var(--sd-ink);
  outline: none; transition: border-color .15s, background .15s; line-height: 1.5;
}
.sd-textarea:focus { border-color: var(--sd-accent); background: #fff; }

/* waitlist */
.sd-wait-row { padding: 11px 16px; border-bottom: 1px solid var(--sd-line); font-size: 14px; color: var(--sd-ink); }
.sd-wait-row:last-child { border-bottom: none; }
.sd-wait-meta { color: var(--sd-muted); font-size: 12px; margin-left: 6px; }

/* recordings */
.sd-rec-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sd-line); }
.sd-rec-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--sd-accent-tint); color: var(--sd-accent-deep); display: flex; align-items: center; justify-content: center; flex: none; }
.sd-rec-fetch {
  margin-top: 12px; width: 100%; background: #fff; color: #5C544B; border: 1px solid #E8E2DA;
  border-radius: 11px; padding: 11px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.sd-rec-fetch:hover { background: #F6F3EE; }

/* buttons (generic) */
.sd-btn-primary {
  width: 100%; padding: 13px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--sd-accent); color: #fff; font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 16px rgba(200,122,10,0.16);
}
.sd-btn-primary:hover { background: var(--sd-accent-deep); }
.sd-btn-green {
  width: 100%; padding: 13px; border-radius: 12px; border: none; cursor: pointer;
  background: var(--sd-green); color: #fff; font-weight: 700; font-size: 14px;
}
.sd-btn-green:hover { filter: brightness(0.96); }

/* ── Action bar (cancel / delete) ── */
.sd-actionbar { margin-top: 18px; }
.sd-btn-outline {
  width: 100%; box-sizing: border-box; padding: 13px; border-radius: 12px; cursor: pointer;
  background: #fff; border: 1px solid var(--sd-red); color: var(--sd-red); font-weight: 600; font-size: 14px; text-align: center;
}
.sd-btn-outline:hover { background: var(--sd-red-bg); }
.sd-text-danger {
  display: block; width: 100%; background: none; border: none; cursor: pointer;
  color: var(--sd-muted); font-size: 13px; text-align: center; padding: 12px 0 2px; font-weight: 500;
}
.sd-text-danger:hover { color: var(--sd-red); }

/* empty state */
.sd-empty { padding: 28px 16px; text-align: center; color: var(--sd-muted); font-size: 13.5px; }

/* ── Unsaved changes modal ── */
.sd-unsaved-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(20, 16, 10, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.sd-unsaved-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px 18px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--sd-shadow);
}
.sd-unsaved-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--sd-ink);
  margin: 0 0 8px;
  line-height: 1.25;
}
.sd-unsaved-text {
  font-size: 14px;
  color: var(--sd-muted);
  margin: 0 0 18px;
  line-height: 1.4;
}
.sd-unsaved-error {
  font-size: 13px;
  color: var(--sd-red);
  margin: -10px 0 14px;
  line-height: 1.35;
}
.sd-unsaved-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sd-unsaved-actions .sd-btn-green { width: 100%; }
.sd-unsaved-discard {
  width: 100%;
  box-sizing: border-box;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--sd-line);
  background: #fff;
  color: var(--sd-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.sd-unsaved-discard:hover { background: #FBF9F5; }
.sd-unsaved-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--sd-muted);
  text-align: center;
  line-height: 1.35;
}
.sd-unsaved-discard:disabled,
.sd-unsaved-actions .sd-btn-green:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── Desktop 3-column layout ── */
@media (min-width: 1000px) {
  .sd-layout { grid-template-columns: 188px 1fr; gap: 22px; align-items: start; }
  .sd-tabs { grid-template-columns: 1fr; gap: 8px; position: sticky; top: 16px; }
  .sd-tab { flex-direction: row; align-items: center; gap: 11px; padding: 13px 14px; text-align: left; }
  .sd-tab-label { font-size: 13.5px; }
  .sd-tab-count { position: static; margin-left: auto; }
  .sd-content { 
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  #edit-modal-overlay { align-items: center !important; }
  #edit-modal-inner {
    border-radius: 18px !important;
    max-height: 90vh !important;
    width: 480px !important;
    max-width: 90vw !important;
  }
}
