:root {
    --da-red: #E32022;
    --da-black: #0A0A0A;
}

/* Light mode: white background, black text, red accents */
body.fi-body {
    background-color: #ffffff;
}

/* Dark mode: black background, white text, red accents */
.dark body.fi-body {
    background-color: var(--da-black);
}

.dark .fi-sidebar,
.dark .fi-topbar nav {
    background-color: #111111;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-button {
    background-color: var(--da-red) !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-button .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-sidebar-item-button .fi-icon {
    color: #ffffff !important;
}

.fi-logo img {
    height: 2.5rem;
    width: auto;
}

.fi-simple-layout {
    background-color: #ffffff;
}

.dark .fi-simple-layout {
    background-color: var(--da-black);
}

.fi-btn-color-primary,
.fi-badge-color-primary {
    --c-400: var(--da-red);
    --c-500: var(--da-red);
    --c-600: var(--da-red);
}

/* History Treatment — patient accordion */
.htx-search {
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04);
}
.dark .htx-search {
    background: #111111;
    border-color: rgba(255, 255, 255, 0.08);
}

.htx-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.htx-card {
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.htx-card:hover {
    box-shadow: 0 8px 24px rgba(10, 10, 10, 0.08);
}
.dark .htx-card {
    background: #111111;
    border-color: rgba(255, 255, 255, 0.08);
}
.dark .htx-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.htx-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.htx-header:hover {
    background: rgba(10, 10, 10, 0.025);
}
.dark .htx-header:hover {
    background: rgba(255, 255, 255, 0.035);
}

.htx-avatar {
    display: flex;
    height: 2.75rem;
    width: 2.75rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    background: linear-gradient(135deg, var(--da-red), #a5171a);
    box-shadow: 0 2px 6px rgba(227, 32, 34, 0.35);
    overflow: hidden;
}
.htx-avatar img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.htx-name {
    font-size: 0.925rem;
    font-weight: 600;
    color: #0a0a0a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .htx-name {
    color: #ffffff;
}

.htx-count {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: #6b7280;
}
.dark .htx-count {
    color: #9ca3af;
}
.htx-count svg {
    height: 0.8rem;
    width: 0.8rem;
}

.htx-chevron {
    display: flex;
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: #9ca3af;
}
.htx-chevron svg {
    height: 1rem;
    width: 1rem;
    transition: transform 0.25s ease;
}
.htx-chevron.htx-open svg {
    transform: rotate(180deg);
}

.htx-body {
    border-top: 1px solid rgba(10, 10, 10, 0.07);
    background: #fafafa;
    padding: 0.75rem 1rem 1rem;
}
.dark .htx-body {
    border-color: rgba(255, 255, 255, 0.08);
    background: #0b0b0b;
}

.htx-row {
    position: relative;
    display: flex;
    gap: 0.75rem;
}

.htx-node-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0.15rem;
}

.htx-node-line {
    width: 1px;
    flex: 1;
    background: rgba(10, 10, 10, 0.1);
    margin-top: 0.35rem;
}
.dark .htx-node-line {
    background: rgba(255, 255, 255, 0.1);
}

.htx-entry {
    flex: 1;
    min-width: 0;
    padding-bottom: 0.75rem;
}

.htx-entry-card {
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.07);
    border-radius: 0.85rem;
    padding: 0.85rem;
    box-shadow: 0 1px 2px rgba(10, 10, 10, 0.03);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.htx-entry-card:hover {
    box-shadow: 0 6px 16px rgba(10, 10, 10, 0.07);
    transform: translateY(-1px);
}
.dark .htx-entry-card {
    background: #161616;
    border-color: rgba(255, 255, 255, 0.08);
}
.dark .htx-entry-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.htx-visit-date {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.65rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid rgba(10, 10, 10, 0.06);
}
.dark .htx-visit-date {
    color: #9ca3af;
    border-color: rgba(255, 255, 255, 0.07);
}
.htx-visit-date svg {
    height: 0.85rem;
    width: 0.85rem;
}
.htx-visit-count {
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.65rem;
}

.htx-tooth-row {
    padding-top: 0.65rem;
    margin-top: 0.65rem;
    border-top: 1px dashed rgba(10, 10, 10, 0.08);
}
.htx-tooth-row:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}
.dark .htx-tooth-row {
    border-color: rgba(255, 255, 255, 0.08);
}

.htx-entry-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.htx-sub {
    font-size: 0.75rem;
    color: #6b7280;
}
.dark .htx-sub {
    color: #9ca3af;
}

.htx-comma {
    color: #9ca3af;
    margin-left: -0.25rem;
    font-weight: 700;
}

.htx-status {
    margin-left: auto;
}

.htx-note {
    margin-top: 0.55rem;
    font-size: 0.825rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .htx-note {
    color: #d1d5db;
}

.htx-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(10, 10, 10, 0.06);
}
.dark .htx-meta-row {
    border-color: rgba(255, 255, 255, 0.07);
}

.htx-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: #6b7280;
}
.dark .htx-meta {
    color: #9ca3af;
}
.htx-meta svg {
    height: 0.85rem;
    width: 0.85rem;
}

.htx-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.htx-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--da-red);
    font-weight: 500;
    text-decoration: none;
}
.htx-doc-link:hover {
    text-decoration: underline;
}

.htx-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-left: auto;
}
.htx-visit-date .htx-actions {
    color: initial;
}

.htx-doc-link-inline {
    display: inline-flex;
    margin-top: 0.5rem;
}

.htx-empty {
    background: #ffffff;
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: 1rem;
    padding: 3rem 1.5rem;
    text-align: center;
    box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04);
}
.dark .htx-empty {
    background: #111111;
    border-color: rgba(255, 255, 255, 0.08);
}
.htx-empty-title {
    font-weight: 600;
    color: #0a0a0a;
}
.dark .htx-empty-title {
    color: #ffffff;
}
.htx-empty-desc {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}
.dark .htx-empty-desc {
    color: #9ca3af;
}

/* View Treatment — page shell + navigation bar */
.vtx-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4rem);
}
#odontogram-fullbleed {
    flex: 1;
    min-height: 0;
}

.vtx-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: #ffffff;
    border-bottom: 1px solid rgba(10, 10, 10, 0.08);
    height: 3.25rem;
    flex-shrink: 0;
    box-sizing: border-box;
}
.dark .vtx-bar {
    background: #111111;
    border-color: rgba(255, 255, 255, 0.08);
}

.vtx-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    padding: 0.4rem 0.65rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}
.vtx-back:hover {
    background: rgba(10, 10, 10, 0.04);
}
.dark .vtx-back {
    color: #e5e7eb;
}
.dark .vtx-back:hover {
    background: rgba(255, 255, 255, 0.06);
}
.vtx-back svg {
    height: 1rem;
    width: 1rem;
}

.vtx-seq {
    margin-left: 0.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0a0a0a;
}
.dark .vtx-seq {
    color: #ffffff;
}
.vtx-seq span {
    font-weight: 500;
    color: #6b7280;
}
.dark .vtx-seq span {
    color: #9ca3af;
}

.vtx-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vtx-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--da-red);
    text-decoration: none;
    padding: 0.45rem 0.85rem;
    border-radius: 0.6rem;
    box-shadow: 0 1px 2px rgba(227, 32, 34, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.vtx-nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(227, 32, 34, 0.35);
}
.vtx-nav-btn svg {
    height: 0.9rem;
    width: 0.9rem;
}
.vtx-nav-btn.vtx-disabled {
    background: #e5e7eb;
    color: #9ca3af;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}
.dark .vtx-nav-btn.vtx-disabled {
    background: rgba(255, 255, 255, 0.08);
    color: #6b7280;
}
