/* =========================================
   Components: shared surfaces, controls, grids,
   filters, lists, messages and small helpers
   ========================================= */

/* =========
   Surfaces
   ========= */

.panel,
.hero-card,
.stat-card,
.summary-box,
.course-card,
.list-item,
.track-card,
.onboarding-card,
.onboarding-panel-pretty,
.welcome-side-card,
.filters-panel,
.lesson-card,
.question-card,
.result-box,
.answer-item,
.attempt-item,
.auth-card,
.empty-state,
.course-context-card,
.course-outline-item,
.mini-link-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
}

.panel,
.hero-card,
.course-card,
.filters-panel,
.auth-card,
.empty-state {
    border-radius: var(--radius-xl);
    padding: 24px;
}

.summary-box,
.list-item,
.mini-link-card,
.course-context-card {
    border-radius: var(--radius-md);
}

.stat-card {
    border-radius: var(--radius-lg);
    padding: 20px;
}

/* =========
   Buttons
   ========= */

.btn {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.btn[hidden],
[hidden] {
    display: none !important;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--brand-red);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(217, 41, 47, 0.20);
}

.btn-primary:hover {
    background: var(--brand-red-dark);
}

.btn-secondary {
    background: var(--bg-surface-soft);
    color: var(--text-main);
    border-color: var(--border-soft);
}

.btn-secondary:hover {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    border-color: var(--border-accent);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-text);
}

.btn-danger:hover {
    background: var(--danger-text);
    color: #ffffff;
}

.btn-outline-brand {
    background: var(--bg-surface-soft);
    color: var(--text-main);
    border-color: var(--border-accent);
    box-shadow: none;
}

.btn-outline-brand:hover {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    border-color: rgba(217, 41, 47, 0.32);
}

.btn-disabled {
    background: var(--neutral-bg);
    color: var(--text-soft);
    border-color: var(--border-soft);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-full {
    width: 100%;
}

/* =========
   Inputs
   ========= */

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
    width: 100%;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type="radio"],
input[type="checkbox"] {
    width: auto;
    min-width: auto;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    accent-color: var(--brand-red);
    cursor: pointer;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-soft);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(217, 41, 47, 0.42);
    box-shadow: 0 0 0 4px rgba(217, 41, 47, 0.10);
}

textarea {
    min-height: 180px;
    resize: vertical;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-error {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(217, 41, 47, 0.08);
    color: var(--brand-red-dark);
}

/* =========
   Shared grids
   ========= */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 18px;
    align-items: start;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

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

.skill-summary-grid,
.course-summary-grid,
.course-facts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

/* =========
   Generic text blocks
   ========= */

.stat-title,
.stat-hint,
.course-track,
.course-meta,
.list-meta,
.empty-hint,
.user-meta,
.summary-box .stat-title {
    color: var(--text-muted);
}

.stat-title {
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value,
.summary-box .stat-value {
    color: var(--text-main);
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
}

.course-title,
.panel h3,
.list-item-title {
    color: var(--text-main);
}

.list-item-title {
    font-weight: 800;
    margin-bottom: 6px;
}

.link-inline {
    color: var(--brand-red);
    font-weight: 700;
    font-size: 14px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

/* =========
   Filters
   ========= */

.filters-panel {
    margin-bottom: 24px;
    padding: 20px;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

/* =========
   Lists
   ========= */

.list-stack,
.attempts-list,
.answers-list,
.lessons-list,
.team-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    padding: 16px;
    background: var(--bg-surface-soft);
}

.lesson-item,
.option-item,
.team-row,
.action-card {
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg-surface-soft);
}

.lesson-item {
    display: flex;
    gap: 16px;
    padding: 18px;
}

.lesson-content {
    flex: 1;
}

.lesson-content h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

.lesson-text,
.action-card-text {
    color: var(--text-muted);
    line-height: 1.7;
}

.action-card {
    display: block;
    padding: 16px 18px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.action-card-title {
    color: var(--text-main);
    font-weight: 800;
    margin-bottom: 6px;
}

.team-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px;
}

.team-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: var(--text-muted);
    font-size: 14px;
}

/* =========
   Search / small helpers
   ========= */

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.search-form input {
    min-width: min(420px, 100%);
}

.muted-text {
    color: var(--text-muted);
}

.empty-hint {
    font-size: 14px;
}

.messages {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.message {
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 600;
}

.message-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.message-info {
    background: var(--info-bg);
    color: var(--info-text);
}

.message-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.message-error {
    background: rgba(217, 41, 47, 0.08);
    color: var(--brand-red-dark);
}

/* =========
   Ring stats
   ========= */

.ring-stat {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ring-stat__chart {
    position: relative;
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
}

.ring-stat__svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
}

.ring-stat__track {
    fill: none;
    stroke: var(--bg-muted);
    stroke-width: 3.6;
}

.ring-stat__fill {
    --pct: 0;
    fill: none;
    stroke: var(--brand-red);
    stroke-width: 3.6;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 - var(--pct, 0));
    transition: stroke-dashoffset 0.4s ease;
}

.ring-stat__fill--empty {
    opacity: 0;
}

.ring-stat__value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.ring-stat__legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ring-stat__legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.ring-stat__legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--brand-red);
    flex: 0 0 auto;
}

.ring-stat__legend-dot--muted {
    background: var(--border-strong);
}

.ring-stat__legend-dot--warning {
    background: var(--warning-text);
}

.ring-stat__legend-value {
    color: var(--text-main);
    font-weight: 700;
}

/* =========
   Activity feed
   ========= */

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-feed__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}

.activity-feed__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-feed__avatar {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    font-weight: 800;
    font-size: 13px;
}

.activity-feed__body {
    min-width: 0;
    flex: 1 1 auto;
}

.activity-feed__text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-main);
}

.activity-feed__actor {
    font-weight: 700;
}

.activity-feed__time {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-soft);
}

/* =========
   Data table
   ========= */

.dt-wrap {
    overflow-x: auto;
}

.dt {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.dt th,
.dt td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.dt th {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dt tbody tr:hover {
    background: var(--bg-surface-soft);
}

.dt tbody tr:last-child td {
    border-bottom: none;
}

.dt td.dt-cell-wrap,
.dt th.dt-cell-wrap {
    white-space: normal;
}

.dt-check {
    width: 32px;
}

.dt-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-main);
}

.dt-primary a {
    color: inherit;
}

.dt-primary a:hover {
    color: var(--brand-red);
}

.dt-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 14px;
}

.dt-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.dt-progress .progress-bar {
    margin: 0;
    flex: 1 1 auto;
    min-width: 60px;
}

.dt-progress-value {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--text-main);
    font-size: 13px;
}

.dt-muted {
    color: var(--text-soft);
}

.dt-menu {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.dt-menu:hover {
    background: var(--bg-muted);
    color: var(--text-main);
}

/* Markdown task lists shared by lessons, Studio previews and knowledge articles. */
li.markdown-task-item {
    list-style: none;
}

.markdown-task-marker {
    display: inline-grid;
    width: 1.2em;
    margin-left: -1.35em;
    margin-right: 0.25em;
    place-items: center;
    color: var(--text-muted);
    font-weight: 900;
}

.markdown-task-marker--checked {
    color: var(--success-text);
}
