/* Client workspace shell — mobile-first control panel */

:root {
  --ws-bottom-nav-h: 64px;
  --ws-touch: 44px;
  --ws-safe-bottom: env(safe-area-inset-bottom, 0px);
  --ws-safe-top: env(safe-area-inset-top, 0px);
}

/* [hidden] must win over display:grid/flex on the same node */
[hidden],
.ws-frame[hidden],
.ws-panel[hidden],
#appRoot[hidden],
#loginRoot:empty {
  display: none !important;
}

.ws-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--surface);
  -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 12%, transparent);
}

.ws-body.is-login {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.ws-body.is-authed {
  padding-bottom: calc(var(--ws-bottom-nav-h) + var(--ws-safe-bottom));
}

body.ws-menu-lock {
  overflow: hidden;
}

@media (min-width: 900px) {
  .ws-body.is-authed {
    padding-bottom: 0;
  }

  body.ws-menu-lock {
    overflow: auto;
  }
}

.ws-login {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: max(24px, var(--ws-safe-top)) 16px 32px;
}

.ws-login-card {
  max-width: 420px;
  margin: 12vh auto 0;
  padding: 28px;
}

.ws-login-brand {
  width: fit-content;
  margin: 0 auto 18px;
}

.ws-login-title {
  font-size: clamp(28px, 5vw, 36px);
  margin: 8px 0 10px;
  letter-spacing: -0.03em;
}

.ws-login-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.ws-login-form .actions {
  margin-top: 4px;
}

.ws-login-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line));
  color: color-mix(in srgb, var(--danger) 88%, #000);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.ws-login-error[hidden] {
  display: none !important;
}

.ws-login h1 {
  font-size: clamp(32px, 9vw, 42px) !important;
}

.ws-login .btn,
.ws-login input {
  min-height: var(--ws-touch);
}

.ws-frame {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .ws-frame {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

/* Sidebar: off-canvas drawer on phone, sticky column on desktop */
.ws-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--void);
  color: var(--surface);
  padding: max(20px, var(--ws-safe-top)) 16px calc(24px + var(--ws-safe-bottom));
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  z-index: 60;
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  border-right: 1px solid color-mix(in srgb, #fff 8%, transparent);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ws-frame.is-menu-open .ws-sidebar {
  transform: translateX(0);
}

.ws-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--void) 55%, transparent);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.ws-frame.is-menu-open .ws-menu-backdrop {
  display: block;
}

@media (min-width: 900px) {
  .ws-sidebar {
    position: sticky;
    width: auto;
    transform: none;
    transition: none;
    box-shadow: none;
    height: 100vh;
    height: 100dvh;
    padding: 20px 16px 24px;
    overflow-y: auto;
  }

  .ws-menu-backdrop,
  .ws-frame.is-menu-open .ws-menu-backdrop {
    display: none !important;
  }
}

.ws-side-brand {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: -0.03em;
  text-transform: none;
  line-height: 1.05;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.ws-side-brand span {
  color: var(--accent);
}

.ws-sidebar .brand-lockup--side img {
  /* wordmark already has dark plate — keep flush on ink sidebar */
  background: transparent;
}

.ws-side-meta {
  font-size: 12px;
  color: color-mix(in srgb, #fff 55%, transparent);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.ws-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.ws-nav-label {
  margin: 14px 12px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, #fff 42%, transparent);
}

.ws-nav a,
.ws-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: color-mix(in srgb, #fff 72%, transparent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
}

.ws-nav a:hover,
.ws-nav button:hover {
  color: #fff;
  border-color: color-mix(in srgb, var(--surface) 25%, transparent);
  text-decoration: none;
}

.ws-nav a.active,
.ws-nav button.active {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 72%, var(--void));
  border-color: transparent;
  box-shadow: none;
}

.ws-side-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--surface) 18%, transparent);
}

.ws-side-foot .btn {
  width: 100%;
}

.ws-side-foot .btn-secondary,
.ws-side-foot a.btn-secondary,
.ws-side-foot a.btn-secondary:visited {
  background: transparent;
  border-color: color-mix(in srgb, #fff 35%, transparent);
  color: #fff;
}

.ws-side-foot .btn-secondary:hover,
.ws-side-foot a.btn-secondary:hover,
.ws-side-foot .btn-secondary:focus-visible,
.ws-side-foot a.btn-secondary:focus-visible {
  background: color-mix(in srgb, #fff 12%, transparent);
  border-color: color-mix(in srgb, #fff 55%, transparent);
  color: #fff;
}

.ws-side-foot .btn-primary,
.ws-side-foot a.btn-primary,
.ws-side-foot a.btn-primary:hover,
.ws-side-foot a.btn-primary:visited {
  color: #fff;
}

.ws-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.ws-topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(10px, var(--ws-safe-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, #fff 92%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.ws-topbar-lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ws-topbar-titles {
  min-width: 0;
  flex: 1;
}

.ws-menu-btn {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--ws-touch);
  height: var(--ws-touch);
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.ws-menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--void);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.ws-frame.is-menu-open .ws-menu-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.ws-frame.is-menu-open .ws-menu-btn span:nth-child(2) {
  opacity: 0;
}

.ws-frame.is-menu-open .ws-menu-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.ws-topbar h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-topbar-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ws-topbar-sub .ws-topbar-meta {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ws-top-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.ws-top-actions .btn {
  min-height: 40px;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 13px;
}

.ws-top-actions #userChip {
  display: none;
}

@media (max-width: 899px) {
  .ws-top-actions #refreshBtn {
    width: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 0;
    line-height: 0;
  }

  .ws-top-actions #refreshBtn::before {
    content: "↻";
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    color: var(--ink);
  }
}

@media (min-width: 900px) {
  .ws-topbar {
    padding: 16px 20px;
    position: static;
    backdrop-filter: none;
    flex-wrap: wrap;
    gap: 10px;
  }

  .ws-menu-btn {
    display: none;
  }

  .ws-topbar h1 {
    font-size: clamp(22px, 5vw, 28px);
    white-space: normal;
  }

  .ws-topbar-sub {
    font-size: 13px;
    margin-top: 4px;
  }

  .ws-topbar-sub .ws-topbar-meta {
    display: inline;
  }

  .ws-top-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ws-top-actions .btn {
    min-height: var(--ws-touch);
    padding-left: 14px;
    padding-right: 14px;
    font-size: 14px;
  }

  .ws-top-actions #userChip {
    display: inline-flex;
    max-width: none;
  }
}

.ws-content {
  padding: 16px 14px 28px;
  display: grid;
  gap: 18px;
  max-width: 1180px;
  width: 100%;
}

.ws-module-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ws-module-banner .eyebrow {
  margin-bottom: 4px;
}

.ws-module-banner strong {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 700;
}

.ws-module-banner p {
  margin: 6px 0 0;
  font-size: 14px;
  max-width: 42ch;
}

.ws-module-banner .badge {
  flex-shrink: 0;
  margin-top: 2px;
}

@media (min-width: 900px) {
  .ws-content {
    padding: 28px 28px 40px;
    gap: 22px;
  }
}

/* Bottom tab bar — primary mobile chrome */
.ws-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0;
  min-height: var(--ws-bottom-nav-h);
  padding: 6px 4px max(6px, var(--ws-safe-bottom));
  background: color-mix(in srgb, var(--void) 96%, #000);
  border-top: 1px solid color-mix(in srgb, #fff 12%, transparent);
  box-shadow: 0 -8px 24px rgba(18, 24, 20, 0.12);
}

.ws-bottom-nav a,
.ws-bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  padding: 6px 4px;
  margin: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: color-mix(in srgb, #fff 62%, transparent);
  font-family: var(--body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ws-bottom-nav a:hover,
.ws-bottom-nav button:hover,
.ws-bottom-nav a:focus-visible,
.ws-bottom-nav button:focus-visible {
  color: #fff;
  text-decoration: none;
  outline: none;
}

.ws-bottom-nav a.active,
.ws-bottom-nav button.active {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 70%, var(--void));
  box-shadow: none;
}

@media (min-width: 900px) {
  .ws-bottom-nav {
    display: none;
  }
}

.ws-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 700px) {
  .ws-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.ws-kpi {
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  animation: snellRise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ws-kpi:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.ws-kpi .num {
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
}

.ws-kpi .label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.ws-block {
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px;
  animation: snellRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 900px) {
  .ws-block {
    padding: 24px 26px;
  }
}

.ws-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.ws-block-head h2 {
  font-size: 20px;
  margin: 0;
  letter-spacing: -0.025em;
}

.ws-block-head .hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.ws-split {
  display: grid;
  gap: 22px;
}

@media (min-width: 900px) {
  .ws-split-2 {
    grid-template-columns: 1.4fr 0.8fr;
  }
  .ws-split-work {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.ws-module-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 700px) {
  .ws-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ws-module-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 55%, #fff);
  box-shadow: var(--shadow);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.ws-module-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.ws-module-tile.is-locked {
  opacity: 0.78;
}

.ws-module-tile h3 {
  font-size: 22px;
  margin: 0;
}

.ws-module-tile .meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.ws-module-tile .tile-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.ws-rail {
  display: grid;
  gap: 14px;
  align-content: start;
}

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

.ws-inline-form .actions {
  margin-top: 4px;
}

.ws-table-wrap {
  overflow-x: auto;
}

.ws-empty {
  padding: 40px 16px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  font-size: 14px;
}

.ws-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ws-inbox {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: min(72dvh, 560px);
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Mobile: list OR thread, never both */
.ws-inbox .ws-thread {
  display: none;
}

.ws-inbox.is-thread-open .ws-inbox-list {
  display: none;
}

.ws-inbox.is-thread-open .ws-thread {
  display: grid;
}

@media (min-width: 800px) {
  .ws-inbox {
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 480px;
  }

  .ws-inbox .ws-thread,
  .ws-inbox.is-thread-open .ws-inbox-list,
  .ws-inbox:not(.is-thread-open) .ws-thread {
    display: grid;
  }

  .ws-inbox .ws-inbox-list {
    display: block;
  }
}

.ws-inbox-list {
  max-height: min(72dvh, 560px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-2);
}

@media (min-width: 800px) {
  .ws-inbox-list {
    border-right: 1px solid var(--line);
    max-height: none;
  }
}

.ws-thread-back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: var(--body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  color: var(--ink);
}

@media (min-width: 800px) {
  .ws-thread-back {
    display: none;
  }
}

.ws-inbox-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: var(--ws-touch);
  text-align: left;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s ease;
}

.ws-inbox-item:hover {
  background: var(--accent-soft);
}

.ws-inbox-item.is-active {
  background: color-mix(in srgb, var(--accent-soft) 85%, #fff);
  box-shadow: inset 3px 0 0 var(--accent);
}

.ws-inbox-item .title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.ws-inbox-item .meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.ws-thread {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  min-height: min(72dvh, 560px);
  background: var(--surface);
}

@media (min-width: 800px) {
  .ws-thread {
    min-height: 480px;
  }
}

.ws-thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.ws-thread-head-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ws-thread-head h3 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.ws-thread-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: none;
  min-height: 160px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 800px) {
  .ws-thread-messages {
    max-height: 380px;
    padding: 20px;
  }
}

.ws-msg {
  max-width: 78%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: snellRise 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ws-msg.in {
  align-self: flex-start;
  background: #fff;
  border-color: var(--line);
  border-bottom-left-radius: 4px;
}

.ws-msg.out {
  align-self: flex-end;
  background: var(--accent-soft);
  color: var(--ink);
  border-bottom-right-radius: 4px;
}

.ws-msg .when {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.ws-thread-compose {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.ws-thread-compose textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  font-size: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 14px;
}

.ws-thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ws-thread-actions .btn,
.ws-inline-form .btn,
.ws-side-foot .btn {
  min-height: var(--ws-touch);
}

.ws-config-form {
  display: grid;
  gap: 18px;
}

.ws-config-status {
  display: block;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.ws-progress {
  display: grid;
  gap: 8px;
}

.ws-progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ws-progress-track {
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, #fff);
  overflow: hidden;
}

.ws-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--warn) 85%, #c47a12),
    var(--accent)
  );
  transition: width 0.35s ease, background 0.35s ease;
}

.ws-progress-fill.is-ready {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 70%, #2d8a5a),
    color-mix(in srgb, var(--accent) 90%, #1f6b45)
  );
}

.ws-progress-fill.is-complete {
  background: var(--accent);
}

.ws-progress-missing {
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

.ws-config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.ws-config-tabs button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  min-height: 40px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.18s ease, color 0.18s ease;
}

.ws-config-tabs button:hover {
  color: var(--ink);
  background: color-mix(in srgb, #fff 70%, transparent);
}

.ws-config-tabs button.is-active {
  background: #fff;
  color: var(--accent-2);
  box-shadow: var(--shadow);
}

.ws-config-panel {
  display: none;
  gap: 14px;
}

.ws-config-panel.is-active {
  display: grid;
}

.ws-panel-lead {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.ws-config-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.ws-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin: 0;
  cursor: pointer;
  min-height: 40px;
  padding: 6px 0;
}

.ws-check input,
.ws-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
  accent-color: var(--accent);
  border-radius: 4px;
  box-shadow: none;
}

.ws-check-grid {
  display: grid;
  gap: 2px;
}

.ws-check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-qualify-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-qualify-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
}

.ws-qualify-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
  accent-color: var(--accent);
}

.ws-qualify-row input[type="text"],
.ws-config-form .ws-qualify-row input[type="text"] {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  font-weight: 500;
}

@media (min-width: 600px) {
  .ws-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
  }
}

/* Payment methods + hot signals inside config form: override stacked label styles */
.ws-config-form .ws-check,
.ws-config-form label.ws-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.ws-config-form .ws-check input,
.ws-config-form .ws-check input[type="checkbox"],
.ws-config-form label.ws-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  max-width: 18px;
  padding: 0;
  flex: 0 0 18px;
  box-shadow: none;
  background: #fff;
}

.ws-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 0;
  background: var(--surface);
}

.ws-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.ws-fieldset-danger {
  border-color: #c62828;
  background: #fff5f5;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #c62828 18%, transparent);
}

.ws-fieldset-danger legend {
  color: #b71c1c;
}

.ws-danger-help {
  font-size: 13px;
  margin: 0 0 10px;
  color: #8e1b1b;
  line-height: 1.45;
}

.ws-config-form .ws-fieldset-danger textarea {
  border-color: color-mix(in srgb, #c62828 35%, var(--line));
  background: #fff;
}

.ws-config-form .ws-fieldset-danger textarea:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 3px color-mix(in srgb, #c62828 18%, transparent);
}

.ws-config-form .ws-forbidden-row input[type="text"] {
  border-color: color-mix(in srgb, #c62828 28%, var(--line));
}

.ws-config-form .ws-forbidden-row input[type="text"]:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 3px color-mix(in srgb, #c62828 18%, transparent);
}

.ws-config-form .ws-forbidden-row input[type="checkbox"] {
  accent-color: #c62828;
}

.ws-config-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 600px) {
  .ws-config-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

.ws-address-block {
  display: grid;
  gap: 12px;
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.ws-extra-loc-row {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.ws-cep-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.ws-cep-field {
  flex: 1 1 140px;
  min-width: 120px;
  max-width: 200px;
}

.ws-cep-row .btn {
  flex: 0 0 auto;
  height: 42px;
}

.ws-product-hours {
  margin-top: 4px;
}

.ws-product-hours .ws-hours-list {
  margin-top: 4px;
}

.ws-hours-actions .btn {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.ws-hours-list {
  display: grid;
  gap: 8px;
}

.ws-hours-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.1fr) 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.ws-hours-row.is-off {
  opacity: 0.55;
}

.ws-hours-row.is-off select {
  pointer-events: none;
}

.ws-hours-row .ws-check {
  min-height: 0;
  padding: 0;
  font-size: 13px;
}

.ws-hours-row select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 14px;
}

.ws-hours-row.is-24h select {
  opacity: 0.6;
}

@media (max-width: 599px) {
  .ws-hours-row {
    grid-template-columns: 1fr 1fr;
  }

  .ws-hours-row .ws-check {
    grid-column: 1 / -1;
  }
}

.ws-products {
  display: grid;
  gap: 14px;
}

.ws-product-row {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
  border-radius: var(--radius);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ws-product-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.ws-product-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ws-product-row-head strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.ws-product-fields {
  display: grid;
  gap: 10px;
}

@media (min-width: 700px) {
  .ws-product-fields {
    grid-template-columns: 1.4fr 1fr 0.7fr;
  }
}

.ws-config-form label,
.ws-product-row label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* Qualification rows: checkbox + text on one line (override stacked label grid) */
.ws-config-form label.ws-qualify-row,
.ws-config-form .ws-qualify-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.ws-config-form .ws-qualify-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  min-width: 18px;
  max-width: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
  box-shadow: none;
  background: #fff;
  accent-color: var(--accent);
}

.ws-config-form .ws-qualify-row input[type="text"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  min-height: 42px;
}

.ws-config-form input,
.ws-config-form select,
.ws-config-form textarea,
.ws-product-row input,
.ws-product-row select,
.ws-product-row textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-height: var(--ws-touch);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-config-form input:focus,
.ws-config-form select:focus,
.ws-config-form textarea:focus,
.ws-product-row input:focus,
.ws-product-row select:focus,
.ws-product-row textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.ws-config-form textarea,
.ws-product-row textarea {
  min-height: auto;
  resize: vertical;
}

.ws-inline-form input,
.ws-inline-form select,
.ws-inline-form textarea {
  font-size: 16px;
  min-height: var(--ws-touch);
}

/* Lead table → stacked cards on narrow screens */
.ws-table-wrap table {
  width: 100%;
  border-collapse: collapse;
}

@media (max-width: 699px) {
  .ws-table-wrap thead {
    display: none;
  }

  .ws-table-wrap tbody,
  .ws-table-wrap tr,
  .ws-table-wrap td {
    display: block;
    width: 100%;
  }

  .ws-table-wrap tr {
    border: 1px solid var(--line);
    margin-bottom: 10px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--surface) 45%, #fff);
  }

  .ws-table-wrap td {
    padding: 4px 0;
    border: 0;
  }

  .ws-table-wrap td::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
  }

  .ws-table-wrap td:last-child {
    margin-top: 8px;
  }

  .ws-table-wrap td:last-child::before {
    content: none;
  }
}

/* Module work layout: tools rail after primary content on phone */
.ws-split-work {
  display: grid;
  gap: 14px;
}

@media (min-width: 900px) {
  .ws-split-work {
    gap: 18px;
  }
}
