/* ============================================================
   Training Management – 2026 Corporate Theme
   Modern, clean, sophisticated design language
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
    /* Sidebar */
    --tm-sidebar-width: 272px;
    --tm-sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    --tm-sidebar-border: rgba(255, 255, 255, 0.06);

    /* Header */
    --tm-header-height: 64px;

    /* Brand Colors – Indigo/Violet spectrum */
    --tm-primary: #6366f1;
    --tm-primary-hover: #4f46e5;
    --tm-primary-light: #eef2ff;
    --tm-primary-glow: rgba(99, 102, 241, 0.25);

    /* Accent */
    --tm-accent: #0ea5e9;
    --tm-accent-light: #e0f2fe;

    /* Success / Warning / Danger */
    --tm-success: #10b981;
    --tm-warning: #f59e0b;
    --tm-danger: #ef4444;

    /* Neutrals */
    --tm-bg: #f1f5f9;
    --tm-surface: #ffffff;
    --tm-text: #0f172a;
    --tm-text-secondary: #475569;
    --tm-text-muted: #94a3b8;
    --tm-border: #e2e8f0;
    --tm-border-light: #f1f5f9;

    /* Shadows – layered for depth */
    --tm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --tm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --tm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --tm-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Radii */
    --tm-radius-sm: 8px;
    --tm-radius-md: 12px;
    --tm-radius-lg: 16px;
    --tm-radius-xl: 24px;

    /* Transitions */
    --tm-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --tm-transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base Reset & Typography ──────────────────────────────── */
html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: var(--tm-bg);
    color: var(--tm-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* Override Fomantic UI default font */
.ui,
.ui.menu,
.ui.header,
.ui.button,
.ui.form,
.ui.table,
.ui.segment,
.ui.message,
.ui.modal,
.ui.dropdown,
.ui.label,
.ui.input input,
.ui.statistic {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif !important;
}

/* Preserve Fomantic icon font */
i.icon {
    font-family: 'Icons' !important;
}

/* ── Application Shell ────────────────────────────────────── */
.tm-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--tm-bg);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.tm-sidebar {
    width: var(--tm-sidebar-width);
    min-width: var(--tm-sidebar-width);
    background: var(--tm-sidebar-bg);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 20;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

/* Subtle noise texture overlay on sidebar */
.tm-sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

/* Custom scrollbar for sidebar */
.tm-sidebar::-webkit-scrollbar {
    width: 4px;
}

.tm-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.tm-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.tm-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Main Content Area ────────────────────────────────────── */
.tm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Header ───────────────────────────────────────────────── */
.tm-header {
    height: var(--tm-header-height);
    min-height: var(--tm-header-height);
    background-color: var(--tm-surface);
    border-bottom: 1px solid var(--tm-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--tm-shadow-sm);
    z-index: 10;
    position: relative;
}

.tm-header .ui.menu {
    margin: 0;
    border: none;
    box-shadow: none;
    width: 100%;
    background: transparent;
    min-height: auto;
}

.tm-header .ui.secondary.menu .item {
    padding: 0.5rem 0.75rem;
    border-radius: var(--tm-radius-sm);
    color: var(--tm-text-secondary);
    transition: all var(--tm-transition);
    margin: 0 0.125rem;
}

.tm-header .ui.secondary.menu .item:hover {
    background: var(--tm-border-light);
    color: var(--tm-text);
}

.tm-header .ui.secondary.menu .item i.icon {
    color: var(--tm-text-muted);
    transition: color var(--tm-transition);
}

.tm-header .ui.secondary.menu .item:hover i.icon {
    color: var(--tm-primary);
}

.tm-header-text {
    margin-left: 0.5em;
    font-weight: 500;
    font-size: 0.9rem;
}

/* User profile pill in header */
.tm-header .right.menu .item {
    font-weight: 500;
}

.tm-user-pill {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
}

.tm-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tm-primary), #7c3aed);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0;
    flex-shrink: 0;
}

/* ── Content Area ─────────────────────────────────────────── */
.tm-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

/* Custom scrollbar for content */
.tm-content::-webkit-scrollbar {
    width: 6px;
}

.tm-content::-webkit-scrollbar-track {
    background: transparent;
}

.tm-content::-webkit-scrollbar-thumb {
    background: var(--tm-border);
    border-radius: 6px;
}

.tm-content::-webkit-scrollbar-thumb:hover {
    background: var(--tm-text-muted);
}

.tm-content > .ui.segment.basic {
    margin: 0;
    padding: 0;
}

/* ── Page Headers ─────────────────────────────────────────── */
.tm-page-header {
    margin-bottom: 1.75rem;
}

.tm-page-header h1,
.tm-page-header h2,
.tm-page-header .ui.header {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--tm-text);
}

.tm-page-header h1 {
    font-size: 1.75rem;
}

.tm-page-header h2 {
    font-size: 1.5rem;
}

/* ── Fomantic UI Overrides – Segments (Cards) ─────────────── */
.ui.segment {
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-md) !important;
    box-shadow: var(--tm-shadow-sm);
    transition: box-shadow var(--tm-transition), transform var(--tm-transition);
    background: var(--tm-surface);
}

/* Hover lift only for raised (card-like) segments, not all segments */

.ui.raised.segment {
    box-shadow: var(--tm-shadow-md) !important;
    border: 1px solid var(--tm-border);
}

.ui.raised.segment:hover {
    box-shadow: var(--tm-shadow-lg) !important;
    transform: translateY(-1px);
}

.ui.stacked.segment {
    border-radius: var(--tm-radius-md) !important;
}

/* Colored segments – subtle top border instead of full color */
.ui.red.segment {
    border-top: 3px solid var(--tm-danger) !important;
    border-color: var(--tm-border) !important;
    border-top-color: var(--tm-danger) !important;
}

.ui.yellow.segment {
    border-top: 3px solid var(--tm-warning) !important;
    border-color: var(--tm-border) !important;
    border-top-color: var(--tm-warning) !important;
}

.ui.blue.segment {
    border-top: 3px solid var(--tm-primary) !important;
    border-color: var(--tm-border) !important;
    border-top-color: var(--tm-primary) !important;
}

.ui.green.segment {
    border-top: 3px solid var(--tm-success) !important;
    border-color: var(--tm-border) !important;
    border-top-color: var(--tm-success) !important;
}

/* Attached segments – preserve visual continuity */
.ui.attached.segment,
.ui.top.attached.segment,
.ui.bottom.attached.segment {
    box-shadow: none;
    border-radius: 0 !important;
}

.ui.top.attached.segment {
    border-radius: var(--tm-radius-md) var(--tm-radius-md) 0 0 !important;
}

.ui.bottom.attached.segment {
    border-radius: 0 0 var(--tm-radius-md) var(--tm-radius-md) !important;
}

/* Disable hover shadow on attached segments */
.ui.attached.segment:hover,
.ui.top.attached.segment:hover,
.ui.bottom.attached.segment:hover {
    box-shadow: none;
    transform: none;
}

/* Tabular menu attached to segment */
.ui.top.attached.tabular.menu {
    border-radius: var(--tm-radius-md) var(--tm-radius-md) 0 0 !important;
}

.ui.tabular.menu .item {
    border-radius: var(--tm-radius-sm) var(--tm-radius-sm) 0 0 !important;
}

/* Stacked segment – proper layered effect */
.ui.stacked.segment::before,
.ui.stacked.segment::after {
    border-radius: var(--tm-radius-md) !important;
}

/* ── Fomantic UI Overrides – Buttons ──────────────────────── */
.ui.button {
    border-radius: var(--tm-radius-sm) !important;
    font-weight: 600;
    letter-spacing: 0;
    transition: all var(--tm-transition);
    text-transform: none;
}

.ui.button:hover {
    transform: translateY(-1px);
    box-shadow: var(--tm-shadow-md);
}

.ui.button:active {
    transform: translateY(0);
}

.ui.primary.button,
.ui.blue.button {
    background: var(--tm-primary) !important;
    border: none;
}

.ui.primary.button:hover,
.ui.blue.button:hover {
    background: var(--tm-primary-hover) !important;
    box-shadow: 0 4px 12px var(--tm-primary-glow);
}

.ui.positive.button,
.ui.green.button {
    background: var(--tm-success) !important;
}

.ui.positive.button:hover,
.ui.green.button:hover {
    background: #059669 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.ui.negative.button,
.ui.red.button {
    background: var(--tm-danger) !important;
}

.ui.negative.button:hover,
.ui.red.button:hover {
    background: #dc2626 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* ── Fomantic UI Overrides – Tables ───────────────────────── */
.ui.table {
    border-radius: var(--tm-radius-md) !important;
    border: 1px solid var(--tm-border);
    overflow: hidden;
}

.ui.table thead th {
    background: var(--tm-border-light) !important;
    color: var(--tm-text-secondary) !important;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--tm-border) !important;
    padding: 0.875rem 1rem !important;
}

.ui.table tbody td {
    padding: 0.875rem 1rem !important;
    color: var(--tm-text);
    border-top: 1px solid var(--tm-border-light) !important;
    transition: background var(--tm-transition);
}

.ui.table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.03) !important;
}

.ui.table tfoot th {
    background: var(--tm-surface) !important;
    border-top: 1px solid var(--tm-border) !important;
}

/* ── Fomantic UI Overrides – Forms & Inputs ───────────────── */
.ui.form .field > label {
    color: var(--tm-text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
}

.ui.input input,
.ui.form input[type="text"],
.ui.form input[type="email"],
.ui.form input[type="password"],
.ui.form input[type="number"],
.ui.form textarea,
.ui.form select,
.ui.selection.dropdown {
    border-radius: var(--tm-radius-sm) !important;
    border: 1.5px solid var(--tm-border) !important;
    transition: all var(--tm-transition);
    font-size: 0.95rem;
}

.ui.input input:focus,
.ui.form input:focus,
.ui.form textarea:focus,
.ui.selection.dropdown:focus,
.ui.selection.active.dropdown {
    border-color: var(--tm-primary) !important;
    box-shadow: 0 0 0 3px var(--tm-primary-glow) !important;
    outline: none;
}

/* ── Action Input (search field + button joined) ─────────── */
.ui.action.input > input {
    border-radius: var(--tm-radius-sm) 0 0 var(--tm-radius-sm) !important;
}

.ui.action.input > .button {
    border-radius: 0 var(--tm-radius-sm) var(--tm-radius-sm) 0 !important;
}

/* ── Fomantic UI Overrides – Dropdowns ────────────────────── */
.ui.dropdown .menu {
    border-radius: var(--tm-radius-sm) !important;
    border: 1px solid var(--tm-border) !important;
    box-shadow: var(--tm-shadow-lg) !important;
    margin-top: 4px !important;
}

.ui.dropdown .menu > .item {
    border-radius: 0 !important;
    transition: background var(--tm-transition);
    padding: 0.75rem 1rem !important;
}

.ui.dropdown .menu > .item:hover {
    background: var(--tm-primary-light) !important;
    color: var(--tm-primary) !important;
}

.ui.dropdown .menu > .active.item {
    background: var(--tm-primary-light) !important;
    color: var(--tm-primary) !important;
    font-weight: 600;
}

/* ── Fomantic UI Overrides – Messages (subtle left-accent style) ── */
.ui.message {
    border-radius: var(--tm-radius-sm) !important;
    box-shadow: none;
    border: 1px solid var(--tm-border);
    font-size: 0.9rem;
}

.ui.info.message {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: var(--tm-text-secondary) !important;
    border-left: 3px solid var(--tm-accent) !important;
}

.ui.negative.message,
.ui.error.message {
    background: #fef8f8 !important;
    border-color: #fde8e8 !important;
    color: #991b1b !important;
    border-left: 3px solid var(--tm-danger) !important;
}

.ui.positive.message,
.ui.success.message {
    background: #f8fdf9 !important;
    border-color: #e0f5e4 !important;
    color: #166534 !important;
    border-left: 3px solid var(--tm-success) !important;
}

.ui.warning.message {
    background: #fefcf5 !important;
    border-color: #fdf0d0 !important;
    color: #92400e !important;
    border-left: 3px solid var(--tm-warning) !important;
}

/* ── Fomantic UI Overrides – Labels ───────────────────────── */
.ui.label {
    border-radius: 6px !important;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.ui.green.label {
    background: #dcfce7 !important;
    color: #166534 !important;
    border: none !important;
}

.ui.red.label {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border: none !important;
}

.ui.blue.label {
    background: var(--tm-primary-light) !important;
    color: #3730a3 !important;
    border: none !important;
}

.ui.yellow.label {
    background: #fef9c3 !important;
    color: #854d0e !important;
    border: none !important;
}

/* ── Fomantic UI Overrides – Modals ───────────────────────── */
.ui.modal {
    border-radius: var(--tm-radius-lg) !important;
    box-shadow: var(--tm-shadow-xl) !important;
    border: 1px solid var(--tm-border);
}

.ui.modal > .header {
    border-radius: var(--tm-radius-lg) var(--tm-radius-lg) 0 0 !important;
    border-bottom: 1px solid var(--tm-border);
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 1.25rem 1.5rem !important;
}

.ui.modal > .content {
    padding: 1.5rem !important;
}

.ui.modal > .actions {
    border-top: 1px solid var(--tm-border);
    border-radius: 0 0 var(--tm-radius-lg) var(--tm-radius-lg) !important;
    padding: 1rem 1.5rem !important;
    background: var(--tm-border-light);
}

/* ── Fomantic UI Overrides – Statistics ───────────────────── */
.ui.statistic > .value {
    font-weight: 800 !important;
    letter-spacing: -0.03em;
    color: var(--tm-text);
}

.ui.statistic > .label {
    color: var(--tm-text-muted) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
}

.ui.red.statistic > .value {
    color: var(--tm-danger) !important;
}

.ui.yellow.statistic > .value {
    color: var(--tm-warning) !important;
}

.ui.blue.statistic > .value {
    color: var(--tm-primary) !important;
}

.ui.green.statistic > .value {
    color: var(--tm-success) !important;
}

/* ── Fomantic UI Overrides – Dividers ─────────────────────── */
.ui.divider {
    border-top-color: var(--tm-border) !important;
}

/* ── Fomantic UI Overrides – Menu (in content) ────────────── */
.ui.menu {
    border-radius: var(--tm-radius-sm) !important;
}

.ui.pagination.menu .item {
    border-radius: var(--tm-radius-sm) !important;
    transition: all var(--tm-transition);
}

.ui.pagination.menu .active.item {
    background: var(--tm-primary) !important;
    color: white !important;
    border-radius: var(--tm-radius-sm) !important;
}

/* ── Login Page ───────────────────────────────────────────── */
.tm-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 70%, #4338ca 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Decorative gradient orbs */
.tm-login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.tm-login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    pointer-events: none;
}

.tm-login-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.tm-login-grid {
    height: 100%;
}

.tm-login-column {
    max-width: 440px !important;
}

.tm-login-header {
    text-align: center;
    margin-bottom: 2.5rem;
    color: #fff;
}

.tm-login-header i.icon {
    font-size: 3.5rem !important;
    margin-bottom: 1rem;
    opacity: 0.9;
    background: linear-gradient(135deg, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tm-login-header h1 {
    font-size: 2rem;
    font-weight: 300;
    margin: 0;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #e0e7ff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tm-login-page .ui.stacked.segment {
    padding: 2.25rem;
    border-radius: var(--tm-radius-lg) var(--tm-radius-lg) 0 0 !important;
    box-shadow: var(--tm-shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    margin-bottom: 0;
}

.tm-login-page .ui.form .field {
    margin-bottom: 1.25rem;
}

.tm-login-page .ui.form .ui.button {
    margin-top: 0.75rem;
    height: 48px;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--tm-primary) 0%, #7c3aed 100%) !important;
    border: none;
}

.tm-login-page .ui.form .ui.button:hover {
    background: linear-gradient(135deg, var(--tm-primary-hover) 0%, #6d28d9 100%) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.tm-login-page .ui.attached.message {
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--tm-text-muted) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-top: 1px solid var(--tm-border) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
    text-align: center;
    border-radius: 0 0 var(--tm-radius-lg) var(--tm-radius-lg) !important;
    backdrop-filter: blur(20px);
    font-size: 0.9rem;
}

.tm-login-page .ui.attached.message i.icon {
    opacity: 0.7;
}

/* ── Error UI ─────────────────────────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

#blazor-error-ui .ui.message {
    margin: 0;
    border-radius: 0;
}

#blazor-error-ui[style] {
    display: block;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: var(--tm-danger);
    padding: 1rem 1.5rem;
    color: white;
    margin: 1rem;
    border-radius: var(--tm-radius-md);
    font-weight: 500;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── Focus Styles ─────────────────────────────────────────── */
h1:focus {
    outline: none;
}

/* ── Validation Styles ────────────────────────────────────── */
.field.error input,
.field.error textarea,
.field.error select {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
    color: #991b1b !important;
}

.field.error input:focus,
.field.error textarea:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* Field validation error prompts */
.ui.form .field.error .ui.prompt.label,
.ui.form .field .validation-message {
    background: transparent !important;
    border: none !important;
    color: var(--tm-danger) !important;
    font-size: 0.825rem;
    font-weight: 500;
    padding: 0.35rem 0 0 0;
    box-shadow: none !important;
}

/* ── Error Boundary Component ─────────────────────────────── */
.tm-error-boundary {
    padding: 1rem;
}

.tm-error-boundary .ui.message {
    max-width: 800px;
    margin: 2rem auto;
}

.tm-error-details {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--tm-border-light);
    border-radius: var(--tm-radius-sm);
    border: 1px solid var(--tm-border);
}

.tm-error-details pre {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: var(--tm-radius-sm);
    font-size: 0.85em;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.tm-error-details details {
    margin-top: 0.5rem;
}

.tm-error-details summary {
    cursor: pointer;
    color: var(--tm-text-muted);
    font-weight: 500;
    transition: color var(--tm-transition);
}

.tm-error-details summary:hover {
    color: var(--tm-text-secondary);
}

.tm-error-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

/* ── Toast Notification Panel ─────────────────────────────── */
.notification-panel,
.notifications {
    position: fixed !important;
    top: calc(var(--tm-header-height) + 1rem) !important;
    right: 1rem !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 1001;
    max-width: 400px;
}

.notification-panel .ui.message,
.notifications .ui.message {
    border-radius: var(--tm-radius-sm) !important;
    box-shadow: var(--tm-shadow-lg) !important;
    animation: tm-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tm-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ── Loading States ───────────────────────────────────────── */
.tm-loading {
    position: relative;
    min-height: 100px;
}

.tm-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--tm-radius-md);
    backdrop-filter: blur(2px);
}

/* Loading spinner override */
.ui.loader::after {
    border-color: var(--tm-primary) transparent transparent !important;
}

/* ── Utility Classes ──────────────────────────────────────── */
.tm-mt-0 { margin-top: 0 !important; }
.tm-mb-0 { margin-bottom: 0 !important; }
.tm-mt-1 { margin-top: 1rem !important; }
.tm-mb-1 { margin-bottom: 1rem !important; }
.tm-mt-2 { margin-top: 2rem !important; }
.tm-mb-2 { margin-bottom: 2rem !important; }

/* ── Site Switcher (sidebar dark dropdown) ───────────────── */
.tm-sidebar .tm-site-switcher {
    width: 100%;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.9) !important;
    min-height: 2.2rem;
    font-size: 0.85rem !important;
    border-radius: var(--tm-radius-sm) !important;
    width: 100% !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.active.dropdown,
.tm-sidebar .tm-site-switcher .ui.selection.dropdown:focus,
.tm-sidebar .tm-site-switcher .ui.selection.dropdown.active,
.tm-sidebar .tm-site-switcher .ui.selection.dropdown.visible {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .default.text {
    color: rgba(255, 255, 255, 0.45) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .text {
    color: rgba(255, 255, 255, 0.9) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .menu {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .menu > .item {
    color: rgba(255, 255, 255, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .menu > .item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown .menu > .item.active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #ffffff !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown i.dropdown.icon {
    color: rgba(255, 255, 255, 0.5) !important;
}

.tm-sidebar .tm-site-switcher .ui.selection.dropdown input.search {
    color: rgba(255, 255, 255, 0.9) !important;
    background: transparent !important;
}

.tm-sidebar .tm-site-switcher .ui.dropdown.selected,
.tm-sidebar .tm-site-switcher .ui.dropdown .menu .selected.item {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* ── Responsive ───────────────────────────────────────────── */
@media only screen and (max-width: 768px) {
    :root {
        --tm-sidebar-width: 220px;
    }

    .tm-content {
        padding: 1.25rem;
    }

    .tm-header {
        padding: 0 1rem;
    }
}

@media only screen and (max-width: 480px) {
    .tm-sidebar {
        position: fixed;
        left: calc(-1 * var(--tm-sidebar-width));
        z-index: 100;
        transition: left var(--tm-transition-slow);
        box-shadow: none;
    }

    .tm-sidebar.visible {
        left: 0;
        box-shadow: var(--tm-shadow-xl);
    }

    .tm-main {
        width: 100%;
    }

    .tm-content {
        padding: 1rem;
    }
}

/* ── Selection & Highlights ───────────────────────────────── */
::selection {
    background: var(--tm-primary-light);
    color: var(--tm-primary-hover);
}

/* ── Smooth page transitions ──────────────────────────────── */
.tm-content > * {
    animation: tm-fade-in 0.25s ease-out;
}

@keyframes tm-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Public Page (anonymous signature) ───────────────────── */
.tm-public-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 70%, #4338ca 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.tm-public-container {
    width: 100%;
    max-width: 550px;
    position: relative;
    z-index: 1;
}

.tm-public-header {
    text-align: center;
    margin-bottom: 2rem;
    color: #fff;
}

.tm-public-header i.icon {
    font-size: 2.5rem !important;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.tm-public-header h2 {
    font-size: 1.6rem;
    font-weight: 300;
    margin: 0;
    letter-spacing: 0.5px;
    opacity: 0.95;
}

.tm-public-page .ui.segment {
    background: rgba(255, 255, 255, 0.97);
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 2rem;
}

.tm-signature-info {
    margin-bottom: 1.5rem;
}

.tm-signature-info .item {
    padding: 0.4rem 0 !important;
}

.tm-signature-info .header {
    color: #6b7280 !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
}

.tm-signature-info .description {
    font-size: 1rem !important;
    color: #1f2937 !important;
    font-weight: 600 !important;
}

.tm-signature-confirmation {
    text-align: center;
    padding: 2rem 0;
}

.tm-signature-confirmation i.icon {
    font-size: 4rem !important;
    color: #22c55e;
    margin-bottom: 1rem;
}

.tm-signature-confirmation h3 {
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.tm-signature-confirmation p {
    color: #6b7280;
}
