/* ===== Buttons ===== */
.t-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--t-space-2);
    height: 36px;
    padding: 0 var(--t-space-4);
    border-radius: var(--t-radius-md);
    border: 1px solid var(--t-border-standard);
    background: var(--t-bg-surface);
    color: var(--t-text-primary);
    font-size: 14px;
    font-weight: 510;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.t-button:hover { background: var(--t-bg-surface-hover); }
.t-button:focus-visible { outline: none; box-shadow: var(--t-shadow-focus); }
.t-button:disabled { opacity: .5; cursor: not-allowed; }

.t-button--ghost { background: transparent; }
.t-button--ghost:hover { background: var(--t-bg-surface-hover); }

.t-button--subtle {
    background: var(--t-bg-surface-alt);
    border-color: transparent;
}

.t-button--primary {
    background: var(--t-accent);
    color: var(--t-text-on-accent);
    border-color: transparent;
}
.t-button--primary:hover { background: var(--t-accent-hover); }

.t-button--danger {
    background: var(--t-danger);
    color: #fff;
    border-color: transparent;
}
.t-button--danger:hover { background: var(--t-danger-hover); }

.t-button--icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
}

.t-button--pill {
    height: 28px;
    padding: 0 12px;
    border-radius: var(--t-radius-pill);
    font-size: 12px;
}

.t-button--sm { height: 30px; padding: 0 12px; font-size: 13px; }
.t-button--lg { height: 42px; padding: 0 18px; font-size: 15px; }

.t-button__spinner {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    animation: t-spin .7s linear infinite;
}
@keyframes t-spin { to { transform: rotate(360deg); } }

/* ===== Cards ===== */
.t-card {
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    border-radius: var(--t-radius-lg);
    box-shadow: var(--t-shadow-sm);
    overflow: hidden;
}
.t-card__header {
    padding: var(--t-space-4) var(--t-space-5);
    border-bottom: 1px solid var(--t-border-subtle);
}
.t-card__title { margin: 0; font-size: 16px; font-weight: 590; letter-spacing: -0.2px; }
.t-card__subtitle { margin: var(--t-space-1) 0 0; font-size: 13px; color: var(--t-text-tertiary); }
.t-card__body { padding: var(--t-space-5); }
.t-card__footer {
    padding: var(--t-space-3) var(--t-space-5);
    border-top: 1px solid var(--t-border-subtle);
    display: flex;
    gap: var(--t-space-2);
    justify-content: flex-end;
    background: var(--t-bg-surface-alt);
}

/* ===== Fields ===== */
.t-field { display: flex; flex-direction: column; gap: var(--t-space-1); margin-bottom: var(--t-space-3); }
.t-field__label { font-size: 13px; font-weight: 510; color: var(--t-text-secondary); }
.t-field__input {
    height: 38px;
    padding: 0 var(--t-space-3);
    border-radius: var(--t-radius-md);
    border: 1px solid var(--t-border-standard);
    background: var(--t-bg-surface);
    color: var(--t-text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.t-field__input::placeholder { color: var(--t-text-quaternary); }
.t-field__input:focus { outline: none; border-color: var(--t-accent); box-shadow: var(--t-shadow-focus); }
.t-field__input:disabled { background: var(--t-bg-surface-alt); color: var(--t-text-tertiary); cursor: not-allowed; }
.t-field__hint { font-size: 12px; color: var(--t-text-tertiary); }
.t-field__error { font-size: 12px; color: var(--t-danger); }
.t-field.is-error .t-field__input { border-color: var(--t-danger); }

/* ===== Form ===== */
.t-form { display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-form__submit { margin-top: var(--t-space-3); }

/* ===== Pills & Badges ===== */
.t-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 10px;
    border-radius: var(--t-radius-pill);
    font-size: 12px;
    font-weight: 510;
    border: 1px solid var(--t-border-standard);
    color: var(--t-text-secondary);
    background: transparent;
}
.t-pill--accent { background: var(--t-accent-soft); color: var(--t-accent); border-color: transparent; }
.t-pill--success { background: var(--t-success-soft); color: var(--t-success); border-color: transparent; }
.t-pill--warning { background: var(--t-warning-soft); color: var(--t-warning); border-color: transparent; }
.t-pill--danger { background: var(--t-danger-soft); color: var(--t-danger); border-color: transparent; }

.t-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    height: 18px;
    border-radius: var(--t-radius-xs);
    font-size: 10px;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--t-bg-surface-alt);
    color: var(--t-text-secondary);
}
.t-badge--accent { background: var(--t-accent-soft); color: var(--t-accent); }
.t-badge--success { background: var(--t-success-soft); color: var(--t-success); }
.t-badge--warning { background: var(--t-warning-soft); color: var(--t-warning); }
.t-badge--danger { background: var(--t-danger-soft); color: var(--t-danger); }

/* ===== Theme toggle ===== */
.t-theme-toggle {
    display: inline-flex;
    border: 1px solid var(--t-border-standard);
    border-radius: var(--t-radius-md);
    padding: 2px;
    background: var(--t-bg-surface);
}
.t-theme-toggle__btn {
    width: 28px; height: 26px;
    border: 0;
    background: transparent;
    color: var(--t-text-tertiary);
    border-radius: var(--t-radius-sm);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.t-theme-toggle__btn:hover { color: var(--t-text-primary); }
.t-theme-toggle__btn.is-active {
    background: var(--t-accent-soft);
    color: var(--t-accent);
}

/* ===== Dialog ===== */
.t-dialog__backdrop {
    position: fixed; inset: 0;
    background: var(--t-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--t-space-4);
    animation: t-fade-in .12s ease;
    /* The backdrop itself never scrolls — it provides the bounding box for the dialog. */
    overflow: hidden;
}
.t-dialog {
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    border-radius: var(--t-radius-xl);
    box-shadow: var(--t-shadow-lg);
    width: 100%;
    max-width: 440px;
    /* Cap dialog height so footer (action buttons) stays inside viewport even with long forms.
       The backdrop's padding (var(--t-space-4) on each side) is already accounted for by the parent;
       the calc here leaves a small extra safety margin. */
    max-height: calc(100vh - var(--t-space-6));
    overflow: hidden;
    animation: t-pop-in .15s ease;
    /* Stack header / body / footer so the body can take the remaining height and scroll. */
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.t-dialog--sm { max-width: 380px; }
.t-dialog--md { max-width: 520px; }
.t-dialog--lg { max-width: 760px; }
.t-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--t-space-4) var(--t-space-5);
    border-bottom: 1px solid var(--t-border-subtle);
    /* Header stays anchored at the top. */
    flex: 0 0 auto;
}
.t-dialog__title { margin: 0; font-size: 16px; font-weight: 590; }
.t-dialog__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 22px; line-height: 1;
    padding: 4px 8px; border-radius: var(--t-radius-sm);
}
.t-dialog__close:hover { background: var(--t-bg-surface-hover); color: var(--t-text-primary); }
.t-dialog__body {
    padding: var(--t-space-5);
    /* Body takes remaining height and scrolls when content overflows. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.t-dialog__footer {
    padding: var(--t-space-3) var(--t-space-5);
    display: flex; justify-content: flex-end; gap: var(--t-space-2);
    border-top: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface-alt);
    /* Footer stays anchored at the bottom — the user always sees the action buttons. */
    flex: 0 0 auto;
}
.t-confirm__message { color: var(--t-text-secondary); margin: 0; }
@keyframes t-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes t-pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Stat ===== */
.t-stat {
    display: flex;
    flex-direction: column;
    gap: var(--t-space-1);
    padding: var(--t-space-4) var(--t-space-5);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    border-radius: var(--t-radius-lg);
    box-shadow: var(--t-shadow-sm);
    min-height: 96px;
}
.t-stat__label {
    font-size: 12px;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--t-text-tertiary);
}
.t-stat__value {
    font-size: 28px;
    font-weight: 590;
    letter-spacing: -0.6px;
    color: var(--t-text-primary);
    line-height: 1.1;
}
.t-stat__hint { font-size: 12px; color: var(--t-text-quaternary); }
.t-stat__skeleton {
    display: inline-block;
    width: 64px;
    height: 24px;
    background: linear-gradient(90deg, var(--t-bg-surface-alt), var(--t-bg-surface-hover), var(--t-bg-surface-alt));
    background-size: 200% 100%;
    animation: t-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--t-radius-sm);
    vertical-align: middle;
}
.t-stat__error { color: var(--t-text-quaternary); cursor: help; }
.t-stat--accent .t-stat__value { color: var(--t-accent); }
.t-stat--success .t-stat__value { color: var(--t-success); }
.t-stat--warning .t-stat__value { color: var(--t-warning); }
.t-stat--danger .t-stat__value { color: var(--t-danger); }
@keyframes t-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ===== Upcoming list ===== */
.t-upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.t-upcoming__row {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--t-space-3) 0;
    border-bottom: 1px solid var(--t-border-subtle);
    gap: var(--t-space-3);
}
.t-upcoming__row:last-child { border-bottom: 0; }
.t-upcoming__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.t-upcoming__title {
    font-size: 14px; font-weight: 510; color: var(--t-text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-upcoming__sub { font-size: 12px; color: var(--t-text-tertiary); }

/* ===== Toolbar ===== */
.t-toolbar { display: flex; align-items: flex-end; gap: var(--t-space-3); flex-wrap: wrap; }
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }
.t-toolbar__date { margin-bottom: 0; min-width: 140px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-table thead th {
    text-align: left; font-size: 12px; font-weight: 510;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3); border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary); vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }
.t-alert-reason { white-space: pre-wrap; word-break: break-word; max-width: 360px; color: var(--t-text-secondary); }

/* ===== Custom-fields template builder ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3); align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary); padding-bottom: 8px;
}

/* ===== Read-only template fields list ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image ===== */
.t-equipment-image { display: flex; align-items: center; gap: var(--t-space-3); margin-bottom: var(--t-space-2); }
.t-equipment-image img {
    width: 96px; height: 96px; object-fit: cover;
    border-radius: var(--t-radius-md); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px; object-fit: cover;
    border-radius: var(--t-radius-sm); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt); display: grid; place-items: center;
    color: var(--t-text-quaternary); font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Stage editor (template builder) ===== */
.t-stage-editor {
    display: flex; flex-direction: column; gap: var(--t-space-2);
    padding: var(--t-space-3);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
}
.t-stage__row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(180px, 1fr) auto;
    gap: var(--t-space-2); align-items: center;
}
.t-stage__title { margin-bottom: 0; }
.t-stage__group { margin-bottom: 0; }
.t-stage__actions { display: flex; gap: var(--t-space-1); }
.t-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); margin-top: var(--t-space-1); }
@media (max-width: 720px) {
    .t-stage__row { grid-template-columns: 1fr; }
    .t-stage__actions { justify-content: flex-end; }
}

/* ===== Rule condition row ===== */
.t-condition {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) minmax(150px, 1fr) minmax(140px, 1.4fr) auto;
    gap: var(--t-space-2); align-items: center;
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-condition__field { margin-bottom: 0; }
.t-condition__op { margin-bottom: 0; }
.t-condition__value { margin-bottom: 0; }
.t-condition__value .t-field__input { margin-bottom: 0; }
@media (max-width: 720px) {
    .t-condition { grid-template-columns: 1fr; }
}

/* ===== Maintenance report viewer ===== */
.t-report { display: flex; flex-direction: column; gap: var(--t-space-5); }
.t-report__meta {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: var(--t-space-2) var(--t-space-4);
    margin: 0;
}
.t-report__meta dt { font-size: 12px; color: var(--t-text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.t-report__meta dd { margin: 0; color: var(--t-text-primary); font-size: 14px; }

.t-report__section { display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-report__section-title {
    margin: 0;
    font-size: 13px; font-weight: 510; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
}
.t-report__comment {
    margin: 0;
    padding: var(--t-space-3) var(--t-space-4);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    color: var(--t-text-secondary);
    white-space: pre-wrap;
}

.t-report-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2) var(--t-space-3);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    margin-bottom: var(--t-space-2);
}
.t-report-stage__row { display: flex; align-items: center; gap: var(--t-space-2); }
.t-report-stage__check {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--t-bg-surface-alt);
    color: var(--t-success);
    font-size: 14px;
}
.t-report-stage__title { flex: 1; font-size: 14px; color: var(--t-text-primary); }
.t-report-stage__components {
    list-style: none; margin: 0; padding: 0 0 0 var(--t-space-6);
    display: flex; flex-direction: column; gap: var(--t-space-1);
    font-size: 13px;
}
.t-report-stage__component-title { color: var(--t-text-secondary); }
.t-report-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); }

.t-report__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--t-space-2);
}
.t-report__gallery-item {
    display: block;
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    overflow: hidden;
}
.t-report__gallery-item img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

/* ===== Profile page ===== */
.t-profile__grid { align-items: start; }
.t-profile__actions { display: flex; flex-direction: column; gap: var(--t-space-3); }
.t-profile__logout-form { margin: 0; }

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed; bottom: var(--t-space-5); right: var(--t-space-5);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    z-index: 1100; max-width: 360px;
}
.t-toast {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary); font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }ce: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-upcoming__sub { font-size: 12px; color: var(--t-text-tertiary); }

/* ===== Toolbar ===== */
.t-toolbar { display: flex; align-items: flex-end; gap: var(--t-space-3); flex-wrap: wrap; }
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }
.t-toolbar__date { margin-bottom: 0; min-width: 140px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-table thead th {
    text-align: left; font-size: 12px; font-weight: 510;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3); border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary); vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }
.t-alert-reason { white-space: pre-wrap; word-break: break-word; max-width: 360px; color: var(--t-text-secondary); }

/* ===== Custom-fields template builder ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3); align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary); padding-bottom: 8px;
}

/* ===== Read-only template fields list ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image ===== */
.t-equipment-image { display: flex; align-items: center; gap: var(--t-space-3); margin-bottom: var(--t-space-2); }
.t-equipment-image img {
    width: 96px; height: 96px; object-fit: cover;
    border-radius: var(--t-radius-md); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px; object-fit: cover;
    border-radius: var(--t-radius-sm); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt); display: grid; place-items: center;
    color: var(--t-text-quaternary); font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Stage editor (template builder) ===== */
.t-stage-editor {
    display: flex; flex-direction: column; gap: var(--t-space-2);
    padding: var(--t-space-3);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
}
.t-stage__row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(180px, 1fr) auto;
    gap: var(--t-space-2); align-items: center;
}
.t-stage__title { margin-bottom: 0; }
.t-stage__group { margin-bottom: 0; }
.t-stage__actions { display: flex; gap: var(--t-space-1); }
.t-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); margin-top: var(--t-space-1); }
@media (max-width: 720px) {
    .t-stage__row { grid-template-columns: 1fr; }
    .t-stage__actions { justify-content: flex-end; }
}

/* ===== Rule condition row ===== */
.t-condition {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) minmax(150px, 1fr) minmax(140px, 1.4fr) auto;
    gap: var(--t-space-2); align-items: center;
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-condition__field { margin-bottom: 0; }
.t-condition__op { margin-bottom: 0; }
.t-condition__value { margin-bottom: 0; }
.t-condition__value .t-field__input { margin-bottom: 0; }
@media (max-width: 720px) {
    .t-condition { grid-template-columns: 1fr; }
}

/* ===== Maintenance report viewer ===== */
.t-report { display: flex; flex-direction: column; gap: var(--t-space-5); }
.t-report__meta {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: var(--t-space-2) var(--t-space-4);
    margin: 0;
}
.t-report__meta dt { font-size: 12px; color: var(--t-text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.t-report__meta dd { margin: 0; color: var(--t-text-primary); font-size: 14px; }

.t-report__section { display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-report__section-title {
    margin: 0;
    font-size: 13px; font-weight: 510; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
}
.t-report__comment {
    margin: 0;
    padding: var(--t-space-3) var(--t-space-4);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    color: var(--t-text-secondary);
    white-space: pre-wrap;
}

.t-report-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2) var(--t-space-3);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    margin-bottom: var(--t-space-2);
}
.t-report-stage__row { display: flex; align-items: center; gap: var(--t-space-2); }
.t-report-stage__check {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--t-bg-surface-alt);
    color: var(--t-success);
    font-size: 14px;
}
.t-report-stage__title { flex: 1; font-size: 14px; color: var(--t-text-primary); }
.t-report-stage__components {
    list-style: none; margin: 0; padding: 0 0 0 var(--t-space-6);
    display: flex; flex-direction: column; gap: var(--t-space-1);
    font-size: 13px;
}
.t-report-stage__component-title { color: var(--t-text-secondary); }
.t-report-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); }

.t-report__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--t-space-2);
}
.t-report__gallery-item {
    display: block;
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    overflow: hidden;
}
.t-report__gallery-item img {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed; bottom: var(--t-space-5); right: var(--t-space-5);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    z-index: 1100; max-width: 360px;
}
.t-toast {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary); font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }ce: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-upcoming__sub { font-size: 12px; color: var(--t-text-tertiary); }

/* ===== Toolbar ===== */
.t-toolbar { display: flex; align-items: flex-end; gap: var(--t-space-3); flex-wrap: wrap; }
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-table thead th {
    text-align: left; font-size: 12px; font-weight: 510;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3); border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary); vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }
.t-alert-reason { white-space: pre-wrap; word-break: break-word; max-width: 360px; color: var(--t-text-secondary); }

/* ===== Custom-fields template builder ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3); align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary); padding-bottom: 8px;
}

/* ===== Read-only template fields list ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image ===== */
.t-equipment-image { display: flex; align-items: center; gap: var(--t-space-3); margin-bottom: var(--t-space-2); }
.t-equipment-image img {
    width: 96px; height: 96px; object-fit: cover;
    border-radius: var(--t-radius-md); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px; object-fit: cover;
    border-radius: var(--t-radius-sm); border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt); display: grid; place-items: center;
    color: var(--t-text-quaternary); font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Stage editor ===== */
.t-stage-editor {
    display: flex; flex-direction: column; gap: var(--t-space-2);
    padding: var(--t-space-3);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
}
.t-stage__row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(180px, 1fr) auto;
    gap: var(--t-space-2); align-items: center;
}
.t-stage__title { margin-bottom: 0; }
.t-stage__group { margin-bottom: 0; }
.t-stage__actions { display: flex; gap: var(--t-space-1); }
.t-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); margin-top: var(--t-space-1); }
@media (max-width: 720px) {
    .t-stage__row { grid-template-columns: 1fr; }
    .t-stage__actions { justify-content: flex-end; }
}

/* ===== Rule condition row ===== */
.t-condition {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) minmax(150px, 1fr) minmax(140px, 1.4fr) auto;
    gap: var(--t-space-2); align-items: center;
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle); border-radius: var(--t-radius-md);
}
.t-condition__field { margin-bottom: 0; }
.t-condition__op { margin-bottom: 0; }
.t-condition__value { margin-bottom: 0; }
.t-condition__value .t-field__input { margin-bottom: 0; }
@media (max-width: 720px) {
    .t-condition { grid-template-columns: 1fr; }
}

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed; bottom: var(--t-space-5); right: var(--t-space-5);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    z-index: 1100; max-width: 360px;
}
.t-toast {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary); font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }ce: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.t-upcoming__sub { font-size: 12px; color: var(--t-text-tertiary); }

/* ===== Toolbar ===== */
.t-toolbar {
    display: flex; align-items: flex-end; gap: var(--t-space-3);
    flex-wrap: wrap;
}
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-table thead th {
    text-align: left;
    font-size: 12px; font-weight: 510;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary);
    vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }

/* ===== Custom-fields template builder ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3);
    align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary);
    padding-bottom: 8px;
}

/* ===== Read-only template fields list ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image ===== */
.t-equipment-image {
    display: flex; align-items: center; gap: var(--t-space-3);
    margin-bottom: var(--t-space-2);
}
.t-equipment-image img {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: var(--t-radius-md);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: var(--t-radius-sm);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt);
    display: grid; place-items: center;
    color: var(--t-text-quaternary);
    font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle (boolean field) ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Stage editor (template builder) ===== */
.t-stage-editor {
    display: flex; flex-direction: column; gap: var(--t-space-2);
    padding: var(--t-space-3);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
}
.t-stage {
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
}
.t-stage__row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(180px, 1fr) auto;
    gap: var(--t-space-2);
    align-items: center;
}
.t-stage__title { margin-bottom: 0; }
.t-stage__group { margin-bottom: 0; }
.t-stage__actions { display: flex; gap: var(--t-space-1); }
.t-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); margin-top: var(--t-space-1); }
@media (max-width: 720px) {
    .t-stage__row { grid-template-columns: 1fr; }
    .t-stage__actions { justify-content: flex-end; }
}

/* ===== Rule condition row (rule builder) ===== */
.t-condition {
    display: grid;
    grid-template-columns: minmax(180px, 1.6fr) minmax(150px, 1fr) minmax(140px, 1.4fr) auto;
    gap: var(--t-space-2);
    align-items: center;
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
}
.t-condition__field { margin-bottom: 0; }
.t-condition__op { margin-bottom: 0; }
.t-condition__value { margin-bottom: 0; }
.t-condition__value .t-field__input { margin-bottom: 0; }
@media (max-width: 720px) {
    .t-condition { grid-template-columns: 1fr; }
}

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed;
    bottom: var(--t-space-5);
    right: var(--t-space-5);
    display: flex; flex-direction: column; gap: var(--t-space-2);
    z-index: 1100;
    max-width: 360px;
}
.t-toast {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary);
    font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }
.t-upcoming__sub { font-size: 12px; color: var(--t-text-tertiary); }

/* ===== Toolbar ===== */
.t-toolbar {
    display: flex; align-items: flex-end; gap: var(--t-space-3);
    flex-wrap: wrap;
}
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.t-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary);
    vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }

/* ===== Custom-fields template builder (group create dialog) ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3);
    align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary);
    padding-bottom: 8px;
}

/* ===== Read-only list of custom fields (template view) ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image preview / thumbnail ===== */
.t-equipment-image {
    display: flex; align-items: center; gap: var(--t-space-3);
    margin-bottom: var(--t-space-2);
}
.t-equipment-image img {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: var(--t-radius-md);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: var(--t-radius-sm);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt);
    display: grid; place-items: center;
    color: var(--t-text-quaternary);
    font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle (boolean field) ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Stage editor (maintenance template builder) ===== */
.t-stage-editor {
    display: flex; flex-direction: column; gap: var(--t-space-2);
    padding: var(--t-space-3);
    background: var(--t-bg-surface-alt);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
}
.t-stage {
    /* Indent each nesting level visually. The depth comes from the StageEditor render. */
    margin-left: calc(var(--stage-depth, 0) * 16px);
    padding: var(--t-space-2);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    display: flex; flex-direction: column; gap: var(--t-space-2);
}
.t-stage__row {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(180px, 1fr) auto;
    gap: var(--t-space-2);
    align-items: center;
}
.t-stage__title { margin-bottom: 0; }
.t-stage__group { margin-bottom: 0; }
.t-stage__actions { display: flex; gap: var(--t-space-1); }
.t-stage__children { display: flex; flex-direction: column; gap: var(--t-space-2); margin-top: var(--t-space-1); }
@media (max-width: 720px) {
    .t-stage__row { grid-template-columns: 1fr; }
    .t-stage__actions { justify-content: flex-end; }
}

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed;
    bottom: var(--t-space-5);
    right: var(--t-space-5);
    display: flex;
    flex-direction: column;
    gap: var(--t-space-2);
    z-index: 1100;
    max-width: 360px;
}
.t-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary);
    font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }

/* ===== Toolbar ===== */
.t-toolbar {
    display: flex; align-items: flex-end; gap: var(--t-space-3);
    flex-wrap: wrap;
}
.t-toolbar__search { flex: 1; min-width: 220px; height: 36px; }
.t-toolbar__select { margin-bottom: 0; min-width: 160px; }

/* ===== Field: select variant ===== */
.t-field__input--select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238a8f98' d='M0 0h10L5 6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ===== Table ===== */
.t-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--t-space-5)); }
.t-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.t-table thead th {
    text-align: left;
    font-size: 12px;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--t-text-tertiary);
    padding: var(--t-space-2) var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    background: var(--t-bg-surface);
}
.t-table thead th:first-child { padding-left: var(--t-space-5); }
.t-table thead th:last-child { padding-right: var(--t-space-5); }
.t-table tbody td {
    padding: var(--t-space-3);
    border-bottom: 1px solid var(--t-border-subtle);
    color: var(--t-text-primary);
    vertical-align: middle;
}
.t-table tbody td:first-child { padding-left: var(--t-space-5); }
.t-table tbody td:last-child { padding-right: var(--t-space-5); }
.t-table tbody tr:hover { background: var(--t-bg-surface-hover); }
.t-table tbody tr:last-child td { border-bottom: 0; }
.t-table__actions { white-space: nowrap; display: flex; gap: var(--t-space-2); }
.t-table__role-pill { margin-right: var(--t-space-1); }

/* ===== Pagination ===== */
.t-pagination {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; gap: var(--t-space-3); flex-wrap: wrap;
}
.t-pagination__info { font-size: 12px; color: var(--t-text-tertiary); }
.t-pagination__controls { display: flex; align-items: center; gap: var(--t-space-2); }
.t-pagination__page { font-size: 13px; color: var(--t-text-secondary); padding: 0 var(--t-space-2); }

/* ===== Misc helpers ===== */
.t-text-muted { color: var(--t-text-tertiary); }
.t-text-danger { color: var(--t-danger); }
.t-fixed-role { display: flex; flex-wrap: wrap; align-items: center; gap: var(--t-space-2); }
.t-field__hint--inline { margin-left: var(--t-space-2); }

/* ===== Custom-fields template builder (group create dialog) ===== */
.t-fields-builder {
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    padding: var(--t-space-4);
    display: flex; flex-direction: column; gap: var(--t-space-3);
    background: var(--t-bg-surface-alt);
}
.t-fields-builder__head { display: flex; flex-direction: column; gap: var(--t-space-1); }
.t-fields-builder__title { margin: 0; font-size: 14px; font-weight: 590; }
.t-fields-builder__row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) minmax(140px, 1fr) auto auto;
    gap: var(--t-space-3);
    align-items: end;
}
.t-fields-builder__title-input { margin-bottom: 0; }
.t-fields-builder__type { margin-bottom: 0; }
.t-fields-builder__required {
    display: flex; align-items: center; gap: var(--t-space-2);
    font-size: 13px; color: var(--t-text-secondary);
    padding-bottom: 8px;
}

/* ===== Read-only list of custom fields (template view) ===== */
.t-template-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--t-space-2); }
.t-template-fields__row {
    display: flex; align-items: center; gap: var(--t-space-3);
    padding: var(--t-space-2) var(--t-space-3);
    border: 1px solid var(--t-border-subtle);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
}
.t-template-fields__name { flex: 1; font-size: 14px; color: var(--t-text-primary); }

/* ===== Equipment image preview / thumbnail ===== */
.t-equipment-image {
    display: flex; align-items: center; gap: var(--t-space-3);
    margin-bottom: var(--t-space-2);
}
.t-equipment-image img {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: var(--t-radius-md);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: var(--t-radius-sm);
    border: 1px solid var(--t-border-subtle);
}
.t-equipment-thumb--placeholder {
    background: var(--t-bg-surface-alt);
    display: grid; place-items: center;
    color: var(--t-text-quaternary);
    font-size: 12px;
}
.t-equipment-thumb__cell { width: 56px; }

/* ===== Toggle (boolean field) ===== */
.t-toggle { display: inline-flex; align-items: center; gap: var(--t-space-2); cursor: pointer; user-select: none; }

/* ===== Toast host ===== */
.t-toast-host {
    position: fixed;
    bottom: var(--t-space-5);
    right: var(--t-space-5);
    display: flex;
    flex-direction: column;
    gap: var(--t-space-2);
    z-index: 1100;
    max-width: 360px;
}
.t-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--t-space-3);
    padding: var(--t-space-3) var(--t-space-4);
    border-radius: var(--t-radius-md);
    background: var(--t-bg-surface);
    border: 1px solid var(--t-border-standard);
    box-shadow: var(--t-shadow-md);
    color: var(--t-text-primary);
    font-size: 14px;
    animation: t-pop-in .15s ease;
}
.t-toast--info { border-left: 3px solid var(--t-accent); }
.t-toast--success { border-left: 3px solid var(--t-success); }
.t-toast--warning { border-left: 3px solid var(--t-warning); }
.t-toast--error { border-left: 3px solid var(--t-danger); }
.t-toast__close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--t-text-tertiary); font-size: 16px; line-height: 1;
}
.t-toast__close:hover { color: var(--t-text-primary); }
