/* Cabinet UI — extends site styles */

.cabinet-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(36, 93, 255, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(31, 143, 255, 0.1), transparent 50%),
    linear-gradient(180deg, #f7f9ff 0%, #eef2fb 45%, #f8fafc 100%);
}

.cabinet-main {
  padding-bottom: 64px;
}

.cabinet-auth {
  max-width: 440px;
  margin: 0 auto;
}

.cabinet-lead {
  color: #4b5568;
  margin: 8px 0 24px;
  line-height: 1.5;
}

.cabinet-form {
  display: grid;
  gap: 14px;
}

.cabinet-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: #1f2937;
  font-weight: 600;
}

.cabinet-form input,
.cabinet-form select {
  width: 100%;
  border: 1px solid #c9d4ea;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
}

.cabinet-form input:focus,
.cabinet-form select:focus {
  outline: 2px solid rgba(36, 93, 255, 0.35);
  border-color: #245dff;
}

.cabinet-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid rgba(36, 93, 255, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.cabinet-span-2 {
  grid-column: span 2;
}

.cabinet-error {
  color: #b42318;
  margin: 0;
  font-size: 14px;
}

.cabinet-ok,
.cabinet-status {
  color: #067647;
  margin: 0;
  font-size: 14px;
}

.cabinet-muted {
  color: #6b7280;
}

.cabinet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.cabinet-owner-banner a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cabinet-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 18px;
  border-bottom: 1px solid #d7dee9;
  padding-bottom: 10px;
}

.cabinet-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #4b5568;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

a.cabinet-tab:hover {
  color: #1d4ed8;
}

.cabinet-tab.active {
  background: rgba(36, 93, 255, 0.1);
  color: #1d4ed8;
}

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

.cabinet-panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.cabinet-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cabinet-panel[hidden] {
  display: none !important;
}

.products-import-panel {
  margin: 4px 0 8px;
}

.products-import-panel[hidden] {
  display: none !important;
}

.products-import-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 8px;
}

.products-import-card {
  background: #fff;
  border: 1px solid #d7dee9;
  border-radius: 14px;
  padding: 16px;
}

.products-import-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.products-file-label {
  cursor: pointer;
}

.products-guide {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f3f6fb;
  border: 1px solid #d7dee9;
  border-radius: 12px;
}

.products-guide h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.products-guide ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.products-guide li {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.4;
  color: #374151;
}

.products-guide[hidden] {
  display: none !important;
}

.products-attrs {
  font-size: 12px;
  line-height: 1.35;
  max-width: 280px;
}

.products-table-compact {
  table-layout: fixed;
  width: 100%;
}

.products-table-compact th,
.products-table-compact td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  padding: 10px 12px;
}

.products-table-compact th:nth-child(6),
.products-table-compact td:nth-child(6) {
  width: 34%;
}

.products-thumb-cell {
  width: 56px;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.products-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #c5d0e0;
  display: block;
  background: #fff;
}

.products-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
}

.products-title-link,
.products-title-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.products-title-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.products-detail-row[hidden] {
  display: none !important;
}

.products-detail-row > td {
  white-space: normal !important;
  overflow: visible !important;
  background: #eef2f7;
}

.products-detail-inner {
  padding: 4px 0 8px;
}

.products-detail-inner h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.products-detail-inner h4 + h4,
.products-attrs-list {
  margin-top: 14px;
}

.products-photo-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.products-photo-strip a {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #c5d0e0;
  background: #fff;
}

.products-photo-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.products-attrs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
  margin: 0;
}

.products-attrs-list div {
  background: #fff;
  border: 1px solid #d7dee9;
  border-radius: 8px;
  padding: 8px 10px;
}

.products-attrs-list dt {
  font-size: 11px;
  color: #6b7280;
  margin: 0 0 2px;
}

.products-attrs-list dd {
  margin: 0;
  font-size: 13px;
  color: #111827;
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 960px) {
  .products-import-grid {
    grid-template-columns: 1fr;
  }
}

.btn-ghost {
  background: transparent;
  color: #1d4ed8;
  box-shadow: none;
  border: 1px solid rgba(36, 93, 255, 0.35);
}

.btn-ghost:hover {
  background: rgba(36, 93, 255, 0.08);
  transform: none;
  box-shadow: none;
}

.btn-ghost::after {
  display: none;
}

.cabinet-table-wrap {
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #d7dee9;
  border-radius: 14px;
  padding: 4px;
}

.cabinet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cabinet-table th,
.cabinet-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #e5eaf3;
  vertical-align: top;
}

.cabinet-table th {
  color: #6b7280;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.cabinet-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.cabinet-badge.ok {
  background: #ecfdf3;
  color: #067647;
}

.cabinet-badge.pending {
  background: #eff8ff;
  color: #175cd3;
}

.cabinet-badge.sync_error {
  background: #fef3f2;
  color: #b42318;
}

.admin-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 22px;
}

.admin-total-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(36, 93, 255, 0.14);
  background: rgba(255, 255, 255, 0.82);
}

.admin-total-label {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-total-card strong {
  font-size: 28px;
  line-height: 1.1;
  color: #111827;
}

.admin-total-card small {
  color: #6b7280;
  font-size: 12px;
}

.admin-clients {
  display: grid;
  gap: 14px;
}

.admin-client-card {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(36, 93, 255, 0.14);
  background: rgba(255, 255, 255, 0.88);
}

.sklad-client-card {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sklad-client-card:hover,
.sklad-client-card:focus-visible {
  border-color: rgba(36, 93, 255, 0.42);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.06);
  outline: none;
}

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

.admin-client-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.admin-client-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 12px;
  font-size: 14px;
  color: #374151;
}

.admin-warn {
  color: #b42318;
}

.admin-last {
  margin: 10px 0 0;
  font-size: 13px;
}

.admin-breakdown-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5eaf3;
}

.admin-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-break-col {
  min-width: 0;
}

.admin-break-col-wide,
.admin-break-col:first-child {
  grid-column: 1 / -1;
}

.admin-breakdown-wrap[hidden] {
  display: none !important;
}

.admin-break-col h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.reception-toggle-cell {
  width: 56px;
  padding-right: 4px !important;
}

.reception-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid #c5d0e0;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  min-height: 32px;
}

.reception-toggle:hover {
  border-color: #245dff;
  color: #1d4ed8;
}

.reception-toggle-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transition: transform 0.15s ease;
}

.reception-toggle.is-open .reception-toggle-arrow {
  transform: rotate(90deg);
}

.reception-date {
  color: #dc2626;
  font-weight: 700;
}

.reception-lines-row[hidden] {
  display: none !important;
}

.reception-lines-row > td {
  padding: 4px 14px 16px;
  background: #eef2f7;
  border-bottom: 1px solid #d5dde8;
}

.cabinet-table-nested {
  margin: 0;
  background: #1f2937;
  border: 2px solid #111827;
  border-radius: 10px;
  overflow: hidden;
  color: #f9fafb;
}

.cabinet-table-nested th,
.cabinet-table-nested td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #374151;
  color: #f3f4f6;
  vertical-align: middle;
}

.cabinet-table-nested th {
  background: #111827;
  color: #e5e7eb;
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

.cabinet-table-nested td:last-child {
  font-weight: 700;
  color: #ffffff;
}

.reception-lines-empty {
  margin: 8px 0 0;
  color: #4b5568;
}

.admin-dl-btn,
.sklad-dl-btn {
  padding: 6px 10px !important;
  font-size: 13px !important;
  min-height: 0 !important;
}

.reception-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #111827;
}

.reception-status-badge.is-new,
.cabinet-badge.reception-status-new {
  background: #dbeafe;
  color: #1e40af;
}

.reception-status-badge.is-accepted,
.cabinet-badge.reception-status-accepted {
  background: #d1fae5;
  color: #065f46;
}

.reception-status-badge.is-accepted_diff,
.cabinet-badge.reception-status-accepted_diff {
  background: #ffe4e6;
  color: #9f1239;
}

.staff-tabs {
  margin: 0 0 1.25rem;
}

.cabinet-tab.is-urgent {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fb923c;
  box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.35);
  animation: urgent-pulse 1.6s ease-in-out infinite;
}

.cabinet-tab.is-urgent.active {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
}

.urgent-count-badge {
  display: inline-block;
  margin-left: 0.35rem;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: middle;
}

.cabinet-tab.is-urgent.active .urgent-count-badge {
  background: #fff;
  color: #c2410c;
}

@keyframes urgent-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.35);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(251, 146, 60, 0.15);
  }
}

.urgent-number,
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: #245dff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.urgent-number:hover,
.btn-link:hover {
  color: #1d4ed8;
}

.reception-actions {
  white-space: nowrap;
}

.staff-urgent .urgent-block {
  margin: 0 0 1.5rem;
}

.staff-urgent .urgent-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.urgent-overdue-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.urgent-row-overdue td {
  background: rgba(254, 226, 226, 0.45);
}

.reception-edit-line {
  margin-bottom: 0.85rem;
}

.reception-line-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
}

.reception-line-product {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.reception-line-photo,
.reception-line-photo-sm {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.reception-line-photo-sm {
  width: 40px;
  height: 40px;
}

.reception-line-photo-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #9ca3af;
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}

.reception-line-product-title {
  font-weight: 700;
  color: #111827;
}

.reception-line-product-sub {
  font-size: 12px;
  margin-top: 2px;
}

.reception-line-warn {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: #b45309;
}

.reception-line-qtys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.reception-line-qtys input.is-diff,
.reception-line-qtys input.is-diff-plan {
  color: #b91c1c;
  font-weight: 700;
  border-color: #fca5a5;
}

.reception-line-pick select {
  width: 100%;
}

.reception-create-lines,
.reception-edit-line {
  margin-bottom: 0.75rem;
}

.receptions-calendar {
  margin: 0 0 1.75rem;
}

.cal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cal-nav [data-cal-title] {
  min-width: 9rem;
  text-align: center;
}

.cal-wrap {
  margin-top: 0.75rem;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 0.25rem 0;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 72px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cal-day.is-empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
  min-height: 72px;
}

.cal-day:not(.is-empty):hover {
  border-color: #245dff;
  box-shadow: 0 0 0 2px rgba(36, 93, 255, 0.12);
}

.cal-day.is-today {
  border-color: #245dff;
}

.cal-day.is-selected {
  background: #eff4ff;
  border-color: #245dff;
  box-shadow: 0 0 0 2px rgba(36, 93, 255, 0.2);
}

.cal-day.has-items {
  background: #fff7ed;
  border-color: #fdba74;
}

.cal-day.has-items.is-selected {
  background: #ffedd5;
  border-color: #ea580c;
}

.cal-day-num {
  font-weight: 700;
  font-size: 14px;
}

.cal-day-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.35rem;
  font-size: 11px;
  line-height: 1.2;
}

.cal-day-count {
  font-weight: 700;
  color: #9a3412;
}

.cal-day-count::after {
  content: " пост.";
  font-weight: 500;
  color: #78716c;
}

.cal-day-qty {
  color: #57534e;
}

.cal-day-empty {
  color: #d1d5db;
}

.cal-day-detail {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.cal-day-detail h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.cal-day-reception {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
}

.cal-day-reception-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.cal-day-reception-meta {
  margin: 0 0 0.5rem;
}

@media (max-width: 720px) {
  .cal-day {
    min-height: 58px;
    padding: 6px;
  }

  .cal-day-meta {
    font-size: 10px;
  }

  .cal-day-count::after {
    content: "";
  }
}

.reception-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem 2rem;
  overflow: auto;
}

.reception-modal[hidden] {
  display: none !important;
}

.reception-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.reception-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  color: #111827;
}

.reception-modal-dialog h2,
.reception-modal-dialog h3 {
  color: #111827;
}

.reception-modal-dialog .cabinet-muted,
.reception-modal-dialog label span {
  color: #4b5568;
}

.reception-modal-dialog input,
.reception-modal-dialog select {
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
}

@media (max-width: 720px) {
  .cabinet-form-grid {
    grid-template-columns: 1fr;
  }

  .cabinet-span-2 {
    grid-column: span 1;
  }

  .admin-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-breakdown {
    grid-template-columns: 1fr;
  }
}
