/**
 * Teacher card — visual sudoku piece (v2.4)
 */

.hm-tcard {
	--tcard-radius: 14px;
	font-size: 0.944rem;
	line-height: 1.5;
	color: var(--hm-text, #0c1222);
}

.hm-tcard__empty {
	margin: 0;
	padding: 1rem;
	text-align: center;
	color: var(--hm-muted, #64748b);
	font-size: 0.944rem;
}

/* Hero */
.hm-tcard__hero {
	position: relative;
	border-radius: var(--tcard-radius);
	overflow: hidden;
	margin-bottom: 1rem;
	background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%);
}

.hm-tcard--deadlock .hm-tcard__hero {
	background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.hm-tcard--warn .hm-tcard__hero {
	background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}

.hm-tcard__hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 80% 20%, rgb(255 255 255 / 18%), transparent 45%);
	pointer-events: none;
}

.hm-tcard__status-badge {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	font-size: 0.722rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0.3rem 0.65rem;
	border-radius: 999px;
	background: rgb(255 255 255 / 22%);
	color: #fff;
	backdrop-filter: blur(6px);
}

.hm-tcard__status-badge--ok { background: rgb(16 185 129 / 35%); }
.hm-tcard__status-badge--warn { background: rgb(251 191 36 / 40%); }
.hm-tcard__status-badge--deadlock { background: rgb(239 68 68 / 45%); }

.hm-tcard__hero-body {
	position: relative;
	display: flex;
	gap: 1rem;
	align-items: flex-end;
	padding: 1.25rem 1rem 1rem;
}

.hm-tcard__avatar-wrap {
	position: relative;
	flex-shrink: 0;
}

.hm-tcard__avatar {
	width: 88px;
	height: 88px;
	border-radius: 50%;
	object-fit: cover;
	border: 4px solid rgb(255 255 255 / 90%);
	background: #e2e8f0;
	box-shadow: 0 8px 24px rgb(15 23 42 / 25%);
}

.hm-tcard__avatar--wa {
	border-color: #25d366;
}

.hm-tcard__avatar--gen {
	border-color: rgb(255 255 255 / 90%);
}

.hm-tcard__wa-badge {
	position: absolute;
	bottom: 4px;
	left: 4px;
	font-size: 0.625rem;
	font-weight: 800;
	background: #25d366;
	color: #fff;
	border-radius: 6px;
	padding: 0.15rem 0.35rem;
	box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
}

.hm-tcard__identity {
	flex: 1;
	min-width: 0;
	color: #fff;
	padding-bottom: 0.25rem;
}

.hm-tcard__name {
	margin: 0 0 0.15rem;
	font-family: var(--hm-font-display, "Heebo", sans-serif);
	font-size: 1.375rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.hm-tcard__id {
	margin: 0 0 0.35rem;
	font-size: 0.778rem;
	opacity: 0.85;
}

.hm-tcard__contact {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.hm-tcard__contact li {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	font-size: 0.889rem;
}

.hm-tcard__contact a {
	color: #fff;
	text-decoration: none;
}

.hm-tcard__contact a:hover {
	text-decoration: underline;
}

.hm-tcard__contact-icon {
	width: 16px;
	height: 16px;
	opacity: 0.9;
	flex-shrink: 0;
}

.hm-tcard__contact-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Stats */
.hm-tcard__stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.hm-tcard__stat {
	background: var(--hm-surface, #fff);
	border: 1px solid var(--hm-border, #dbe3ef);
	border-radius: 12px;
	padding: 0.65rem 0.5rem;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	box-shadow: 0 2px 8px rgb(15 23 42 / 4%);
}

.hm-tcard__stat--tokens {
	background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
	border-color: #fde68a;
}

.hm-tcard__stat-icon {
	width: 18px;
	height: 18px;
	margin: 0 auto 0.1rem;
	color: #d97706;
}

.hm-tcard__stat-icon svg {
	width: 100%;
	height: 100%;
}

.hm-tcard__stat-label {
	font-size: 0.722rem;
	color: var(--hm-muted, #64748b);
	font-weight: 500;
}

.hm-tcard__stat-value {
	font-size: 1.25rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.1;
}

/* Sensitivity */
.hm-tcard__sens {
	border-radius: 12px;
	padding: 0.75rem 0.875rem;
	margin-bottom: 1rem;
}

.hm-tcard__sens--low { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.hm-tcard__sens--medium { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.hm-tcard__sens--high { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.hm-tcard__sens-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	font-size: 0.889rem;
}

.hm-tcard__sens-level {
	font-weight: 600;
}

.hm-tcard__load {
	height: 6px;
	background: rgb(15 23 42 / 8%);
	border-radius: 999px;
	overflow: hidden;
	margin-bottom: 0.35rem;
}

.hm-tcard__load-bar {
	height: 100%;
	background: currentColor;
	border-radius: 999px;
	opacity: 0.55;
	transition: width 0.3s ease;
}

.hm-tcard__load-label {
	font-size: 0.778rem;
	font-weight: 600;
}

.hm-tcard__sens-detail {
	margin: 0.35rem 0 0;
	font-size: 0.778rem;
	opacity: 0.9;
}

/* Last action */
.hm-tcard__last-action {
	padding: 0.65rem 0.875rem;
	border-radius: 10px;
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	color: #1e40af;
	font-size: 0.889rem;
	font-weight: 500;
	margin-bottom: 1rem;
}

.hm-tcard__last-action--deadlock {
	background: #fef2f2;
	border-color: #fecaca;
	color: #991b1b;
}

/* Sections */
.hm-tcard__section {
	margin-bottom: 1.125rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--hm-border, #e2e8f0);
}

.hm-tcard__section:last-child {
	border-bottom: none;
	margin-bottom: 0;
	padding-bottom: 0;
}

.hm-tcard__section-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.65rem;
}

.hm-tcard__section-icon {
	width: 28px;
	height: 28px;
	padding: 5px;
	border-radius: 8px;
	background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
	color: #fff;
	flex-shrink: 0;
}

.hm-tcard__section-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.hm-tcard__section-title {
	margin: 0;
	flex: 1;
	font-family: var(--hm-font-display, "Heebo", sans-serif);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: -0.01em;
}

.hm-tcard__section-meta {
	font-size: 0.778rem;
	font-weight: 600;
	color: var(--hm-muted, #64748b);
	background: #f1f5f9;
	padding: 0.2rem 0.5rem;
	border-radius: 999px;
}

/* Chips & constraints */
.hm-tcard__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.hm-tcard__chip {
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	padding: 0.3rem 0.75rem;
	font-size: 0.833rem;
	font-weight: 600;
}

.hm-tcard__constraints {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.hm-tcard__constraint {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	font-size: 0.833rem;
	padding: 0.45rem 0.65rem;
	border-radius: 10px;
}

.hm-tcard__constraint--hard {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.hm-tcard__constraint--soft {
	background: #fef3c7;
	color: #92400e;
	border: 1px solid #fde68a;
}

.hm-tcard__constraint-type {
	font-weight: 600;
}

.hm-tcard__constraint-val {
	font-weight: 500;
	opacity: 0.9;
}

/* Week grid */
.hm-tcard__week-label {
	margin: 0 0 0.5rem;
	font-size: 0.778rem;
	color: var(--hm-muted, #64748b);
	font-weight: 500;
}

.hm-tcard__grid {
	display: grid;
	grid-template-columns: 32px repeat(6, 1fr);
	gap: 3px;
	font-size: 0.722rem;
}

.hm-tcard__grid-wrap--compact .hm-tcard__grid {
	grid-template-columns: 26px repeat(6, 1fr);
	font-size: 0.667rem;
}

.hm-tcard__grid-day,
.hm-tcard__grid-period {
	display: grid;
	place-items: center;
	font-weight: 700;
	color: var(--hm-muted, #64748b);
	font-size: 0.778rem;
}

.hm-tcard__grid-cell {
	min-height: 36px;
	border-radius: 6px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 3px;
	gap: 1px;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hm-tcard__grid-wrap--compact .hm-tcard__grid-cell {
	min-height: 28px;
}

.hm-tcard__grid-cell:not(.hm-tcard__grid-cell--empty):hover {
	transform: scale(1.04);
	box-shadow: 0 2px 8px rgb(15 23 42 / 12%);
	z-index: 1;
}

.hm-tcard__grid-cell--scheduled { background: #dbeafe; border-color: #93c5fd; }
.hm-tcard__grid-cell--substituted { background: #fde68a; border-color: #fcd34d; }
.hm-tcard__grid-cell--pending_substitution { background: #fed7aa; border-color: #fdba74; }
.hm-tcard__grid-cell--gap { background: #fecaca; border-color: #fca5a5; }
.hm-tcard__grid-cell--deadlock { background: #fca5a5; border-color: #ef4444; }
.hm-tcard__grid-cell--empty { background: transparent; border-color: transparent; }

.hm-tcard__grid-class {
	font-size: 0.667rem;
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
	line-height: 1.1;
}

.hm-tcard__grid-subject {
	font-size: 0.6rem;
	color: var(--hm-muted, #64748b);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

.hm-tcard__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	list-style: none;
	margin: 0.65rem 0 0;
	padding: 0;
	font-size: 0.667rem;
	color: var(--hm-muted, #64748b);
}

.hm-tcard__legend li {
	display: flex;
	align-items: center;
	gap: 0.3rem;
}

.hm-tcard__legend-swatch {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	border: 1px solid rgb(15 23 42 / 10%);
}

/* Timeline lists */
.hm-tcard__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.hm-tcard__list--plain {
	list-style: disc;
	padding-right: 1.25rem;
}

.hm-tcard__list-item {
	margin: 0;
}

.hm-tcard__timeline-row {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 0.55rem 0.65rem;
}

.hm-tcard__timeline-main {
	font-weight: 600;
	font-size: 0.833rem;
}

.hm-tcard__timeline-sub {
	font-size: 0.778rem;
	color: var(--hm-muted, #64748b);
	margin-top: 0.15rem;
}

.hm-tcard__timeline-badge {
	display: inline-block;
	margin-top: 0.25rem;
	font-size: 0.667rem;
	font-weight: 700;
	padding: 0.15rem 0.45rem;
	border-radius: 999px;
	background: #e2e8f0;
	color: #475569;
}

/* Collapsible (inline dashboard) */
.hm-tcard__details--collapsed {
	display: none;
}

.hm-tcard__toggle {
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.65rem;
	border: 1px dashed var(--hm-border, #cbd5e1);
	border-radius: 10px;
	background: #f8fafc;
	color: var(--hm-primary, #2563eb);
	font-size: 0.889rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease;
}

.hm-tcard__toggle:hover {
	background: #eff6ff;
}

/* Mode: chat bubble (mirror) */
.hm-tcard--mode-chat {
	font-size: 0.833rem;
}

.hm-tcard--mode-chat .hm-tcard__hero-body {
	padding: 0.875rem;
}

.hm-tcard--mode-chat .hm-tcard__avatar {
	width: 56px;
	height: 56px;
}

.hm-tcard--mode-chat .hm-tcard__name {
	font-size: 1.05rem;
}

.hm-tcard--mode-chat .hm-tcard__section {
	margin-bottom: 0.65rem;
	padding-bottom: 0.65rem;
}

/* Drawer & inline hosts — פופאפ מרכזי */
.hm-tcard-drawer[hidden] {
	display: none !important;
}

.hm-tcard-drawer {
	position: fixed;
	inset: 0;
	z-index: 1200;
}

.hm-tcard-drawer:not([hidden]) {
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
}

.hm-tcard-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(15 23 42 / 72%);
	backdrop-filter: blur(4px);
}

.hm-tcard-drawer__panel {
	position: relative;
	top: auto;
	left: auto;
	height: auto;
	max-height: min(90vh, 860px);
	width: min(780px, 96vw);
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 25px 60px rgb(0 0 0 / 25%);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: hm-modal-in 0.22s ease;
}

.hm-tcard-drawer__toolbar {
	padding: 0.875rem 1.25rem;
	background: #f8fafc;
	border-bottom: 1px solid var(--hm-border, #e2e8f0);
}

.hm-tcard-drawer__toolbar label {
	display: block;
	font-size: 0.833rem;
	font-weight: 600;
	margin-bottom: 0.35rem;
}

.hm-tcard-drawer__select {
	width: 100%;
	padding: 0.55rem 0.75rem;
	font-size: 0.944rem;
	border: 1px solid var(--hm-border, #cbd5e1);
	border-radius: 10px;
	background: #fff;
}

.hm-tcard-drawer__body {
	padding: 1.25rem;
	background: #fafbfc;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
}

.hm-tcard-inline {
	max-height: 520px;
	overflow: auto;
	padding: 0.25rem;
}

.hm-panel--teacher-card {
	grid-column: 1 / -1;
}

.hm-mirror__tcard-host .hm-tcard {
	max-width: 100%;
}

.hm-mirror__card-wrap .hm-tcard {
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 2px 12px rgb(0 0 0 / 8%);
}

@media (max-width: 640px) {
	.hm-tcard__stats {
		grid-template-columns: repeat(2, 1fr);
	}

	.hm-tcard__hero-body {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}

	.hm-tcard__contact li {
		justify-content: center;
	}
}

/* Clickable teacher names — global */
.hm-teacher-link {
	display: inline;
	padding: 0;
	margin: 0;
	border: none;
	background: none;
	color: var(--hm-primary, #2563eb);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	text-decoration: underline;
	text-decoration-color: rgb(37 99 235 / 35%);
	text-underline-offset: 2px;
}

.hm-teacher-link:hover {
	color: var(--hm-primary-hover, #1d4ed8);
	text-decoration-color: currentColor;
}

.hm-teacher-link:focus-visible {
	outline: 2px solid var(--hm-primary, #2563eb);
	outline-offset: 2px;
	border-radius: 4px;
}

.hm-heatmap__label {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0;
	line-height: 1.15;
	text-align: center;
}

.hm-heatmap__teacher {
	font-size: inherit;
	font-weight: 800;
	text-decoration: none;
}

.hm-heatmap__teacher:hover {
	background: rgb(37 99 235 / 12%);
	border-radius: 4px;
}

/* Profile edit */
.hm-tcard__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0.75rem 0 0.25rem;
	padding: 0.75rem;
	border-radius: 12px;
	background: #f8fafc;
	border: 1px solid var(--hm-border, #e2e8f0);
}

.hm-tcard__action-btn {
	font-size: 0.82rem;
}

.hm-tcard__actions-meta {
	margin-inline-start: auto;
	font-size: 0.75rem;
	color: var(--hm-muted, #64748b);
	font-weight: 600;
}

.hm-tcard__action-status {
	flex: 1 1 100%;
	margin: 0.15rem 0 0;
	font-size: 0.78rem;
}

.hm-tcard__edit-textarea {
	min-height: 72px;
	resize: vertical;
}

.hm-tcard__edit-toggle {
	width: 100%;
	padding: 0.65rem;
	border: 1px dashed var(--hm-border, #cbd5e1);
	border-radius: 10px;
	background: #fff;
	color: var(--hm-primary, #2563eb);
	font-size: 0.944rem;
	font-weight: 600;
	cursor: pointer;
}

.hm-tcard__edit-toggle:hover {
	background: #eff6ff;
}

.hm-tcard__edit-form {
	margin-top: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.hm-tcard__edit-form--collapsed {
	display: none;
}

.hm-tcard__edit-field {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	font-size: 0.889rem;
}

.hm-tcard__edit-field span {
	font-weight: 600;
	color: var(--hm-muted, #64748b);
}

.hm-tcard__edit-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.hm-tcard__timeline-sub .hm-teacher-link {
	font-weight: 600;
}

/* v3 — smarter card layout */
.hm-tcard--v3 .hm-tcard__hero {
	background: linear-gradient(135deg, #0c4a6e 0%, #2563eb 45%, #4f46e5 100%);
}

.hm-tcard--v3.hm-tcard--warn .hm-tcard__hero {
	background: linear-gradient(135deg, #b45309 0%, #ea580c 55%, #f59e0b 100%);
}

.hm-tcard--v3.hm-tcard--deadlock .hm-tcard__hero {
	background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 55%, #991b1b 100%);
}

.hm-tcard--v3 .hm-tcard__avatar {
	width: 96px;
	height: 96px;
	border: 3px solid rgb(255 255 255 / 35%);
	box-shadow: 0 10px 28px rgb(0 0 0 / 22%);
}

.hm-tcard__roleline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	margin: 0.2rem 0 0.55rem;
}

.hm-tcard__role,
.hm-tcard__homeroom,
.hm-tcard__id {
	display: inline-flex;
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 700;
}

.hm-tcard__role {
	background: rgb(255 255 255 / 22%);
	color: #fff;
}

.hm-tcard__homeroom {
	background: rgb(16 185 129 / 28%);
	color: #ecfdf5;
}

.hm-tcard__id {
	background: rgb(0 0 0 / 18%);
	color: rgb(255 255 255 / 85%);
	font-family: ui-monospace, monospace;
}

.hm-tcard__chips--subjects {
	margin-top: 0.15rem;
}

.hm-tcard__chip--subject {
	background: rgb(255 255 255 / 18%);
	color: #fff;
	border: 1px solid rgb(255 255 255 / 22%);
}

.hm-tcard__chip--more {
	background: rgb(0 0 0 / 20%);
	color: #e2e8f0;
}

.hm-tcard__insights {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0.85rem 0 0.25rem;
}

.hm-tcard__insight {
	display: inline-flex;
	padding: 0.35rem 0.7rem;
	border-radius: 999px;
	font-size: 0.8rem;
	font-weight: 700;
	background: #f1f5f9;
	color: #334155;
	border: 1px solid #e2e8f0;
}

.hm-tcard__insight--role {
	background: #ede9fe;
	color: #5b21b6;
	border-color: #ddd6fe;
}

.hm-tcard__insight--homeroom {
	background: #dcfce7;
	color: #166534;
	border-color: #bbf7d0;
}

.hm-tcard__insight--subject {
	background: #e0f2fe;
	color: #075985;
	border-color: #bae6fd;
}

.hm-tcard__insight--hours,
.hm-tcard__insight--classes {
	background: #f8fafc;
	color: #475569;
}

.hm-tcard__insight--high,
.hm-tcard__insight--alert {
	background: #fef2f2;
	color: #991b1b;
	border-color: #fecaca;
}

.hm-tcard__insight--medium,
.hm-tcard__insight--warn {
	background: #fffbeb;
	color: #92400e;
	border-color: #fde68a;
}

.hm-tcard__insight--low {
	background: #ecfdf5;
	color: #166534;
	border-color: #bbf7d0;
}

.hm-tcard__note {
	margin: 0.75rem 0;
	padding: 0.85rem 1rem;
	border-radius: 12px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	font-size: 0.92rem;
	line-height: 1.5;
}

.hm-tcard__note strong {
	display: block;
	margin-bottom: 0.25rem;
	color: #92400e;
}

.hm-tcard__note p {
	margin: 0;
	color: #78350f;
}

.hm-tcard--v3 .hm-tcard__stats {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.55rem;
}

.hm-tcard--v3 .hm-tcard__stat {
	border-radius: 12px;
	background: #fff;
	border: 1px solid #e2e8f0;
	box-shadow: 0 2px 8px rgb(15 23 42 / 4%);
}

.hm-tcard--v3 .hm-tcard__stat-value {
	font-size: 1.35rem;
}
