.bth-portal, .bth-portal *, .bth-portal *::before, .bth-portal *::after {
  box-sizing: border-box;
}

.bth-portal {
  width: min(100%, 1600px);
  margin: 16px auto;
  padding: 0 12px 24px;
  color: var(--bth-text);
}

.bth-portal-header {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
  padding: 22px 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(27, 38, 76, 0.98), rgba(91, 91, 214, 0.95), rgba(21, 184, 166, 0.9));
  color: #fff;
  box-shadow: 0 24px 50px rgba(26, 38, 86, 0.2);
}

.bth-portal-header h1,
.bth-portal-header p {
  color: #fff;
  margin: 0;
}

.bth-portal-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.bth-portal-header p {
  margin-top: 6px;
  max-width: 760px;
  opacity: 0.92;
}

.bth-portal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bth-portal .bth-card {
  backdrop-filter: blur(12px);
}

.bth-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.bth-card-link:hover,
.bth-card-link:focus-visible {
  transform: translateY(-2px);
  text-decoration: none;
  border-color: rgba(91, 91, 214, 0.45);
  box-shadow: 0 18px 34px rgba(36, 52, 108, 0.12);
  outline: none;
}

.bth-portal .button,
.bth-portal .button.button-primary,
.bth-portal .button.button-secondary {
  border-radius: 999px;
}

.bth-portal .button.button-primary {
  background: linear-gradient(135deg, var(--bth-accent), #ff8d6a);
  border-color: transparent;
}

.bth-portal .button.button-secondary {
  border-color: var(--bth-border-strong);
  color: var(--bth-text);
}

.bth-template-bar .description,
.bth-portal .description {
  color: var(--bth-muted);
}

.bth-message-list,
.bth-note-list {
  margin-top: 18px;
}

.bth-inline-actions {
  margin-top: 12px;
}

.bth-portal .bth-grid-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bth-portal .bth-grid-stats .bth-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.bth-portal .bth-grid-stats .bth-card h2 {
  font-size: 13px;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bth-muted);
}

.bth-portal .bth-grid-stats .bth-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -38% auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(91, 91, 214, 0.18), transparent 65%);
  pointer-events: none;
}

.bth-big-number {
  font-size: clamp(1.8rem, 4.8vw, 2.8rem);
}

.bth-tab-nav {
  width: 100%;
  max-width: none;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 0 0 18px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(183, 198, 255, 0.85);
  box-shadow: 0 10px 24px rgba(44, 63, 128, 0.08);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.bth-tab-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  min-width: max-content;
  background: transparent;
  color: var(--bth-muted);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.bth-tab-button:hover,
.bth-tab-button:focus-visible {
  background: rgba(91, 91, 214, 0.1);
  color: var(--bth-text);
  outline: none;
}

.bth-tab-button.is-active {
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.14), rgba(21, 184, 166, 0.14));
  color: var(--bth-text);
  box-shadow: inset 0 0 0 1px rgba(91, 91, 214, 0.14), 0 6px 14px rgba(52, 73, 148, 0.12);
}

.bth-tab-panel {
  display: none;
  animation: bthFadeIn 0.18s ease;
}

.bth-tab-panel.is-active {
  display: block;
}

@keyframes bthFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bth-task-detail-head {
  align-items: center;
}

.bth-portal .bth-card .bth-stack-form input,
.bth-portal .bth-card .bth-stack-form select,
.bth-portal .bth-card .bth-stack-form textarea {
  font-size: 15px;
}

.bth-portal .bth-card .bth-stack-form input[type="datetime-local"] {
  max-width: 100%;
}

.bth-session-toggle {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 15px 24px !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  box-shadow: 0 14px 28px rgba(25, 38, 88, 0.16);
}

.bth-session-toggle--start {
  background: linear-gradient(135deg, var(--bth-secondary), #66d9ca) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.bth-session-toggle--end,
.bth-trash-button {
  background: linear-gradient(135deg, var(--bth-accent), #ff9b6f) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.bth-inline-form-danger {
  margin-top: 10px;
}

.bth-portal .bth-grid-main {
  margin-top: 0;
}

.bth-portal .bth-card-head {
  gap: 12px;
}

.bth-task-detail-card .bth-subsection h3,
.bth-card-command-center h2,
.bth-trash-folder-card h2 {
  margin-top: 0;
}

#bth-command-center,
#bth-task-detail,
#bth-trash-folder,
#bth-admin-command-center,
#bth-admin-task-detail,
#bth-admin-trash-folder {
  scroll-margin-top: 110px;
}

.bth-trash-folder-card {
  border-style: dashed;
}

.bth-responsive-table {
  overflow-x: auto;
}

@media (max-width: 767px) {
  .bth-portal {
    margin: 12px auto;
    padding: 0 10px 20px;
  }

  .bth-portal-header {
  width: 100%;
  max-width: none;
    border-radius: 20px;
    padding: 18px 16px;
  }

  .bth-wrap .bth-card {
    padding: 16px;
    border-radius: 18px;
  }

  .bth-portal .bth-grid-stats,
  .bth-wrap .bth-grid,
  .bth-wrap .bth-grid-main,
  .bth-wrap .bth-grid-tasks,
  .bth-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .bth-portal .bth-grid-stats .bth-card {
    padding: 16px;
  }

  .bth-tab-nav {
  width: 100%;
  max-width: none;
    position: sticky;
    top: 10px;
    z-index: 20;
  }

  body.admin-bar .bth-tab-nav {
  width: 100%;
  max-width: none;
    top: 56px;
  }

  .bth-card-head,
  .bth-task-detail-head,
  .bth-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bth-inline-actions .button,
  .bth-card-head .button,
  .bth-card-head .description,
  .bth-inline-actions form,
  .bth-inline-actions .button.button-small {
    width: 100%;
    text-align: center;
  }

  .bth-stack-form-mobile {
    display: block;
  }

  .bth-stack-form-mobile select,
  .bth-stack-form-mobile .button {
    width: 100%;
    margin: 0 0 10px;
  }

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

  .bth-table thead {
    display: none;
  }

  .bth-table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--bth-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 22px rgba(58, 80, 140, 0.06);
  }

  .bth-table tr:last-child {
    margin-bottom: 0;
  }

  .bth-table td {
    border: 0;
    padding: 7px 0;
    display: grid;
    grid-template-columns: minmax(88px, 100px) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .bth-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bth-muted);
    line-height: 1.3;
  }

  .bth-table td > * {
    min-width: 0;
  }

  .bth-table td .button {
    width: auto;
    min-width: 0;
  }

  .bth-table tr.is-active-row {
    background: linear-gradient(180deg, rgba(91, 91, 214, 0.07), rgba(255, 255, 255, 0.98));
  }

  .bth-calendar-grid {
    grid-template-columns: 1fr;
  }

  .bth-calendar-day {
    min-height: 0;
  }

  .bth-calendar-nav .button {
    flex: 1 1 auto;
    text-align: center;
  }

  .bth-message {
    padding: 14px;
  }
}

@media (min-width: 768px) {
  .bth-portal {
    margin: 24px auto;
    padding: 0 16px 28px;
  }

  .bth-session-toggle {
    width: auto;
    min-width: 220px;
  }

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

  .bth-portal .bth-grid-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (min-width: 960px) {
  .bth-portal-header {
  width: 100%;
  max-width: none;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 28px;
  }

  .bth-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}


.bth-tab-panels,
.bth-tab-panel {
  width: 100%;
  max-width: none;
}

.bth-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(91, 91, 214, 0.12);
  color: var(--bth-text);
  font-size: 12px;
  line-height: 1;
}

.bth-table tr.priority-urgent-row {
  background: linear-gradient(180deg, rgba(255, 243, 136, 0.58), rgba(255, 255, 255, 0.98));
}

.bth-table tr.priority-high-row {
  background: linear-gradient(180deg, rgba(206, 255, 105, 0.52), rgba(255, 255, 255, 0.98));
}

.bth-table tr.is-complete-row {
  opacity: 0.96;
}

.bth-table tr.priority-urgent-row td,
.bth-table tr.priority-high-row td {
  background: transparent;
}

.bth-calendar-task.priority-urgent {
  background: linear-gradient(135deg, rgba(255, 243, 136, 0.9), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(210, 179, 0, 0.35);
}

.bth-calendar-task.priority-high {
  background: linear-gradient(135deg, rgba(206, 255, 105, 0.88), rgba(255, 255, 255, 0.94));
  border: 1px solid rgba(130, 196, 0, 0.3);
}

@media (max-width: 767px) {
  .bth-table tr.priority-urgent-row {
    background: linear-gradient(180deg, rgba(255, 243, 136, 0.9), rgba(255, 255, 255, 0.98));
  }

  .bth-table tr.priority-high-row {
    background: linear-gradient(180deg, rgba(206, 255, 105, 0.82), rgba(255, 255, 255, 0.98));
  }
}

/* 0.7.0 desktop-first portal polish */
.bth-portal {
  width: 100%;
  max-width: none;
  margin: 24px auto;
  padding: 0 18px 32px;
}

.entry-content > .bth-portal,
.site-main .bth-portal,
.wp-site-blocks .bth-portal,
.post-content .bth-portal {
  width: 100%;
  max-width: none;
}

.bth-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bth-grid-stats--desktop {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.bth-grid-overview-desktop {
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: start;
}

.bth-grid-main--portal.has-detail {
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  align-items: start;
}

.bth-grid-main--projects {
  grid-template-columns: minmax(0, 1fr);
}

.bth-inline-form-filter {
  margin-bottom: 0;
}

.bth-inline-form-filter select {
  min-width: 180px;
}

.bth-portal .bth-card-command-center,
.bth-portal .bth-completed-card,
.bth-portal .bth-task-detail-card,
.bth-portal .bth-trash-folder-card,
.bth-portal .bth-grid-overview-desktop .bth-card,
.bth-portal .bth-project-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,248,255,0.98));
}

.bth-portal .bth-card-command-center {
  border-top: 4px solid rgba(91, 91, 214, 0.22);
}

.bth-open-claim-section {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(200,255,114,0.16), rgba(255,255,255,0.96));
  border: 1px solid rgba(164, 220, 57, 0.28);
}

.bth-claim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.bth-claim-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--bth-border);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 22px rgba(58,80,140,0.08);
}

.bth-claim-card.priority-high {
  background: linear-gradient(180deg, rgba(206,255,105,0.28), rgba(255,255,255,0.96));
  border-color: rgba(134,198,13,0.35);
}

.bth-claim-card.priority-urgent {
  background: linear-gradient(180deg, rgba(255,243,136,0.4), rgba(255,255,255,0.96));
  border-color: rgba(209,182,0,0.35);
}

.bth-claim-card__top,
.bth-project-card__header,
.bth-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bth-project-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.bth-project-card {
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--bth-border);
  box-shadow: 0 14px 28px rgba(44,63,128,0.08);
}

.bth-project-card.is-selected {
  border-color: rgba(91,91,214,0.35);
  box-shadow: 0 0 0 3px rgba(91,91,214,0.1), 0 18px 34px rgba(44,63,128,0.1);
}

.bth-project-card h3,
.bth-task-summary h3 {
  margin: 0;
}

.bth-project-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.bth-list-tight li {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.bth-task-summary {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(91,91,214,0.06), rgba(21,184,166,0.06));
  border: 1px solid rgba(183,198,255,0.6);
}

.bth-checkbox-stack {
  display: flex;
  align-items: center;
}

.bth-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.bth-tab-nav {
  position: sticky;
  top: 16px;
  z-index: 25;
}

body.admin-bar .bth-tab-nav {
  top: 48px;
}

@media (min-width: 1280px) {
  .bth-portal {
    padding: 0 24px 36px;
  }

  .bth-grid-main--projects {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1199px) {
  .bth-grid-stats--desktop {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bth-grid-overview-desktop,
  .bth-grid-main--portal.has-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .bth-grid-stats--desktop {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bth-project-grid,
  .bth-claim-grid {
    grid-template-columns: 1fr;
  }

  .bth-tab-nav {
    top: 10px;
  }

  body.admin-bar .bth-tab-nav {
    top: 56px;
  }
}

.bth-portal .bth-session-summary {
  margin-top: 12px;
}

.bth-portal .bth-session-summary__stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}


.bth-sessions-card {
  overflow: hidden;
}

.bth-sessions-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.08), rgba(21, 184, 166, 0.08));
  border: 1px solid rgba(183, 198, 255, 0.75);
}

.bth-sessions-hero__main h3 {
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 3.1vw, 2.6rem);
}

.bth-session-clock--hero {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bth-sessions-hero__aside,
.bth-session-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.bth-grid-session-panels,
.bth-grid-session-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.bth-card-subtle {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 255, 0.95));
}

.bth-session-list {
  display: grid;
  gap: 12px;
}

.bth-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(183, 198, 255, 0.75);
  background: rgba(255, 255, 255, 0.78);
}

.bth-session-row.is-selected {
  border-color: rgba(91, 91, 214, 0.55);
  box-shadow: 0 10px 24px rgba(52, 73, 148, 0.08);
}

.bth-session-events li {
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(183, 198, 255, 0.6);
}

.bth-session-events li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

#bth-sessions,
#bth-session-detail,
#bth-panel-sessions {
  scroll-margin-top: 110px;
}

@media (max-width: 1024px) {
  .bth-sessions-hero,
  .bth-grid-session-panels,
  .bth-grid-session-detail {
    grid-template-columns: 1fr;
  }
}

.bth-portal-link {
  white-space: nowrap;
}

.bth-sessions-page {
  width: min(100%, 1720px);
}

.bth-sessions-page .bth-grid-main--portal {
  grid-template-columns: minmax(0, 1fr);
}

.bth-session-filters-card {
  margin-bottom: 18px;
}

.bth-session-filters-form .bth-form-grid--sessions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
}

.bth-session-filters-form .bth-inline-actions {
  margin-top: 14px;
}

.bth-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.bth-session-project-row {
  margin: 10px 0 2px;
}

.bth-sessions-page .bth-sessions-card,
.bth-sessions-page .bth-session-detail-card {
  width: 100%;
}

@media (max-width: 1180px) {
  .bth-session-filters-form .bth-form-grid--sessions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .bth-session-filters-form .bth-form-grid--sessions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .bth-session-filters-form .bth-form-grid--sessions {
    grid-template-columns: 1fr;
  }
}


.bth-active-team-sessions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(183, 198, 255, 0.45);
}

.bth-active-team-sessions .bth-list li {
  padding: 8px 0;
}


/* 0.8.5 form readability fix */
.bth-wrap .bth-stack-form input[type="text"],
.bth-wrap .bth-stack-form input[type="email"],
.bth-wrap .bth-stack-form input[type="number"],
.bth-wrap .bth-stack-form input[type="datetime-local"],
.bth-wrap .bth-stack-form input[type="file"],
.bth-wrap .bth-stack-form select,
.bth-wrap .bth-stack-form textarea,
.bth-portal .bth-stack-form input[type="text"],
.bth-portal .bth-stack-form input[type="email"],
.bth-portal .bth-stack-form input[type="number"],
.bth-portal .bth-stack-form input[type="datetime-local"],
.bth-portal .bth-stack-form input[type="file"],
.bth-portal .bth-stack-form select,
.bth-portal .bth-stack-form textarea {
  color: #16203b !important;
  -webkit-text-fill-color: #16203b !important;
  background: #ffffff !important;
  caret-color: #16203b !important;
}

.bth-wrap .bth-stack-form input::placeholder,
.bth-wrap .bth-stack-form textarea::placeholder,
.bth-portal .bth-stack-form input::placeholder,
.bth-portal .bth-stack-form textarea::placeholder {
  color: #6b7280 !important;
  opacity: 1 !important;
}

.bth-wrap .bth-stack-form label,
.bth-wrap .bth-stack-form legend,
.bth-portal .bth-stack-form label,
.bth-portal .bth-stack-form legend,
.bth-card-command-center label,
.bth-card-command-center legend {
  color: #16203b !important;
}

.bth-wrap .bth-stack-form option,
.bth-portal .bth-stack-form option {
  color: #16203b !important;
  background: #ffffff !important;
}

.bth-wrap .bth-stack-form input:focus,
.bth-wrap .bth-stack-form select:focus,
.bth-wrap .bth-stack-form textarea:focus,
.bth-portal .bth-stack-form input:focus,
.bth-portal .bth-stack-form select:focus,
.bth-portal .bth-stack-form textarea:focus {
  color: #16203b !important;
  -webkit-text-fill-color: #16203b !important;
  background: #ffffff !important;
}
