/*
 * OneFlow — Modern UI layer (Slack / Front inspired)
 * Loaded after MatDash + memory-ventures.css. Overrides Bootstrap chrome for a
 * clean, product-grade workspace shell.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Typography */
    --of-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --of-font-size: 0.875rem;
    --of-line-height: 1.5;

    /* Layout */
    --of-sidebar-w: 240px;
    --of-sidebar-w-collapsed: 64px;
    --of-topbar-h: 52px;
    --of-content-max: 1440px;

    /* Surfaces — Front-like light canvas */
    --of-canvas: #f4f5f7;
    --of-surface: #ffffff;
    --of-surface-hover: #f8f9fa;
    --of-border: #e8eaed;
    --of-border-strong: #d1d5db;

    /* Sidebar — Slack-like dark rail on brand navy */
    --of-sidebar-bg: #222e3c;
    --of-sidebar-bg-hover: rgba(255, 255, 255, 0.06);
    --of-sidebar-bg-active: rgba(255, 255, 255, 0.1);
    --of-sidebar-text: rgba(255, 255, 255, 0.72);
    --of-sidebar-text-muted: rgba(255, 255, 255, 0.45);
    --of-sidebar-text-active: #ffffff;
    --of-orange: #f0a459;
    --of-orange-rgb: 240, 164, 89;
    --of-orange-hover: #d8944f;
    --of-accent: var(--of-orange);
    --of-accent-subtle: rgba(var(--of-orange-rgb), 0.15);

    /* Text */
    --of-text: #1d1c1d;
    --of-text-secondary: #616061;
    --of-text-muted: #868686;

    /* Radius & shadow */
    --of-radius-sm: 6px;
    --of-radius: 8px;
    --of-radius-lg: 12px;
    --of-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --of-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --of-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Motion */
    --of-ease: 150ms ease;
}

/* ── Base ─────────────────────────────────────────────────────────────── */

html {
    font-size: 16px;
}

body {
    font-family: var(--of-font) !important;
    font-size: var(--of-font-size);
    line-height: var(--of-line-height);
    color: var(--of-text);
    background: var(--of-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--of-font);
    font-weight: 600;
    color: var(--of-text);
    letter-spacing: -0.01em;
}

/* ── Bootstrap polish ─────────────────────────────────────────────────── */

.btn {
    font-family: var(--of-font);
    font-weight: 500;
    font-size: 0.8125rem;
    border-radius: var(--of-radius-sm);
    padding: 0.4375rem 0.875rem;
    transition: background-color var(--of-ease), border-color var(--of-ease), box-shadow var(--of-ease);
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.3125rem 0.625rem;
    border-radius: var(--of-radius-sm);
}

.btn-primary {
    box-shadow: var(--of-shadow-sm);
}
.btn-primary:hover {
    box-shadow: var(--of-shadow);
}

.btn-outline-secondary {
    --bs-btn-color: var(--of-text-secondary);
    --bs-btn-border-color: var(--of-border-strong);
    --bs-btn-hover-bg: var(--of-surface-hover);
    --bs-btn-hover-border-color: var(--of-border-strong);
    --bs-btn-hover-color: var(--of-text);
    --bs-btn-active-bg: var(--of-border);
    --bs-btn-active-border-color: var(--of-border-strong);
    --bs-btn-active-color: var(--of-text);
}

.form-control,
.form-select {
    font-family: var(--of-font);
    font-size: 0.8125rem;
    border-radius: var(--of-radius-sm);
    border-color: var(--of-border-strong);
    padding: 0.4375rem 0.75rem;
    transition: border-color var(--of-ease), box-shadow var(--of-ease);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.12);
}

.form-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--of-text-secondary);
    margin-bottom: 0.375rem;
}

.card {
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    box-shadow: var(--of-shadow-sm);
    background: var(--of-surface);
}

.card-body {
    padding: 1.25rem;
}

.table {
    font-size: 0.8125rem;
    --bs-table-bg: transparent;
}

.table > thead {
    border-bottom: 1px solid var(--of-border);
}

.table > thead th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--of-text-muted);
    padding: 0.625rem 1rem;
    border-bottom: none;
    background: var(--of-surface-hover);
}

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

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

.table > tbody tr:hover td {
    background: var(--of-surface-hover);
}

.badge {
    font-weight: 500;
    font-size: 0.6875rem;
    padding: 0.25em 0.55em;
    border-radius: 4px;
}

.dropdown-menu {
    font-family: var(--of-font);
    font-size: 0.8125rem;
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius);
    box-shadow: var(--of-shadow-lg);
    padding: 0.375rem;
}

.dropdown-item {
    border-radius: var(--of-radius-sm);
    padding: 0.4375rem 0.625rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--of-surface-hover);
}

.dropdown-item.active {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.alert {
    font-size: 0.8125rem;
    border-radius: var(--of-radius);
    border: none;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

.text-secondary {
    color: var(--of-text-secondary) !important;
}

/* ── Page primitives (shared across modules) ──────────────────────────── */

.of-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.of-page-header__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

.of-page-header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.of-panel {
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    box-shadow: var(--of-shadow-sm);
}

.of-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--of-border);
    font-weight: 600;
    font-size: 0.8125rem;
}

.of-rail {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.5rem;
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    box-shadow: var(--of-shadow-sm);
}

.of-rail__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.5rem 0.625rem;
    border-radius: var(--of-radius-sm);
    color: var(--of-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--of-ease), color var(--of-ease);
    width: 100%;
}

.of-rail__item:hover {
    background: var(--of-surface-hover);
    color: var(--of-text);
}

.of-rail__item.is-active {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-weight: 600;
}

.of-rail__item.is-active .badge {
    background: rgba(var(--bs-primary-rgb), 0.15) !important;
    color: var(--bs-primary) !important;
}

.of-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.of-stat-card {
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    padding: 1rem 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: border-color var(--of-ease);
}

.of-stat-card:hover {
    border-color: var(--of-border-strong);
}

.of-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--of-text-muted);
}

.of-empty .ti {
    font-size: 2rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

/* ── Login ────────────────────────────────────────────────────────────── */

.of-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background-color: #eef0f3;
    background-image:
        radial-gradient(ellipse 70% 50% at 15% -5%, rgba(var(--of-orange-rgb), 0.22), transparent),
        radial-gradient(ellipse 60% 45% at 95% 105%, rgba(34, 46, 60, 0.14), transparent),
        linear-gradient(165deg, #f3f4f6 0%, #e8eaef 100%);
}

.of-auth__card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2.25rem 2rem;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.8) inset,
        0 1px 2px rgba(34, 46, 60, 0.04),
        0 8px 24px rgba(34, 46, 60, 0.07),
        0 24px 48px rgba(34, 46, 60, 0.05);
}

.of-auth__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.75rem;
}

.of-auth__mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2a3849 0%, #222e3c 100%);
    color: var(--of-orange);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: -0.02em;
    box-shadow:
        0 1px 2px rgba(34, 46, 60, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.of-auth__title {
    font-size: 1.375rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.03em;
    color: #111827 !important;
    margin: 0 0 0.375rem !important;
    line-height: 1.3 !important;
    text-align: center;
}

.of-auth__subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.75rem;
    line-height: 1.5;
    text-align: center;
}

.of-auth__alert {
    font-size: 0.8125rem;
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    margin-bottom: 1.25rem;
}

.of-auth__form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.of-auth__field {
    display: flex;
    flex-direction: column;
    gap: 0.4375rem;
}

.of-auth__label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    letter-spacing: -0.01em;
}

.of-auth__input {
    display: block;
    width: 100%;
    height: 44px;
    padding: 0 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--of-font);
    color: #111827;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.of-auth__input::placeholder {
    color: #9ca3af;
}

.of-auth__input:hover {
    border-color: #9ca3af;
}

.of-auth__input:focus {
    border-color: #222e3c;
    box-shadow:
        0 0 0 3px rgba(34, 46, 60, 0.12),
        0 1px 2px rgba(0, 0, 0, 0.04);
}

.of-auth__input--error {
    border-color: #f87171 !important;
}

.of-auth__input:-webkit-autofill,
.of-auth__input:-webkit-autofill:hover,
.of-auth__input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #111827 !important;
    caret-color: #111827;
    border: 1px solid #d1d5db;
}

.of-auth__error {
    font-size: 0.8125rem;
    color: #dc2626;
    margin: 0;
}

.of-auth__remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #4b5563;
    cursor: pointer;
    margin: -0.25rem 0 0;
    user-select: none;
}

.of-auth__checkbox {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #222e3c;
    cursor: pointer;
}

.of-auth__submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--of-font);
    letter-spacing: -0.01em;
    color: #ffffff;
    background: linear-gradient(180deg, #2a3849 0%, #222e3c 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow:
        0 1px 2px rgba(34, 46, 60, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition:
        transform 100ms ease,
        box-shadow 150ms ease,
        filter 150ms ease;
    margin-top: 0.25rem;
}

.of-auth__submit:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow:
        0 2px 8px rgba(34, 46, 60, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.of-auth__submit:active:not(:disabled) {
    transform: scale(0.99);
}

.of-auth__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.of-auth__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: of-auth-spin 0.7s linear infinite;
}

@keyframes of-auth-spin {
    to {
        transform: rotate(360deg);
    }
}

.of-auth__footer {
    margin: 1.5rem 0 0;
    font-size: 0.75rem;
    color: #9ca3af;
    letter-spacing: 0.02em;
}

/* ── Ticket conversation view (Front-inspired) ───────────────────────── */

.of-body--flush {
    padding: 0 !important;
    background: #ffffff;
}

.of-body--flush .of-body__inner {
    max-width: none;
    margin: 0;
}

.of-ticket {
    max-width: none;
    padding: 1.25rem 2rem 2rem;
    background: #ffffff;
}

.of-ticket__back {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color var(--of-ease);
}

.of-ticket__back:hover {
    color: var(--of-text);
}

.of-ticket__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 0.625rem;
}

.of-ticket__subject {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: -0.015em;
    margin: 0 !important;
    color: #1a1a1a !important;
}

.of-ticket__highlight {
    background: rgba(59, 130, 246, 0.14);
    color: #1d4ed8;
    padding: 0.05em 0.15em;
    border-radius: 3px;
}

.of-ticket__front-id {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.875rem;
    padding: 0.625rem 0.875rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--of-radius-md);
}

.of-ticket__front-id-main {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex-wrap: wrap;
}

.of-ticket__front-id-label {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1d4ed8;
    white-space: nowrap;
}

.of-ticket__front-id-value {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e3a8a;
    text-decoration: none;
    word-break: break-all;
}

.of-ticket__front-id-value:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.of-ticket__front-id-value--plain {
    cursor: default;
}

.of-ticket__front-id-value--plain:hover {
    text-decoration: none;
}

.of-ticket__front-id-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    border: 1px solid #93c5fd;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3125rem 0.625rem;
    border-radius: var(--of-radius-sm);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

.of-ticket__front-id-copy:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

.of-ticket__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.of-ticket__action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: var(--of-font);
    color: #374151;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--of-ease), background var(--of-ease);
    white-space: nowrap;
}

.of-ticket__action:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.of-ticket__action select {
    border: none;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
    outline: none;
    appearance: none;
    padding-right: 1rem;
    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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
}

.of-ticket__action--status {
    border-color: #ddd6fe;
    background: #faf5ff;
    color: #6d28d9;
}

.of-ticket__action--status select {
    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='%236d28d9' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.of-ticket__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px dashed currentColor;
    flex-shrink: 0;
}

.of-ticket__tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.of-ticket__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #4b5563;
}

.of-ticket__tag--brand {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.of-ticket__tag--warn {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}

.of-ticket__tag--info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

/* Metadata — inline rows like Front, not a heavy card */
.of-ticket__meta {
    margin-bottom: 1.25rem;
}

.of-ticket__meta-grid {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.5rem 1rem;
    font-size: 0.8125rem;
    max-width: 480px;
}

.of-ticket__meta-label {
    color: #9ca3af;
    font-weight: 400;
}

.of-ticket__meta-value {
    color: #374151;
}

.of-ticket__source-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.4375rem;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #4b5563;
}

/* Single conversation card */
.of-ticket__card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
}

.of-ticket__thread {
    border: none;
    border-radius: 0;
    background: transparent;
}

.of-ticket__message {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.of-ticket__message:last-child {
    border-bottom: none;
}

.of-ticket__message-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.of-ticket__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #374151;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.6875rem;
    flex-shrink: 0;
}

.of-ticket__avatar--out {
    background: #222e3c;
}

.of-ticket__sender {
    flex: 1;
    min-width: 0;
}

.of-ticket__sender-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1a1a1a;
    line-height: 1.3;
}

.of-ticket__sender-email {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.4;
}

.of-ticket__sender-to {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin-top: 0.125rem;
    line-height: 1.4;
}

.of-ticket__message-time {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.of-ticket__message-time .ti {
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.7;
}

.of-ticket__message-time .ti:hover {
    opacity: 1;
}

.of-ticket__message-body {
    font-size: 0.875rem;
    line-height: 1.65;
    color: #374151;
    word-break: break-word;
}

.of-ticket__message-body p {
    margin: 0 0 0.75rem;
}

.of-ticket__message-body p:last-child {
    margin-bottom: 0;
}

.of-ticket__message-body strong {
    font-weight: 600;
    color: #1a1a1a;
}

.of-ticket__message-body em {
    font-style: italic;
    color: #6b7280;
}

.of-ticket__message-body a {
    color: #2563eb;
    text-decoration: none;
}

.of-ticket__message-body a:hover {
    text-decoration: underline;
}

.of-ticket__message-body blockquote {
    margin: 0.5rem 0;
    padding: 0.25rem 0 0.25rem 0.75rem;
    border-left: 3px solid #e5e7eb;
    color: #4b5563;
}

.of-ticket__message-body ul,
.of-ticket__message-body ol {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.25rem;
}

.of-ticket__message-body li {
    margin-bottom: 0.25rem;
}

.of-ticket__message-body h1,
.of-ticket__message-body h2,
.of-ticket__message-body h3,
.of-ticket__message-body h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0.75rem 0 0.375rem;
}

.of-ticket__transcript {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--of-text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    padding-top: 0.5rem;
    border-top: 1px solid var(--of-border);
    margin-top: 0.5rem;
}

.of-ticket__files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.of-ticket__file {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.3125rem 0.5rem;
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-sm);
    background: var(--of-canvas);
    color: var(--of-text-secondary);
    text-decoration: none;
    transition: border-color var(--of-ease), color var(--of-ease);
}

.of-ticket__file:hover {
    border-color: var(--of-border-strong);
    color: var(--of-text);
}

.of-ticket__composer {
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    background: var(--of-surface);
    margin-top: 1rem;
    overflow: hidden;
}

.of-ticket__composer textarea {
    border: none;
    border-radius: 0;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 80px;
    box-shadow: none !important;
}

.of-ticket__composer textarea:focus {
    box-shadow: none !important;
}

.of-ticket__composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--of-border);
    background: var(--of-canvas);
}

.of-ticket__details {
    margin-top: 1.5rem;
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    background: var(--of-surface);
    overflow: hidden;
}

.of-ticket__details-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--of-text-secondary);
    cursor: pointer;
    transition: background var(--of-ease);
}

.of-ticket__details-toggle:hover {
    background: var(--of-surface-hover);
}

.of-ticket__details-body {
    padding: 0 1rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    border-top: 1px solid var(--of-border);
    padding-top: 1rem;
}

.of-ticket__details-field label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--of-text-muted);
    margin-bottom: 0.375rem;
}

.of-internal-comment {
    position: sticky;
    bottom: 0;
    margin-top: 1.5rem;
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    background: var(--of-surface);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.04);
}

.of-internal-comment__input {
    border: none;
    border-radius: var(--of-radius-lg) var(--of-radius-lg) 0 0;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    resize: none;
    min-height: 44px;
    box-shadow: none !important;
}

.of-internal-comment__input:focus {
    box-shadow: none !important;
}

.of-internal-comment__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.75rem;
    border-top: 1px solid var(--of-border);
}

.of-internal-comment__tools {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.of-internal-comment__tool {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--of-radius-sm);
    color: var(--of-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--of-ease), color var(--of-ease);
}

.of-internal-comment__tool:hover {
    background: var(--of-surface-hover);
    color: var(--of-text);
}

.of-internal-comment__list {
    border-top: 1px solid var(--of-border);
    max-height: 280px;
    overflow-y: auto;
}

.of-internal-comment__item {
    display: flex;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--of-border);
}

.of-internal-comment__item:last-child {
    border-bottom: none;
}

.of-internal-comment__avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e9d5ff;
    color: #7c3aed;
    font-weight: 600;
    font-size: 0.625rem;
    flex-shrink: 0;
}

.of-internal-comment__text {
    font-size: 0.8125rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.of-internal-comment__meta {
    font-size: 0.6875rem;
    color: var(--of-text-muted);
    margin-bottom: 0.125rem;
}

/* ── Tickets workspace (three-column inbox) ───────────────────────────── */

.of-tickets-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #ffffff;
}

.of-tickets-workspace__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--of-border);
    flex-shrink: 0;
    background: var(--of-surface);
}

.of-tickets-workspace__toolbar-start {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.of-tickets-workspace__title {
    font-size: 1rem !important;
    font-weight: 600;
    margin: 0;
    color: var(--of-text);
}

.of-tickets-workspace__brand {
    width: auto;
    max-width: 200px;
    font-size: 0.8125rem;
}

.of-tickets-workspace__toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.of-tickets-workspace__create {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--of-border);
    background: var(--of-surface-muted, #f9fafb);
    flex-shrink: 0;
}

.of-tickets-workspace__columns {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.of-tickets-workspace__inbox {
    width: 200px;
    flex-shrink: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    box-shadow: none;
    overflow-y: auto;
}

.of-tickets-workspace__list {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--of-border);
    border-left: 1px solid var(--of-border);
    background: var(--of-surface);
    min-height: 0;
}

.of-tickets-workspace__list-head {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--of-border);
    flex-shrink: 0;
}

.of-tickets-workspace__sort {
    border: none;
    background: transparent;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--of-text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--of-radius-sm);
    cursor: pointer;
}

.of-tickets-workspace__sort:hover,
.of-tickets-workspace__sort.is-active {
    color: var(--of-text);
    background: var(--of-surface-muted, #f3f4f6);
}

.of-tickets-workspace__list-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.of-ticket-row {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--of-border);
    background: transparent;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: background 120ms ease;
}

.of-ticket-row:hover {
    background: var(--of-surface-muted, #f9fafb);
}

.of-ticket-row.is-active {
    background: #eff6ff;
    box-shadow: inset 3px 0 0 var(--of-primary, #2563eb);
}

.of-ticket-row__top {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}

.of-ticket-row__priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.375rem;
}

.of-ticket-row__priority--low {
    background: #9ca3af;
}

.of-ticket-row__priority--medium {
    background: #3b82f6;
}

.of-ticket-row__priority--high {
    background: var(--of-orange);
}

.of-ticket-row__priority--urgent {
    background: #ef4444;
}

.of-ticket-row__subject {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--of-text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.of-ticket-row__time {
    flex-shrink: 0;
    font-size: 0.6875rem;
    color: var(--of-text-muted);
    white-space: nowrap;
}

.of-ticket-row__bottom {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding-left: calc(8px + 0.375rem);
}

.of-ticket-row__preview {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--of-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.of-ticket-row__status {
    font-size: 0.6875rem;
    color: var(--of-text-muted);
}

.of-ticket-row__badge {
    font-size: 0.75rem;
    color: var(--of-primary, #2563eb);
}

.of-tickets-workspace__empty-list {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--of-text-muted);
}

.of-tickets-workspace__detail {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: #ffffff;
}

.of-tickets-workspace__empty-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--of-text-muted);
    gap: 0.5rem;
}

.of-tickets-workspace__empty-detail .ti {
    font-size: 2.5rem;
    opacity: 0.35;
}

.of-tickets-workspace__empty-detail p {
    margin: 0;
    font-size: 0.875rem;
}

.of-ticket--embedded {
    padding: 1rem 1.25rem 1.5rem;
    min-height: 100%;
}

.of-ticket--embedded .of-ticket__header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.of-ticket--embedded .of-ticket__actions {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.of-ticket--embedded .of-ticket__subject {
    font-size: 1.0625rem !important;
}

@media (max-width: 1199.98px) {
    .of-tickets-workspace__list {
        width: 280px;
    }
}

@media (max-width: 991.98px) {
    .of-tickets-workspace__columns {
        flex-direction: column;
    }

    .of-tickets-workspace__inbox {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
    }

    .of-tickets-workspace__list {
        width: 100%;
        max-height: 40vh;
        border-left: none;
    }

    .of-tickets-workspace__detail {
        min-height: 50vh;
    }
}

/* ── Front sync dialog (PoC) ─────────────────────────────────────────── */

.of-sync-dialog {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.of-sync-dialog__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.of-sync-dialog__panel {
    position: relative;
    width: min(100%, 480px);
    background: #ffffff;
    border-radius: var(--of-radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    border: 1px solid var(--of-border);
    overflow: hidden;
}

.of-sync-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.25rem 0.875rem;
    border-bottom: 1px solid var(--of-border);
}

.of-sync-dialog__title {
    font-size: 1.0625rem !important;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.of-sync-dialog__subtitle {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--of-text-muted);
    line-height: 1.45;
}

.of-sync-dialog__close {
    border: none;
    background: transparent;
    color: var(--of-text-muted);
    font-size: 1.125rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--of-radius-sm);
}

.of-sync-dialog__close:hover {
    background: var(--of-surface-muted, #f3f4f6);
    color: var(--of-text);
}

.of-sync-dialog__body {
    padding: 1rem 1.25rem 1.25rem;
}

.of-sync-dialog__options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.of-sync-dialog__option {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-md);
    cursor: pointer;
    margin: 0;
    transition: border-color 120ms ease, background 120ms ease;
}

.of-sync-dialog__option:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
}

.of-sync-dialog__option input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.of-sync-dialog__option-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    font-size: 0.8125rem;
    color: var(--of-text-muted);
}

.of-sync-dialog__option-text strong {
    font-size: 0.875rem;
    color: var(--of-text);
}

.of-sync-dialog__field {
    margin: -0.25rem 0 0.25rem 1.75rem;
}

.of-sync-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ── Global search page ────────────────────────────────────────────────── */

.of-search-page {
    max-width: 720px;
    margin: 0 auto;
}

.of-search-page__header {
    margin-bottom: 1.25rem;
}

.of-search-page__title {
    font-size: 1.375rem !important;
    font-weight: 600;
    margin: 0 0 0.375rem;
}

.of-search-page__subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--of-text-muted);
}

.of-search-page__form {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    box-shadow: var(--of-shadow-sm);
    margin-bottom: 1rem;
}

.of-search-page__icon {
    color: var(--of-text-muted);
    font-size: 1.125rem;
    flex-shrink: 0;
}

.of-search-page__input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    padding: 0.375rem 0;
    min-width: 0;
}

.of-search-page__input:focus {
    outline: none;
    box-shadow: none;
}

.of-search-page__summary {
    font-size: 0.8125rem;
    color: var(--of-text-muted);
    margin: 0 0 1rem;
}

.of-search-page__groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.of-search-page__group {
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    overflow: hidden;
}

.of-search-page__group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--of-text-muted);
    margin: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--of-border);
    background: var(--of-surface-muted, #f9fafb);
}

.of-search-page__results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.of-search-page__result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--of-border);
    transition: background 120ms ease;
}

.of-search-page__result:last-child {
    border-bottom: none;
}

.of-search-page__result:hover {
    background: var(--of-surface-muted, #f9fafb);
}

.of-search-page__result-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--of-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.of-search-page__result-meta {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--of-text-muted);
    background: var(--of-surface-muted, #f3f4f6);
    padding: 0.125rem 0.375rem;
    border-radius: var(--of-radius-sm);
}

.of-search-page__empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--of-surface);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
}

.of-search-page__empty .ti {
    font-size: 2.5rem;
    color: #d1d5db;
    margin-bottom: 0.75rem;
}

.of-search-page__empty h2 {
    font-size: 1rem !important;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.of-search-page__empty p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--of-text-muted);
    line-height: 1.5;
    max-width: 28rem;
    margin-inline: auto;
}

.of-search-page__empty a {
    color: #2563eb;
    text-decoration: none;
}

.of-search-page__empty a:hover {
    text-decoration: underline;
}

.of-search-page__empty--hint .ti {
    color: #93c5fd;
}

