html,
body {
    margin: 0;
    min-height: 100%;
    background: #f4f6f2;
    color: #1e2528;
    direction: rtl;
    font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

a {
    color: inherit;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 1.7rem;
    line-height: 1.5;
}

h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd4d0;
    border-radius: 6px;
    background: #fff;
    color: #1e2528;
    padding: 0.72rem 0.82rem;
}

textarea {
    min-height: 7rem;
    resize: vertical;
}

label {
    display: grid;
    gap: 0.45rem;
    color: #53605c;
    font-size: 0.92rem;
}

audio {
    width: min(18rem, 100%);
}

.page {
    display: flex;
    min-height: 100vh;
}

main {
    flex: 1;
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 0;
    width: 17rem;
    height: 100vh;
    background: #173832;
    color: #f5fbf8;
}

.top-row {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
    padding: 0.8rem 1.5rem;
    background: rgba(244, 246, 242, 0.95);
    border-bottom: 1px solid #dde4df;
    backdrop-filter: blur(8px);
}

.top-row-title {
    font-weight: 700;
}

.top-row-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.content {
    padding: 1.5rem;
}

.nav-head {
    min-height: 4rem;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    background: rgba(0, 0, 0, 0.16);
}

.container-fluid {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.navbar-brand {
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.navbar-toggler {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    color: #fff;
    width: 2.4rem;
    height: 2.4rem;
}

.nav-scrollable {
    height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 0.8rem 0;
}

.nav-item {
    padding: 0.18rem 0.9rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    color: #d8e8e2;
    text-decoration: none;
}

.nav-link.active,
.nav-link:hover {
    background: #25534b;
    color: #fff;
}

.nav-icon {
    width: 1.4rem;
    text-align: center;
    font-weight: 700;
}

.nav-section {
    padding: 1rem 1.6rem 0.35rem;
    color: #a8c2ba;
    font-size: 0.78rem;
}

.surface,
.auth-panel {
    background: #fff;
    border: 1px solid #dce4df;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 8px 22px rgba(27, 44, 39, 0.06);
}

.auth-panel {
    display: grid;
    gap: 1rem;
    max-width: 30rem;
    margin: 2rem auto;
}

.section-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.section-heading p,
.muted {
    color: #64716d;
}

.search-grid,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.search-grid {
    grid-template-columns: 12rem 12rem minmax(14rem, 1fr) auto;
    align-items: end;
}

.split-view {
    display: grid;
    grid-template-columns: minmax(15rem, 23rem) minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.result-list,
.details-panel,
.form-surface,
.action-grid {
    display: grid;
    gap: 0.85rem;
}

.result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    border: 1px solid #dce4df;
    border-radius: 6px;
    background: #fbfcfb;
    padding: 0.75rem 0.85rem;
    text-align: right;
    color: #1e2528;
}

.result-row.selected,
.result-row:hover {
    border-color: #2c665d;
    background: #eef7f4;
}

.details-head,
.repeat-head,
.inline-editor,
.add-strip,
.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.inline-editor,
.add-strip {
    align-items: end;
}

.detail-group,
.nested-block {
    display: grid;
    gap: 0.75rem;
    border-top: 1px solid #e4ebe7;
    padding-top: 1rem;
}

.nested-block {
    border: 1px solid #dfe7e2;
    border-radius: 8px;
    padding: 1rem;
    background: #fbfcfb;
}

.repeat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: start;
}

.action-grid {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.action-tile {
    display: grid;
    gap: 0.45rem;
    min-height: 8rem;
    border: 1px solid #dce4df;
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    background: #fbfcfb;
}

.action-tile:hover {
    border-color: #2c665d;
    background: #eef7f4;
}

.action-tile span,
.data-row small,
.result-row small {
    color: #64716d;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.text-button,
.icon-button {
    border: 0;
    border-radius: 6px;
    min-height: 2.55rem;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.primary-button {
    background: #2c665d;
    color: #fff;
}

.secondary-button {
    background: #d9ebe6;
    color: #173832;
}

.danger-button {
    background: #8b2f32;
    color: #fff;
}

.ghost-button {
    border: 1px solid #cbd4d0;
    background: #fff;
    color: #173832;
}

.text-button {
    background: transparent;
    color: #2c665d;
    padding-inline: 0.3rem;
}

.icon-button {
    width: 2.5rem;
    padding: 0;
    background: #2c665d;
    color: #fff;
    font-size: 1.1rem;
}

.primary-button:disabled,
.secondary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.user-chip {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #53605c;
}

.notice {
    border: 1px solid #d7c98d;
    border-radius: 6px;
    background: #fff8d9;
    color: #594a10;
    padding: 0.75rem 0.85rem;
    margin-top: 1rem;
}

.notice.soft {
    border-color: #dce4df;
    background: #f6f8f7;
    color: #53605c;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    background: #fff8d9;
    color: #1e2528;
    padding: 0.8rem 1rem;
    border-top: 1px solid #d7c98d;
}

.loading-progress {
    display: block;
    width: 6rem;
    height: 6rem;
    margin: 20vh auto 1rem;
}

.loading-progress circle {
    fill: none;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:first-child {
    stroke: #dce4df;
}

.loading-progress circle:last-child {
    stroke: #2c665d;
}

.loading-progress-text {
    text-align: center;
}

.loading-progress-text::after {
    content: "در حال بارگذاری";
}

@media (max-width: 900px) {
    .page {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }

    .navbar-toggler {
        display: inline-grid;
        place-items: center;
    }

    .collapse {
        display: none;
    }

    .nav-scrollable {
        height: auto;
    }

    .content {
        padding: 1rem;
    }

    .top-row {
        position: static;
    }

    .search-grid,
    .form-grid,
    .split-view {
        grid-template-columns: 1fr;
    }

    .inline-editor,
    .add-strip,
    .details-head,
    .data-row {
        align-items: stretch;
        flex-direction: column;
    }
}
