:root {
  --bth-bg: #f3f6ff;
  --bth-surface: #ffffff;
  --bth-surface-soft: #f8faff;
  --bth-border: #d9e2ff;
  --bth-border-strong: #b7c6ff;
  --bth-text: #16203b;
  --bth-muted: #5d6b91;
  --bth-primary: #5b5bd6;
  --bth-secondary: #15b8a6;
  --bth-accent: #ff6f61;
  --bth-warning: #ffb74d;
  --bth-success: #2fb67c;
  --bth-danger: #f05d5e;
  --bth-shadow: 0 16px 40px rgba(40, 63, 131, 0.12);
}

.bth-wrap {
  color: var(--bth-text);
}

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

.bth-wrap .bth-grid-stats {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.bth-wrap .bth-grid-tasks {
  grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr);
}

.bth-wrap .bth-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.98));
  border: 1px solid var(--bth-border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--bth-shadow);
}

.bth-wrap .bth-card h2,
.bth-wrap .bth-card h3,
.bth-wrap .bth-card strong,
.bth-wrap .bth-card label,
.bth-wrap .bth-card th,
.bth-wrap .bth-card td,
.bth-wrap .bth-card p,
.bth-wrap .bth-card li,
.bth-wrap .bth-card summary {
  color: inherit;
}

.bth-wrap .bth-card-head,
.bth-wrap .bth-inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bth-wrap .bth-subsection {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e8edff;
}

.bth-wrap .bth-list {
  margin: 0;
}

.bth-wrap .bth-list li {
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid #eef1fb;
}

.bth-wrap .bth-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.bth-wrap .priority-low,
.bth-wrap .status-complete {
  background: rgba(47, 182, 124, 0.12);
  border-color: rgba(47, 182, 124, 0.25);
}

.bth-wrap .priority-medium,
.bth-wrap .status-open {
  background: rgba(91, 91, 214, 0.12);
  border-color: rgba(91, 91, 214, 0.2);
}

.bth-wrap .priority-high,
.bth-wrap .status-in_progress {
  background: rgba(255, 183, 77, 0.18);
  border-color: rgba(255, 183, 77, 0.28);
}

.bth-wrap .priority-urgent,
.bth-wrap .status-blocked {
  background: rgba(240, 93, 94, 0.14);
  border-color: rgba(240, 93, 94, 0.26);
}

.bth-big-number {
  font-size: 42px;
  font-weight: 800;
  margin: 6px 0 0;
  line-height: 1;
  background: linear-gradient(135deg, var(--bth-primary), var(--bth-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bth-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.bth-inline-actions form,
.bth-card-head form,
.bth-template-bar form {
  margin: 0;
}

.bth-template-bar {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed var(--bth-border-strong);
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.08), rgba(21, 184, 166, 0.08));
}

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

.bth-table {
  width: 100%;
  border-collapse: collapse;
}

.bth-table th,
.bth-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf1fb;
  vertical-align: top;
  text-align: left;
}

.bth-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bth-muted);
}

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

.bth-message.is-unread {
  border-left: 4px solid var(--bth-primary);
}

.bth-calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
  gap: 12px;
  flex-wrap: wrap;
}

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

.bth-calendar-grid--framed {
  align-items: stretch;
}

.bth-calendar-weekday {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--bth-muted);
  padding: 0 2px;
}

.bth-calendar-day {
  min-height: 132px;
  padding: 10px;
  border: 1px solid var(--bth-border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7f9ff);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.bth-calendar-day:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(45, 68, 136, 0.1);
}

.bth-calendar-day.is-drop-target {
  border-color: var(--bth-secondary);
  box-shadow: 0 0 0 3px rgba(21, 184, 166, 0.18);
  background: linear-gradient(180deg, rgba(21, 184, 166, 0.09), rgba(255, 255, 255, 0.95));
}

.bth-calendar-day--empty {
  background: rgba(236, 241, 255, 0.6);
}

.bth-calendar-day-number {
  font-weight: 800;
  margin-bottom: 10px;
}

.bth-calendar-task {
  display: block;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  cursor: grab;
}

.bth-calendar-task.is-dragging {
  opacity: 0.6;
}

.bth-details {
  margin-bottom: 18px;
  border: 1px solid var(--bth-border);
  border-radius: 16px;
  padding: 14px;
  background: #fcfdff;
}

.bth-details summary {
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
}

.bth-wrap .bth-stack-form,
.bth-wrap .bth-stack-form * {
  box-sizing: border-box;
}

.bth-wrap .bth-stack-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.bth-wrap .bth-form-grid {
  align-items: start;
}

.bth-wrap .bth-form-grid > * {
  min-width: 0;
}

.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 {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  line-height: 1.35;
}

.bth-wrap .bth-stack-form textarea {
  min-height: 110px;
  resize: vertical;
}

.bth-wrap .bth-stack-form input[type="datetime-local"] {
  overflow: hidden;
}

.bth-wrap .bth-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.bth-wrap .bth-checkbox-row input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

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

.bth-stack-form p {
  margin: 0 0 14px;
}

.bth-stack-form input[type="text"],
.bth-stack-form input[type="email"],
.bth-stack-form input[type="number"],
.bth-stack-form input[type="datetime-local"],
.bth-stack-form input[type="file"],
.bth-stack-form select,
.bth-stack-form textarea {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  border-color: var(--bth-border-strong);
  padding: 8px 10px;
}

.bth-stack-form textarea {
  min-height: 110px;
}

.bth-notice {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
}

.bth-notice-success {
  background: rgba(47, 182, 124, 0.12);
  border-color: rgba(47, 182, 124, 0.2);
}

.bth-notice-error {
  background: rgba(240, 93, 94, 0.12);
  border-color: rgba(240, 93, 94, 0.2);
}

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

@media (max-width: 960px) {
  .bth-wrap .bth-grid-tasks,
  .bth-form-grid {
    grid-template-columns: 1fr;
  }

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

  .bth-calendar-weekday {
    display: none;
  }
}


.bth-card-command-center {
  width: 100%;
}

.bth-table tr.is-active-row {
  background: rgba(91, 91, 214, 0.08);
}

.bth-table tr.is-active-row td {
  box-shadow: inset 0 1px 0 rgba(91, 91, 214, 0.08), inset 0 -1px 0 rgba(91, 91, 214, 0.08);
}

.bth-task-detail-card {
  scroll-margin-top: 28px;
}


.bth-session-toggle {
  min-width: 180px;
  padding: 12px 22px !important;
  font-size: 15px !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-command-center,
#bth-task-detail,
#bth-trash-folder,
#bth-admin-command-center,
#bth-admin-task-detail,
#bth-admin-trash-folder {
  scroll-margin-top: 110px;
}

/* 0.7.0 admin polish */
.bth-wrap .priority-high {
  background: rgba(206, 255, 105, 0.36);
  border-color: rgba(132, 196, 0, 0.34);
}

.bth-wrap .priority-urgent {
  background: rgba(255, 243, 136, 0.48);
  border-color: rgba(206, 179, 0, 0.38);
}

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

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

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

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


/* 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;
}
