/* Doctorsig shell on top of Bulma — layout, nav, topbar; theme tokens from existing theme sheets */
@import url("ds-theme-paper.css");
@import url("ds-theme-ink.css");

:root {
  --ds-nav-width: 240px;
  --ds-topbar-height: 64px;
  --ds-accent: oklch(58% 0.18 220);
  --ds-sidebar-border: var(--hs-border, #e8e8e8);
  /* Bulma 1.x primary / link (teal-blue, design parity) */
  --bulma-primary-h: 197deg;
  --bulma-primary-l: 42%;
  --bulma-link-h: 197deg;
  --bulma-link-l: 42%;
}

/* App shell typography (prototype: Lexend body) */
html.ds-theme.ds-theme--paper #ds-app-shell {
  font-family: var(--ds-font-stack, "Lexend Deca", system-ui, sans-serif);
}

/* Semantic page surfaces (Bulma box + prototype shadow) */
html.ds-theme.ds-theme--paper .ds-page-surface,
html.ds-theme.ds-theme--paper .ds-data-table-card.box {
  border-radius: 8px;
  box-shadow: var(--ds-design-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--ds-sidebar-border));
}

/* Tables — doctorsig-new-design.html layout (thead tint, 12/16 padding, row hover) */
html.ds-theme.ds-theme--paper #ds-main-content .box .table-container {
  overflow: hidden;
  background: var(--ds-design-surface, #fff);
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table {
  --bulma-table-cell-border-color: var(--ds-design-border, var(--hs-border));
  --bulma-table-head-cell-border-width: 0 0 1px;
  background-color: transparent;
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table thead {
  background: var(--ds-table-header-bg, var(--ds-design-bg));
  border-bottom: 1px solid var(--ds-design-border, var(--hs-border));
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table thead th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ds-design-muted, var(--color-base-content-muted));
  border-color: transparent;
  border-bottom: 1px solid var(--ds-design-border, var(--hs-border));
  vertical-align: middle;
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  vertical-align: middle;
  border-color: var(--ds-design-border, var(--hs-border));
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table tbody tr:last-child td {
  border-bottom-width: 0;
}

html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table.is-hoverable tbody tr:hover {
  background: var(--ds-design-bg, var(--hs-canvas)) !important;
}

/* Prototype tables are flat (no zebra); keep Bulma striped class from adding tint */
html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table.is-striped tbody tr:nth-child(odd),
html.ds-theme.ds-theme--paper #ds-main-content .box .table-container > table.table.is-striped tbody tr:nth-child(even) {
  background-color: transparent !important;
}

.ds-mono,
.ds-data-table-card .ds-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}

/* Stat KPI numbers (design: accent / warning / success / muted) */
.ds-stat-value--accent {
  color: var(--ds-accent) !important;
}

.ds-stat-value--warning {
  color: oklch(64% 0.15 70) !important;
}

.ds-stat-value--success {
  color: oklch(58% 0.14 145) !important;
}

.ds-stat-value--muted {
  color: var(--color-base-content-muted, #6b7280) !important;
}

/* Status pill with dot (Bulma tag + design) */
.ds-status-pill.tag {
  font-weight: 600;
  font-size: 0.75rem;
  gap: 0.35rem;
}

.ds-status-pill .ds-status-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.ds-status-pill--draft {
  background: oklch(96% 0.03 70) !important;
  color: oklch(42% 0.12 55) !important;
}

.ds-status-pill--draft .ds-status-pill__dot {
  background: oklch(55% 0.14 55);
}

.ds-status-pill--issued {
  background: oklch(96% 0.03 145) !important;
  color: oklch(38% 0.12 145) !important;
}

.ds-status-pill--issued .ds-status-pill__dot {
  background: oklch(52% 0.14 145);
}

.ds-status-pill--void,
.ds-status-pill--cancelled {
  background: oklch(96% 0.04 25) !important;
  color: oklch(40% 0.14 25) !important;
}

.ds-status-pill--void .ds-status-pill__dot,
.ds-status-pill--cancelled .ds-status-pill__dot {
  background: oklch(55% 0.16 25);
}

.ds-status-pill--neutral {
  background: var(--bulma-grey-lighter, #ededed) !important;
  color: var(--bulma-grey-dark, #4a4a4a) !important;
}

.ds-status-pill--neutral .ds-status-pill__dot {
  background: var(--bulma-grey, #7a7a7a);
}

/* Live preview / draft sheet */
.ds-prescription-sheet-wrap {
  background: var(--hs-canvas, #f5f5f5);
  border-radius: 8px;
}

.ds-prescription-sheet {
  position: relative;
}

.ds-prescription-sheet--draft::after {
  content: "DRAFT";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.06);
  transform: rotate(-18deg);
  pointer-events: none;
  z-index: 2;
}

html.ds-theme {
  background-color: var(--hs-canvas, #fafafa);
  color: var(--color-base-content, #1a1a1a);
}

#ds-app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--hs-canvas, #fafafa);
}

/* Mobile drawer */
#ds_mobile_nav {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ds-mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(0, 0, 0, 0.35);
}

@media screen and (max-width: 1023px) {
  #ds_mobile_nav:checked ~ .ds-mobile-nav-overlay {
    display: block;
  }

  .ds-mobile-nav-open {
    display: inline-flex !important;
  }
}

@media screen and (min-width: 1024px) {
  .ds-mobile-nav-open {
    display: none !important;
  }
}

@media screen and (max-width: 1023px) {
  #ds-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1092;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.12);
  }

  #ds_mobile_nav:checked ~ #ds-sidebar {
    transform: translateX(0);
  }
}

#ds-sidebar {
  width: var(--ds-nav-width);
  flex-shrink: 0;
  background: var(--hs-shell, #fff);
  border-right: 1px solid var(--ds-sidebar-border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#ds-sidebar-header {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--ds-sidebar-border);
}

.ds-logo {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--color-base-content, #111);
}

.ds-nav-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-base-content-muted, #6b7280);
  padding: 0 0.75rem;
}

.ds-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ds-nav-item {
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 2px;
  border-radius: 6px;
  color: var(--color-base-content-muted, #6b7280);
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.ds-nav-item:hover {
  background: var(--hs-canvas, #f5f5f5);
  color: var(--color-base-content, #111);
}

.ds-nav-item--active {
  background: oklch(96% 0.01 220);
  color: var(--ds-accent);
  border-left: 3px solid var(--ds-accent);
  padding-left: calc(0.75rem - 3px);
}

.ds-nav-icon {
  flex-shrink: 0;
  color: inherit;
}

.ds-nav-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ds-main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

#ds-topbar {
  height: var(--ds-topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--hs-shell, #fff);
  border-bottom: 1px solid var(--ds-sidebar-border);
}

.ds-topbar-org {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-base-content, #111);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.ds-lang-switch {
  display: flex;
  gap: 4px;
}

.ds-lang-dropdown > summary {
  list-style: none;
  min-width: 2.75rem;
  font-weight: 600;
}

.ds-lang-dropdown > summary::-webkit-details-marker {
  display: none;
}

.ds-lang-dropdown[open] > summary {
  background: var(--hs-canvas, #f5f5f5);
}

.ds-document-types-modal {
  border: none;
  border-radius: 8px;
  max-width: 32rem;
  width: calc(100% - 2rem);
  padding: 0;
}

.ds-document-types-modal::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.ds-team-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff !important;
}

#ds-fill-pdf-frame-wrap {
  opacity: 0.72;
}

.ds-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: none;
  background: var(--ds-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ds-user-menu .dropdown-trigger {
  display: inline-block;
}

.ds-user-menu .dropdown-menu {
  min-width: 12rem;
}

.ds-user-menu > summary {
  list-style: none;
}

.ds-user-menu > summary::-webkit-details-marker {
  display: none;
}

#ds-main-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#ds-main-content {
  flex: 1;
  padding: 1.5rem 1.25rem 2rem;
}

@media screen and (min-width: 640px) {
  #ds-main-content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media screen and (min-width: 1024px) {
  #ds-main-content {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

.ds-max-w-content {
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
}

/* Wireframe subsection tabs (legacy hs-tablist) */
.ds-shell-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--ds-sidebar-border);
  padding-bottom: 0.5rem;
}

.ds-shell-tab {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  text-decoration: none !important;
  color: var(--color-base-content-muted, #6b7280);
}

.ds-shell-tab:hover {
  background: var(--hs-canvas, #f5f5f5);
  color: var(--color-base-content, #111);
}

.ds-shell-tab--active {
  background: #fff;
  color: var(--ds-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.ds-shell-tab--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#ds-app-footer {
  padding: 0.65rem 1.25rem 1rem;
  font-size: 0.75rem;
  color: var(--color-base-content-muted, #6b7280);
  border-top: 1px solid var(--ds-sidebar-border);
  background: var(--hs-shell, #fff);
}

#ds-sidebar-footer {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--ds-sidebar-border);
}

.ds-sidebar-collapse-btn {
  border: none;
  background: transparent;
  color: var(--color-base-content-muted, #6b7280);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
}

.ds-sidebar-collapse-btn:hover {
  background: var(--hs-canvas, #f5f5f5);
  color: var(--color-base-content, #111);
}

/* Collapsed sidebar (optional) */
#ds-app-shell.ds-shell--nav-collapsed #ds-sidebar {
  width: 72px;
}

#ds-app-shell.ds-shell--nav-collapsed .ds-nav-section-title,
#ds-app-shell.ds-shell--nav-collapsed .ds-nav-item-label,
#ds-app-shell.ds-shell--nav-collapsed #ds-sidebar-footer p {
  display: none;
}

#ds-app-shell.ds-shell--nav-collapsed .ds-nav-item {
  justify-content: center;
}

/* Bulma + Bootstrap-ish inner page coexistence */
#ds-main-content .button.ds-is-compact {
  padding-left: 0.65em;
  padding-right: 0.65em;
}

/* Reduce Bulma title margin when stacked with tablist */
#ds-main-content .title.is-spaced {
  margin-bottom: 0.5rem;
}
