/* KTS v1.0.7 UI refinement
   Scope: dashboard + public booking page only.
   Goal: consistent spacing, no clipped panels, restrained premium SaaS finish. */

:root {
  --kts-ui-space-1: 6px;
  --kts-ui-space-2: 10px;
  --kts-ui-space-3: 14px;
  --kts-ui-space-4: 18px;
  --kts-ui-space-5: 24px;
  --kts-ui-radius-sm: 12px;
  --kts-ui-radius-md: 18px;
  --kts-ui-radius-lg: 24px;
  --kts-ui-shadow-soft: 0 12px 34px rgba(42, 31, 16, .065);
  --kts-ui-shadow-panel: 0 20px 52px rgba(42, 31, 16, .09);
}

/* Shared premium interaction details */
body.dashboard-v107 button,
body.dashboard-v107 a,
body.booking-v107 button,
body.booking-v107 a {
  -webkit-tap-highlight-color: transparent;
}

body.dashboard-v107 button:focus-visible,
body.dashboard-v107 a:focus-visible,
body.dashboard-v107 input:focus-visible,
body.dashboard-v107 select:focus-visible,
body.dashboard-v107 textarea:focus-visible,
body.booking-v107 button:focus-visible,
body.booking-v107 a:focus-visible,
body.booking-v107 input:focus-visible,
body.booking-v107 select:focus-visible,
body.booking-v107 textarea:focus-visible {
  outline: 3px solid rgba(191, 143, 60, .24);
  outline-offset: 2px;
}

/* =========================================================
   Dashboard shell and vertical rhythm
   ========================================================= */
body.dashboard-v107 {
  min-height: 100dvh;
}

body.dashboard-v107 .app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 22px auto 56px;
  gap: 20px;
}

body.dashboard-v107 #recordsWorkspace,
body.dashboard-v107 #bookingWorkspace {
  min-width: 0;
}

body.dashboard-v107 #recordsWorkspace {
  display: grid;
  gap: 20px;
}

body.dashboard-v107 #recordsWorkspace[hidden],
body.dashboard-v107 #bookingWorkspace[hidden] {
  display: none !important;
}

body.dashboard-v107 .panel,
body.dashboard-v107 .record-list-panel,
body.dashboard-v107 .workflow-detail-panel,
body.dashboard-v107 .booking-inbox-panel,
body.dashboard-v107 .booking-detail-panel,
body.dashboard-v107 .booking-calendar-panel {
  border-radius: var(--kts-ui-radius-lg);
  box-shadow: var(--kts-ui-shadow-soft);
}

body.dashboard-v107 .dashboard-command-center {
  gap: 22px;
  padding: 22px 24px;
  border-radius: 24px;
  box-shadow: 0 22px 58px rgba(35, 24, 12, .17);
}

body.dashboard-v107 .command-title {
  gap: 16px;
}

body.dashboard-v107 .command-title h1 {
  font-size: clamp(22px, 2vw, 31px);
  line-height: 1.16;
}

body.dashboard-v107 .command-title p {
  max-width: 760px;
  margin-top: 6px;
  line-height: 1.55;
}

body.dashboard-v107 .command-actions {
  min-width: 0;
  gap: 9px;
}

body.dashboard-v107 .command-actions .btn,
body.dashboard-v107 .dashboard-mode-switch .mode-button,
body.dashboard-v107 .support-actions .btn {
  min-height: 40px;
}

body.dashboard-v107 .dashboard-mode-switch {
  margin: 0;
  padding: 16px 18px;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(42, 31, 16, .055);
}

body.dashboard-v107 .dashboard-mode-switch > div:first-child {
  display: grid;
  gap: 2px;
}

body.dashboard-v107 .dashboard-mode-switch .eyebrow {
  margin: 0;
}

body.dashboard-v107 .dashboard-mode-switch strong {
  line-height: 1.35;
}

/* =========================================================
   Customer-record workspace
   ========================================================= */
body.dashboard-v107 .summary-grid.workflow-summary {
  gap: 12px;
}

body.dashboard-v107 .summary-card.task-card {
  min-height: 98px;
  padding: 17px 18px;
  border-radius: 19px;
  box-shadow: 0 10px 28px rgba(40, 31, 18, .055);
}

body.dashboard-v107 .summary-card.task-card strong {
  margin-top: 4px;
  font-size: clamp(27px, 2.4vw, 34px);
  line-height: 1;
}

body.dashboard-v107 .summary-card.task-card em {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
}

body.dashboard-v107 .dashboard-layout.workflow-layout {
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
  gap: 20px;
  min-height: 0;
  align-items: start;
}

/* The old dual sticky/max-height setup visually cut off rounded panel bottoms.
   Keep the list compact with an inner list scroll, and let the detail panel
   use the page flow so every section remains reachable and visibly complete. */
body.dashboard-v107 .record-list-panel,
body.dashboard-v107 .workflow-detail-panel {
  position: static;
  top: auto;
  max-height: none;
  overflow: visible;
}

body.dashboard-v107 .record-list-panel {
  padding: 18px;
}

body.dashboard-v107 .workflow-detail-panel {
  padding: 20px;
}

body.dashboard-v107 .workflow-toolbar,
body.dashboard-v107 .workflow-detail-toolbar {
  min-height: 62px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  gap: 14px;
}

body.dashboard-v107 .workflow-toolbar h2,
body.dashboard-v107 .workflow-detail-toolbar h2 {
  margin-top: 1px;
  font-size: 20px;
  line-height: 1.3;
}

body.dashboard-v107 .workflow-detail-toolbar {
  align-items: center;
}

body.dashboard-v107 .workflow-detail-toolbar .btn {
  flex: 0 0 auto;
  max-width: 270px;
  white-space: normal;
  line-height: 1.35;
  text-align: center;
}

body.dashboard-v107 .workflow-tabbar {
  gap: 7px;
  margin-bottom: 2px;
  padding: 2px 1px 11px;
  scrollbar-width: thin;
}

body.dashboard-v107 .workflow-tab {
  min-height: 36px;
  padding: 8px 12px;
}

body.dashboard-v107 .filter-bar.workflow-searchbar {
  gap: 8px;
  margin-bottom: 12px;
}

body.dashboard-v107 .record-list {
  max-height: min(720px, calc(100dvh - 260px));
  min-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 2px 7px 12px 2px;
}

body.dashboard-v107 .record-card,
body.dashboard-v107 .record-item {
  border-radius: 16px !important;
  padding: 14px 15px !important;
}

body.dashboard-v107 .record-card:last-child,
body.dashboard-v107 .record-item:last-child {
  margin-bottom: 2px;
}

body.dashboard-v107 .workflow-detail-panel .empty-state {
  min-height: 300px;
  padding: 30px;
  border: 1px dashed rgba(82, 65, 39, .18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,253,248,.92), rgba(248,241,229,.75));
}

body.dashboard-v107 .kts-package-shell {
  gap: 18px;
}

body.dashboard-v107 .kts-package-hero {
  padding: 22px;
  border-radius: 22px;
}

body.dashboard-v107 .kts-detail-tabs {
  top: 64px;
  margin: -2px 0 2px;
  padding: 10px 0 12px;
}

body.dashboard-v107 .form-card,
body.dashboard-v107 .record-section,
body.dashboard-v107 .photo-record-panel,
body.dashboard-v107 .missing-card,
body.dashboard-v107 .package-card,
body.dashboard-v107 .consent-card {
  border-radius: 18px !important;
}

/* =========================================================
   Settings / backup area: no max-height clipping
   ========================================================= */
body.dashboard-v107 .support-grid {
  gap: 20px;
  padding-bottom: 18px;
}

body.dashboard-v107 .shop-panel {
  overflow: visible;
  transition: border-color .2s ease, box-shadow .2s ease;
}

body.dashboard-v107 .shop-panel.is-collapsed {
  max-height: none;
}

body.dashboard-v107 .shop-panel.is-collapsed > form,
body.dashboard-v107 .shop-panel.is-collapsed > .link-box {
  display: none !important;
}

body.dashboard-v107 .shop-panel .panel-heading {
  min-height: 74px;
  gap: 18px;
  margin: 0;
  padding: 2px 0;
  cursor: default;
}

body.dashboard-v107 .shop-panel .panel-heading::after {
  content: none !important;
}

body.dashboard-v107 .shop-panel .panel-heading h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.32;
}

body.dashboard-v107 .shop-panel .panel-heading .muted {
  margin-top: 6px;
  line-height: 1.5;
}

body.dashboard-v107 .shop-panel-toggle {
  flex: 0 0 auto;
  min-width: 108px;
  min-height: 40px;
  border: 1px solid rgba(45, 35, 19, .13);
  border-radius: 999px;
  padding: 9px 14px;
  color: #f4d18b;
  background: #19140e;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

body.dashboard-v107 .shop-panel:not(.is-collapsed) .shop-panel-toggle {
  color: #4e402e;
  background: #fff8ec;
}

body.dashboard-v107 .shop-panel > form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(82, 65, 39, .10);
}

body.dashboard-v107 .shop-panel .link-box {
  margin-top: 20px;
}

body.dashboard-v107 .support-panel:not(.shop-panel) {
  min-height: 88px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
}

body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions {
  width: 100%;
  gap: 10px;
  align-items: center;
}

body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions::before {
  content: '보조 관리';
  margin-right: auto;
  color: #6e604d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
}

/* =========================================================
   Booking workspace refinement
   ========================================================= */
body.dashboard-v107 #bookingWorkspace {
  gap: 18px;
}

body.dashboard-v107 #bookingWorkspace .booking-command-bar {
  padding: 20px 22px;
  border-radius: 22px;
}

body.dashboard-v107 #bookingWorkspace .booking-summary-grid {
  gap: 12px;
}

body.dashboard-v107 #bookingWorkspace .booking-summary-card {
  min-height: 90px;
  padding: 15px 17px;
  border-radius: 17px;
}

body.dashboard-v107 #bookingWorkspace .booking-view-tabs {
  margin-top: -2px;
}

body.dashboard-v107 #bookingWorkspace .booking-main-grid {
  grid-template-columns: minmax(340px, .82fr) minmax(520px, 1.18fr);
  gap: 18px;
}

body.dashboard-v107 #bookingWorkspace .booking-inbox-panel,
body.dashboard-v107 #bookingWorkspace .booking-detail-panel,
body.dashboard-v107 #bookingWorkspace .booking-calendar-panel {
  padding: 18px;
  border-radius: 22px;
}

body.dashboard-v107 #bookingWorkspace .booking-detail-panel {
  top: 84px;
  max-height: calc(100dvh - 106px);
  padding-bottom: 24px;
  scrollbar-gutter: stable;
}

body.dashboard-v107 #bookingWorkspace .booking-list {
  max-height: min(690px, calc(100dvh - 300px));
  min-height: 300px;
  padding-bottom: 12px;
  scrollbar-gutter: stable;
}

body.dashboard-v107 #bookingWorkspace .booking-list-item {
  border-radius: 13px;
  padding: 12px 13px;
}

body.dashboard-v107 #bookingWorkspace .booking-detail-tabs {
  position: sticky;
  top: -18px;
  z-index: 4;
  margin: 10px -4px 12px;
  padding: 5px;
  background: rgba(255, 253, 248, .96);
  backdrop-filter: blur(12px);
}

body.dashboard-v107 #bookingWorkspace .booking-drawer {
  height: 100dvh;
  padding: 24px 24px 36px;
}

/* =========================================================
   Public booking page polish
   ========================================================= */
body.booking-v107 .app-shell {
  width: min(1160px, calc(100% - 36px));
  margin: 26px auto 54px;
}

body.booking-v107 .hero-panel {
  padding: 24px 26px;
  border-radius: 24px;
  box-shadow: var(--kts-ui-shadow-panel);
}

body.booking-v107 .booking-public-layout {
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}

body.booking-v107 .booking-public-layout > .panel {
  border-radius: 22px;
  box-shadow: var(--kts-ui-shadow-soft);
}

body.booking-v107 .booking-public-layout > aside.panel {
  position: sticky;
  top: 96px;
  padding: 22px;
}

body.booking-v107 .booking-public-form {
  gap: 20px;
}

body.booking-v107 .booking-form-section {
  padding: 20px;
  border-radius: 18px;
}

body.booking-v107 .booking-form-section h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

body.booking-v107 .booking-form-grid {
  gap: 14px 16px;
}

body.booking-v107 input,
body.booking-v107 select,
body.booking-v107 textarea {
  border-radius: 12px;
  border-color: rgba(45, 35, 19, .16);
  background: #fffefa;
}

body.booking-v107 .booking-public-form > .actions {
  position: sticky;
  bottom: 12px;
  z-index: 6;
  margin-top: 2px;
  padding: 12px;
  border: 1px solid rgba(45, 35, 19, .11);
  border-radius: 16px;
  background: rgba(255, 253, 248, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 42px rgba(42, 31, 16, .12);
}

body.booking-v107 .booking-done-box {
  margin-top: 22px;
  border-radius: 20px;
}

/* =========================================================
   Responsive refinements
   ========================================================= */
@media (max-width: 1180px) {
  body.dashboard-v107 .app-shell {
    width: min(calc(100% - 28px), 1180px);
  }

  body.dashboard-v107 .dashboard-command-center {
    grid-template-columns: 1fr;
  }

  body.dashboard-v107 .command-actions {
    justify-content: flex-start;
  }

  body.dashboard-v107 .dashboard-layout.workflow-layout,
  body.dashboard-v107 #bookingWorkspace .booking-main-grid {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }

  body.dashboard-v107 .summary-grid.workflow-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  body.dashboard-v107 .app-shell,
  body.booking-v107 .app-shell {
    width: calc(100% - 24px);
    margin-top: 14px;
  }

  body.dashboard-v107 .dashboard-layout.workflow-layout,
  body.dashboard-v107 #bookingWorkspace .booking-main-grid,
  body.booking-v107 .booking-public-layout {
    grid-template-columns: 1fr;
  }

  body.dashboard-v107 .record-list {
    max-height: 460px;
  }

  body.dashboard-v107 #bookingWorkspace .booking-detail-panel,
  body.booking-v107 .booking-public-layout > aside.panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  body.dashboard-v107 .workflow-detail-panel {
    scroll-margin-top: 86px;
  }

  body.dashboard-v107 .support-panel:not(.shop-panel) {
    align-items: flex-start;
  }

  body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions::before {
    width: 100%;
    margin-bottom: 4px;
  }

  body.booking-v107 .booking-public-form > .actions {
    position: static;
  }
}

@media (max-width: 680px) {
  body.dashboard-v107 .app-header {
    gap: 10px;
  }

  body.dashboard-v107 .app-shell {
    gap: 14px;
    margin-bottom: 36px;
  }

  body.dashboard-v107 #recordsWorkspace,
  body.dashboard-v107 #bookingWorkspace {
    gap: 14px;
  }

  body.dashboard-v107 .dashboard-command-center,
  body.dashboard-v107 .dashboard-mode-switch,
  body.dashboard-v107 #bookingWorkspace .booking-command-bar {
    padding: 16px;
    border-radius: 18px;
  }

  body.dashboard-v107 .command-title {
    align-items: flex-start;
  }

  body.dashboard-v107 .command-seal {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  body.dashboard-v107 .command-title h1 {
    font-size: 22px;
  }

  body.dashboard-v107 .command-actions,
  body.dashboard-v107 .booking-command-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  body.dashboard-v107 .command-actions .btn,
  body.dashboard-v107 .booking-command-actions .btn,
  body.dashboard-v107 .booking-command-actions details,
  body.dashboard-v107 .booking-command-actions summary {
    width: 100%;
  }

  body.dashboard-v107 .dashboard-mode-switch {
    align-items: stretch;
  }

  body.dashboard-v107 .dashboard-mode-switch .mode-buttons {
    width: 100%;
  }

  body.dashboard-v107 .dashboard-mode-switch .mode-button {
    flex: 1;
  }

  body.dashboard-v107 .summary-grid.workflow-summary,
  body.dashboard-v107 #bookingWorkspace .booking-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.dashboard-v107 .summary-card.task-card,
  body.dashboard-v107 #bookingWorkspace .booking-summary-card {
    min-height: 88px;
    padding: 14px;
  }

  body.dashboard-v107 .record-list-panel,
  body.dashboard-v107 .workflow-detail-panel,
  body.dashboard-v107 #bookingWorkspace .booking-inbox-panel,
  body.dashboard-v107 #bookingWorkspace .booking-detail-panel,
  body.dashboard-v107 #bookingWorkspace .booking-calendar-panel {
    padding: 14px;
    border-radius: 18px;
  }

  body.dashboard-v107 .workflow-detail-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  body.dashboard-v107 .workflow-detail-toolbar .btn {
    max-width: none;
    width: 100%;
  }

  body.dashboard-v107 .shop-panel .panel-heading {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  body.dashboard-v107 .shop-panel-toggle {
    width: 100%;
  }

  body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions::before {
    grid-column: 1 / -1;
  }

  body.booking-v107 .hero-panel,
  body.booking-v107 .booking-public-layout > .panel,
  body.booking-v107 .booking-form-section {
    padding: 16px;
    border-radius: 17px;
  }
}

@media (max-width: 420px) {
  body.dashboard-v107 .command-actions,
  body.dashboard-v107 .booking-command-actions,
  body.dashboard-v107 .support-panel:not(.shop-panel) .support-actions {
    grid-template-columns: 1fr;
  }

  body.dashboard-v107 .summary-grid.workflow-summary,
  body.dashboard-v107 #bookingWorkspace .booking-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body.dashboard-v107 .dashboard-mode-switch,
  body.dashboard-v107 .dashboard-command-center,
  body.dashboard-v107 .support-grid,
  body.dashboard-v107 .booking-command-bar,
  body.dashboard-v107 .booking-summary-grid,
  body.dashboard-v107 .booking-view-tabs {
    display: none !important;
  }
}
