/* ==========================================================================
   DS.TRDepotManager -- Theme & Base Styles
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */

:root {
    --font-size: 16px;
    --background: #fafafa;
    --foreground: #1f1f1f;
    --card: #ffffff;
    --card-foreground: #1f1f1f;
    --popover: #ffffff;
    --popover-foreground: #1f1f1f;
    --primary: #0C5DA6;
    --primary-foreground: #ffffff;
    --secondary: #f5f5f5;
    --secondary-foreground: #1f1f1f;
    --muted: #f0f0f0;
    --muted-foreground: #6b6b6b;
    --accent: #e6f7ff;
    --accent-foreground: #0C5DA6;
    --destructive: #ff4444;
    --destructive-foreground: #ffffff;
    --success: #16a34a;
    --border: #e8e8e8;
    --input: transparent;
    --input-background: #ffffff;
    --font-weight-medium: 500;
    --font-weight-normal: 400;
    --ring: #0C5DA6;
    --radius: 0;
    --sidebar: #333333;
    --sidebar-foreground: #e8e8e8;
    --sidebar-primary: #0C5DA6;
    --sidebar-primary-foreground: #ffffff;
    --sidebar-accent: #3a3a3a;
    --sidebar-accent-foreground: #ffffff;
    --sidebar-border: #444444;
    --sidebar-ring: #0C5DA6;
}

/* ---------- Base styles ---------- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
}

html {
    font-size: var(--font-size);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--background);
}

body.modal-open {
    overflow: hidden;
}

/* Instrument-Info-Modal */
.instrument-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
}

.instrument-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    max-height: 88vh;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.instrument-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.instrument-modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-weight-medium);
}

.instrument-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 1.5rem;
}

/* Hero — Instrument-Name + ISIN/Type */
.instrument-hero {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.instrument-hero-name {
    font-size: 1.25rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
    color: var(--foreground);
}

.instrument-hero-sub {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.instrument-hero-meta {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

/* IsinLink — einheitliche ISIN-Darstellung (Komponente: IsinLink.razor) */
.isin-text {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.85em;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: inherit;
    background: none;
    padding: 0;
    border: 0;
    line-height: inherit;
}

.isin-muted { color: var(--muted-foreground); }

.isin-text-link {
    cursor: pointer;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 2px;
    text-decoration: none;
}

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

.isin-text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.isin-text-link:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
    outline-offset: 2px;
}

.isin-text-icon { opacity: 0.45; transition: opacity 0.15s ease; }
.isin-text-link:hover .isin-text-icon { opacity: 1; }

.instrument-chip {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.125rem 0.5rem;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    border-radius: 999px;
}

/* Sections (z.B. Basiswert) */
.instrument-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.instrument-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.instrument-section-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
    margin-bottom: 0.375rem;
}

.instrument-section-name {
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    margin-bottom: 0.25rem;
}

/* Meta-Line — Footer */
.instrument-meta-line {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Roh-JSON ausklappbar */
.instrument-raw {
    margin-top: 1rem;
    font-size: 0.8125rem;
}

.instrument-raw summary {
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem 0;
    user-select: none;
}

.instrument-raw summary:hover {
    color: var(--foreground);
}

.instrument-raw .raw-json {
    margin-top: 0.5rem;
    max-height: 40vh;
}

h1 { font-size: 1.5rem; font-weight: var(--font-weight-medium); line-height: 1.5; border: none; outline: none; }
h2 { font-size: 1.25rem; font-weight: var(--font-weight-medium); line-height: 1.5; }
h3 { font-size: 1.125rem; font-weight: var(--font-weight-medium); line-height: 1.5; }
h4 { font-size: 1rem; font-weight: var(--font-weight-medium); line-height: 1.5; }

label { font-size: 1rem; font-weight: var(--font-weight-medium); line-height: 1.5; }

button {
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    cursor: pointer;
}

input { font-size: 1rem; font-weight: var(--font-weight-normal); line-height: 1.5; }

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ---------- Shadow utilities ---------- */

.shadow-header    { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.shadow-sidebar   { box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12); }
.shadow-actionbar { box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06); }
.shadow-card      { box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10); }
.shadow-button    { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.shadow-dropdown  { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); }

/* ---------- Layout (globale Grund-Properties) ---------- */

.layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    background-color: var(--sidebar);
    color: var(--sidebar-foreground);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-animating { transition: width 0.2s ease; }
.sidebar-collapsed { width: 64px; }

.header {
    height: 68px;
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
}

.action-bar {
    background-color: var(--card);
    padding: 0.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin-top: 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.10), 0 2px 10px rgba(0, 0, 0, 0.10);
    position: relative;
}

.action-bar-loader {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: color-mix(in srgb, var(--primary) 15%, transparent);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.action-bar-loader.active { opacity: 1; }

.action-bar-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background-color: var(--primary);
    animation: actionbar-loading 1.2s ease-in-out infinite;
}

@keyframes actionbar-loading {
    0%   { left: -40%; }
    100% { left: 100%; }
}

.content-area {
    flex: 1;
    overflow-y: auto;
    width: 100%;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    border-radius: 9999px;
    white-space: nowrap;
}

.badge-success  { background-color: #dcfce7; color: #166534; }
.badge-pending  { background-color: #fef9c3; color: #854d0e; }
.badge-error    { background-color: #fee2e2; color: #991b1b; }
.badge-muted    { background-color: var(--muted); color: var(--muted-foreground); }

/* Asset-Art (Aktie/Derivat/...) */
.asset-type-badge {
    background-color: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge-danger   { background-color: #fee2e2; color: #991b1b; }

/* ---------- Tables ---------- */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th {
    text-align: left;
    padding: 0.625rem 0.75rem;
    font-weight: var(--font-weight-medium);
    color: var(--muted-foreground);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:nth-child(odd)  { background-color: var(--background); }
.data-table tbody tr:nth-child(even) { background-color: var(--card); }
.data-table tbody tr:hover           { background-color: var(--muted); }

/* ---------- Cards ---------- */

.card {
    background-color: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.10);
    width: 100%;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: var(--font-weight-medium);
}

.card-body {
    padding: 1rem 1.25rem;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.btn:hover { background-color: var(--muted); text-decoration: none; }

.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: #0a4f8f;
    border-color: #0a4f8f;
}

.btn-secondary {
    background-color: var(--card);
    color: var(--foreground);
    border-color: var(--border);
}

.btn-secondary:hover { background-color: var(--muted); }

.btn-danger {
    background-color: var(--destructive);
    color: var(--destructive-foreground);
    border-color: var(--destructive);
}

.btn-danger:hover {
    background-color: #e03030;
    border-color: #e03030;
}

/* ---------- Account-Form (Passwort/Restore) ---------- */
.pw-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 420px; }
.pw-row { display: flex; flex-direction: column; gap: 0.25rem; }
.pw-label { font-size: 0.8125rem; color: var(--muted-foreground); }

/* ---------- Forms ---------- */

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--input-background);
    color: var(--foreground);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(12, 93, 166, 0.15);
}

.form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--input-background);
    color: var(--foreground);
    outline: none;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px rgba(12, 93, 166, 0.15);
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.pagination-btn:hover { background-color: var(--muted); }

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn-active {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.pagination-btn-active:hover { background-color: #0a4f8f; }

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ---------- Navigation ---------- */

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    height: 40px;
    font-size: 0.875rem;
    color: var(--sidebar-foreground);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background-color 0.15s ease;
}

.nav-link:hover {
    background-color: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
    text-decoration: none;
}

.nav-link-active, .nav-link.active {
    background-color: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}

.nav-link-active:hover, .nav-link.active:hover {
    background-color: var(--sidebar-accent);
    color: var(--sidebar-accent-foreground);
}

/* ---------- Icon sizes ---------- */

.icon-xs { width: 12px; height: 12px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-md { width: 20px; height: 20px; flex-shrink: 0; }
.icon-lg { width: 24px; height: 24px; flex-shrink: 0; }

/* ---------- Data-Table (gemeinsam fuer Transactions/Activities/Documents) ---------- */

.data-table thead th { vertical-align: top; }
.data-table thead th > * { display: block; }
.data-table { table-layout: fixed; }

.th-label {
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

.sortable {
    cursor: pointer;
    user-select: none;
    display: inline-flex !important;
    align-items: center;
}

.sortable:hover { color: var(--primary); }

.th-sorted .th-label {
    color: var(--primary);
    font-weight: 600;
}

.icon-sort {
    width: 12px;
    height: 12px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.icon-sort-inactive { opacity: 0.25; }
.sortable:hover .icon-sort-inactive { opacity: 0.5; }

.th-filter-input {
    width: 100%;
    min-width: 0;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--border) 100%, #000 10%);
    background-color: var(--card);
    outline: none;
    font-family: inherit;
}

.th-filter-input::placeholder { color: #c0c0c0; }
.th-filter-input:focus { border-color: var(--primary); }

.th-filter-input.is-active,
.th-filter-select.is-active {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 5%, var(--card));
}

.th-filter-select {
    width: 100%;
    min-width: 0;
    padding: 0.375rem 1.5rem 0.375rem 0.5rem;
    font-size: 0.8125rem;
    height: 34px;
    box-sizing: border-box;
    border: 1px solid color-mix(in srgb, var(--border) 100%, #000 10%);
    background-color: var(--card);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.375rem center;
    background-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.th-filter-select:focus { border-color: var(--primary); }
.th-filter-select.is-placeholder { color: #c0c0c0; }
.th-filter-select option { color: var(--foreground); }

.data-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clickable-row { cursor: pointer; }

.cell-date {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.asset-with-icon {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.asset-text {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.asset-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-subtitle {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
}

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-foreground);
}

.page-size-select {
    width: auto;
    min-width: 60px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    color: var(--muted-foreground);
}

/* ---------- Utilities ---------- */

.text-muted     { color: var(--muted-foreground); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--destructive); }
.text-sm        { font-size: 0.875rem; }
.text-xs        { font-size: 0.75rem; }
.text-right     { text-align: right; }
.text-center    { text-align: center; }
.text-destructive { color: var(--destructive); }

/* Asset-Icon (Komponente AssetIcon) — Standard 32x32, Detail-Variante 64x64 */
.asset-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 0;
    background: var(--muted);
    padding: 2px;
}

/* Letter-Fallback: gleicher Look wie die geladenen Icons,
   aber mit Gradient + Inset-Schatten fuer Tiefe. */
.asset-icon-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--primary) 22%, var(--card)) 0%,
            color-mix(in srgb, var(--primary) 8%, var(--card)) 100%);
    color: color-mix(in srgb, var(--primary) 85%, var(--foreground));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent),
        inset 0 -1px 1px color-mix(in srgb, var(--primary) 8%, transparent);
    letter-spacing: 0.02em;
    line-height: 1;
}

/* Login-Pages (Login + SetFallback) — vorher scoped in Login.razor.css,
   was SetFallback unformatiert liess. */
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-header p {
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.remember-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    cursor: pointer;
}

.remember-phone input[type="checkbox"] {
    margin: 0;
}

.tan-input {
    text-align: center;
    font-size: 28px;
    letter-spacing: 12px;
    font-weight: 600;
}

/* Spacing-Utilities (global; vorher pro Page scoped) */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 2.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ---------- PDF/TR-Login Modal ---------- */

.pdf-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
}

.pdf-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 92vw);
    height: min(900px, 88vh);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 101;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.pdf-modal-title {
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-modal-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pdf-modal-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pdf-modal-body .pdf-viewer {
    flex: 1 1 0;
    min-height: 0;
    border: none;
}

.tr-login-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 101;
    display: flex;
    flex-direction: column;
}

.tr-login-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
}

.tr-login-modal-body {
    padding: 1.5rem;
}

.tr-login-info {
    background: var(--muted);
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--primary);
}

.tr-login-info .mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    margin-top: 0.25rem;
}

.tan-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0.75rem;
    font-weight: 600;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.alert {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 1px solid;
}

.alert-error {
    border-color: var(--destructive);
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-info {
    border-color: var(--primary);
    background-color: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
}

.alert-success {
    border-color: var(--success, #16a34a);
    background-color: #dcfce7;
    color: #166534;
}

.alert-warning {
    border-color: #d97706;
    background-color: #fef3c7;
    color: #92400e;
}

.btn-danger {
    background-color: var(--destructive);
    color: #fff;
    border-color: var(--destructive);
}

.btn-danger:hover {
    background-color: #991b1b;
    border-color: #991b1b;
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
}

.form-input-lg {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

/* ---------- Login page ---------- */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--sidebar);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.login-title {
    text-align: center;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.login-field      { margin-bottom: 1rem; }
.login-btn        { width: 100%; margin-top: 0.5rem; }

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background-color: #fee2e2;
    color: #991b1b;
    font-size: 0.875rem;
    border-radius: var(--radius);
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--sidebar-foreground);
    opacity: 0.5;
    line-height: 1.6;
}

/* ---------- Animations ---------- */

.spin { animation: spin 0.8s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ---------- Blazor ReconnectModal ---------- */

.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible {
    display: block;
}

#components-reconnect-modal:not([open]) { display: none; }

#components-reconnect-modal {
    background-color: white;
    width: 20rem;
    margin: 20vh auto;
    padding: 2rem;
    border: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    color: var(--foreground);
    font-size: 0.875rem;
}

#components-reconnect-modal::backdrop { background-color: rgba(0, 0, 0, 0.4); }

.components-reconnect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#components-reconnect-modal p       { margin: 0; text-align: center; }

#components-reconnect-modal button {
    border: 0;
    background-color: var(--primary);
    color: var(--primary-foreground);
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
}

#components-reconnect-modal button:hover { background-color: #0a4f8f; }

.components-rejoining-animation { position: relative; width: 60px; height: 60px; }

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid var(--primary);
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) { animation-delay: -0.5s; }

@keyframes components-rejoining-animation {
    0%, 4.9%  { top: 30px; left: 30px; width: 0;    height: 0;    opacity: 0; }
    5%        { top: 30px; left: 30px; width: 0;    height: 0;    opacity: 1; }
    100%      { top: 0;    left: 0;    width: 60px; height: 60px; opacity: 0; }
}

/* ---------- Blazor-specific ---------- */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--destructive);
    padding: 1rem;
    color: white;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid                              { outline: 1px solid var(--destructive); }
.validation-message                   { color: var(--destructive); font-size: 0.875rem; }
