/*
 * Ohr Haner - Frontend refresh
 * Keeps the original amber/stone tone while simplifying interaction.
 */

:root {
    --bg-top: #fffaf4;
    --bg-bottom: #fff3e7;
    --paper: #fffaf2;
    --paper-soft: #fff0df;
    --ink: #2d1711;
    --muted: #7a4f3f;
    --line: #e8c8a8;
    --accent: #d2471f;
    --accent-strong: #ad2f15;
    --accent-soft: #f28a2f;
    --danger: #b2291f;
    --shadow-soft: 0 14px 32px rgba(50, 12, 7, 0.18);
    --shadow-card: 0 20px 44px rgba(44, 9, 6, 0.28);
}

.app-root {
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 171, 86, 0.14), rgba(255, 171, 86, 0) 42%),
        radial-gradient(circle at 88% 8%, rgba(232, 74, 35, 0.1), rgba(232, 74, 35, 0) 38%),
        linear-gradient(170deg, var(--bg-top), var(--bg-bottom));
}

.app-root::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(rgba(255, 203, 118, 0.2) 1px, transparent 1px),
        radial-gradient(rgba(255, 120, 58, 0.16) 1px, transparent 1px);
    background-size: 24px 24px, 34px 34px;
    background-position: 0 0, 12px 10px;
    opacity: 0.16;
    z-index: -1;
}

.app-main {
    max-width: 1480px;
    margin: 0 auto;
    padding: 1rem 1.2rem 1.4rem;
}

.site-header {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(138deg, #8f2611 0%, #6e150c 48%, #430f08 100%);
    color: #fff4df;
    border-bottom: 1px solid rgba(255, 206, 154, 0.34);
    box-shadow: 0 18px 42px rgba(30, 6, 4, 0.5);
}

.site-header::before,
.site-header::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.site-header::before {
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 11% 16%, rgba(255, 211, 153, 0.25), rgba(255, 211, 153, 0) 36%),
        radial-gradient(circle at 88% 8%, rgba(255, 146, 74, 0.3), rgba(255, 146, 74, 0) 32%);
}

.site-header::after {
    inset: 0;
    z-index: -1;
    opacity: 0.16;
    background:
        repeating-linear-gradient(
            -32deg,
            rgba(255, 232, 206, 0.42),
            rgba(255, 232, 206, 0.42) 1px,
            transparent 1px,
            transparent 16px
        );
}

.site-header__inner {
    max-width: 1480px;
    margin: 0 auto;
    padding: 1rem 1.2rem 0.95rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 1rem 1.2rem;
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    min-width: 0;
}

.site-header__badge {
    width: clamp(4.2rem, 5.8vw, 5.8rem);
    height: clamp(4.2rem, 5.8vw, 5.8rem);
    border-radius: 999px;
    border: 1px solid rgba(255, 229, 196, 0.62);
    background:
        radial-gradient(circle at 32% 22%, #fff6e8 0%, #ffe3bf 42%, #f9bd79 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        0 8px 18px rgba(37, 8, 6, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.site-header__badge-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.site-header__badge-logo {
    width: 78%;
    height: 78%;
    shape-rendering: crispEdges;
    image-rendering: pixelated;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.22));
}

.site-header__title-wrap {
    min-width: 0;
}

.site-title {
    font-size: clamp(1.8rem, 2.8vw, 2.34rem);
    line-height: 1.1;
    margin: 0;
    color: #fff2de;
    text-shadow: 0 2px 16px rgba(35, 6, 5, 0.3);
}

.site-subtitle {
    margin: 0.34rem 0 0;
    color: #ffddb7;
    letter-spacing: 0.028em;
    text-shadow: 0 1px 12px rgba(27, 6, 5, 0.24);
}

.site-nav {
    justify-self: end;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 212, 159, 0.35);
    background: linear-gradient(180deg, rgba(64, 14, 10, 0.54), rgba(45, 10, 8, 0.5));
    box-shadow:
        inset 0 1px 0 rgba(255, 240, 218, 0.2),
        0 10px 24px rgba(32, 7, 6, 0.34);
}

.site-nav__link {
    color: #ffe7c8;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    padding: 0.4rem 0.84rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 640;
    letter-spacing: 0.01em;
    line-height: 1;
    transition:
        background-color 0.16s ease,
        color 0.16s ease,
        border-color 0.16s ease,
        transform 0.16s ease;
}

.site-nav__link:hover {
    background: rgba(255, 230, 198, 0.19);
    color: #fff8ec;
    border-color: rgba(255, 229, 194, 0.38);
    transform: translateY(-1px);
}

.site-nav__link--active {
    background: linear-gradient(180deg, #fff9ef 0%, #ffe2bc 100%);
    color: #6f1b0f;
    border-color: rgba(255, 229, 194, 0.92);
    box-shadow: 0 7px 14px rgba(38, 8, 6, 0.22);
}

.site-help {
    margin: 0;
    color: #ffdcb8;
    font-size: 0.95rem;
    opacity: 0.95;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.site-help__action {
    border: 0;
    background: transparent;
    color: #ffe6cc;
    font-size: 0.95rem;
    padding: 0.1rem 0.2rem;
    border-radius: 6px;
    text-decoration: underline;
    text-underline-offset: 0.14em;
}

.site-help__action:hover {
    color: #fff6ea;
    background: rgba(255, 228, 194, 0.14);
    text-decoration: none;
}

.site-help__divider {
    color: #ffd2a6;
    opacity: 0.85;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    min-height: calc(100vh - 8.7rem);
}

.workspace-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    overflow: hidden;
    min-height: 420px;
    animation: rise-in 0.45s ease both;
}

.workspace-panel__scroll {
    overflow-y: auto;
    padding-right: 0.15rem;
}

.workspace-panel--search,
.workspace-panel--sheet {
    display: flex;
    flex-direction: column;
}

.workspace-panel--search .workspace-panel__scroll,
.workspace-panel--sheet .workspace-panel__scroll {
    flex: 1;
    min-height: 0;
}

.workspace-panel--search {
    order: 1;
}

.workspace-panel--sheet {
    order: 2;
}

.static-page {
    max-width: 920px;
    margin: 0 auto;
    display: grid;
    gap: 0.95rem;
    animation: rise-in 0.45s ease both;
}

.static-page__hero {
    background: linear-gradient(180deg, #fff2dd, #ffe8cb);
    border: 1px solid #ebc39a;
    border-radius: 16px;
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-soft);
}

.static-page__title {
    margin: 0;
    color: #572314;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
}

.static-page__subtitle {
    margin: 0.5rem 0 0;
    color: #784b34;
    max-width: 68ch;
}

.static-page__card {
    background: #fffaf2;
    border: 1px solid #e8c8a8;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    padding: 1rem 1.1rem;
}

.static-page__section-title {
    margin: 0;
    color: #5c2313;
    font-size: 1.15rem;
    font-weight: 700;
}

.static-page__card p {
    margin: 0.5rem 0 0;
    color: #5c4434;
    line-height: 1.6;
}

.static-page__list {
    margin: 0.7rem 0 0;
    padding-inline-start: 1.25rem;
    display: grid;
    gap: 0.35rem;
    color: #5c4434;
}

.guide-steps {
    margin: 0;
    padding-inline-start: 1.25rem;
    display: grid;
    gap: 0.8rem;
}

.guide-steps h3 {
    margin: 0;
    font-size: 1.04rem;
    color: #4f2817;
}

.guide-steps p {
    margin: 0.32rem 0 0;
}

.empty-state-card {
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff4e4, #ffe9d0);
    padding: 1rem;
    text-align: center;
    color: var(--muted);
}

.empty-state-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.empty-state-card__hint {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

.search-label {
    display: block;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.search-help {
    margin: 0.4rem 0 0.8rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.search-input-wrap {
    position: relative;
}

.search-input {
    width: 100%;
    border: 1px solid #cebda8;
    background: #fff;
    border-radius: 12px;
    padding: 0.88rem 4rem 0.88rem 0.9rem;
    font-size: 1.07rem;
    line-height: 1.35;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(173, 111, 49, 0.2);
}

.search-indicator {
    position: absolute;
    top: 50%;
    right: 0.7rem;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.95rem;
}

.search-clear-button {
    position: absolute;
    top: 50%;
    right: 2.3rem;
    transform: translateY(-50%);
    border: 1px solid #dfc2a5;
    background: #fff8ee;
    color: #7a4f3f;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 999px;
    font-size: 0.86rem;
    line-height: 1;
    padding: 0;
}

.search-clear-button:hover {
    background: #ffe7cf;
}

.search-results {
    position: relative;
}

.results-panel {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(52, 30, 15, 0.12);
    overflow: hidden;
    animation: fade-drop 0.22s ease both;
}

.results-panel__title {
    margin: 0;
    padding: 0.55rem 0.8rem;
    font-size: 0.83rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: #ffe7cf;
    border-bottom: 1px solid var(--line);
}

.search-results-list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
}

.search-result-item {
    width: 100%;
    text-align: start;
    border: 0;
    border-bottom: 1px solid #efe4d6;
    padding: 0.72rem 0.86rem;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    transition: background-color 0.14s ease;
}

.search-result-item:hover {
    background: #fff1dd;
}

.search-results-list li:last-child .search-result-item {
    border-bottom: 0;
}

.search-result-item__title {
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--ink);
}

.search-result-item__meta {
    font-size: 0.76rem;
    color: var(--muted);
    background: #ffe6c9;
    border: 1px solid #e9bd91;
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    white-space: nowrap;
}

.results-empty {
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 0.9rem;
    color: var(--muted);
    text-align: center;
    background: #fffdf9;
}

.results-empty p {
    margin: 0;
}

.results-empty__hint {
    margin-top: 0.35rem;
    font-size: 0.9rem;
}

.sheet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eddccb;
    padding-bottom: 0.9rem;
}

.sheet-toolbar__head {
    flex: 1 1 420px;
    min-width: 0;
}

.sheet-toolbar__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.48rem;
}

.sheet-kicker {
    margin: 0;
    font-size: 0.86rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sheet-title {
    margin: 0.05rem 0 0;
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.15;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
}

.sheet-rename-form {
    margin-top: 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.sheet-rename-input {
    width: min(100%, 24rem);
    min-width: 14rem;
    border: 1px solid #d6be9f;
    background: #fff;
    border-radius: 9px;
    color: var(--ink);
    padding: 0.45rem 0.6rem;
    font-size: 0.95rem;
}

.sheet-rename-input:focus {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(173, 111, 49, 0.2);
}

.sheet-rename-save {
    padding-top: 0.44rem;
    padding-bottom: 0.44rem;
}

.sheet-export-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.sheet-export-status {
    font-size: 0.73rem;
    line-height: 1;
    color: #7a5642;
    background: #fff3e3;
    border: 1px solid #e2c7aa;
    border-radius: 999px;
    padding: 0.2rem 0.4rem;
}

.sheet-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.32rem;
}

.sheet-toolbar__action {
    border-radius: 8px;
    border: 1px solid #e7c8aa;
    background: #fff7ec;
    color: #8f4f20;
    text-decoration: none;
    padding: 0.35rem 0.55rem;
}

.sheet-toolbar__action:hover:not(:disabled) {
    background: #ffe5c7;
    color: #7d3d13;
}

.sheet-toolbar__action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sheet-add-button {
    width: 100%;
    margin-top: 0.9rem;
    border: 1px dashed #de9861;
    border-radius: 12px;
    padding: 0.85rem 0.95rem;
    background: #ffedd6;
    color: #9d2d13;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sheet-add-button:hover {
    border-color: #ef7d2b;
    background: #ffe6c6;
}

.sheet-add-button:active {
    transform: translateY(1px);
}

.sheet-empty-state {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 1px dashed #e1ae7f;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff4e6, #fffaf3);
    color: var(--muted);
    padding: 1.4rem;
}

.sheet-empty-state__title {
    margin: 0;
    font-size: 1.45rem;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
    color: var(--ink);
}

.sheet-empty-state__description {
    margin: 0.55rem 0 0;
    max-width: 40ch;
    line-height: 1.5;
}

.anchor-builder__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff8ee, #fff2e3);
    border: 1px solid #e7c8a8;
    border-inline-start: 4px solid #df6d24;
    box-shadow: 0 6px 14px rgba(80, 30, 10, 0.08);
}

.anchor-builder__picker {
    margin-bottom: 0.5rem;
}

.anchor-builder__title {
    margin: 0;
    font-size: 1.24rem;
    line-height: 1.2;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
}

.anchor-builder__meta {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.anchor-builder__add {
    min-width: 8.25rem;
    align-self: center;
    box-shadow: 0 7px 12px rgba(173, 47, 21, 0.25);
}

.message-strip {
    margin: 0 0 0.8rem;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    border: 1px solid #ebd2b9;
    background: #fff3e3;
    color: #8a501f;
    font-size: 0.92rem;
}

.segment-card {
    position: relative;
    border: 1px solid #e3d4c1;
    border-radius: 12px;
    background: #fff;
    padding: 0.85rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.segment-card__remove {
    position: absolute;
    top: 0.42rem;
    right: 0.42rem;
    border: 0;
    border-radius: 6px;
    background: #f4e4d1;
    color: #925f38;
    font-size: 0.8rem;
    font-weight: 700;
    width: 1.45rem;
    height: 1.45rem;
    line-height: 1.45rem;
    text-align: center;
}

.segment-card__remove:hover {
    background: #ead1b5;
    color: #6b4327;
}

.segment-header {
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.87rem;
    font-weight: 600;
}

.segment-text {
    font-size: 1.08rem;
    line-height: 1.8;
    color: var(--ink);
}

.segment-text--selectable {
    border-radius: 9px;
    padding: 0.32rem 0.45rem;
    cursor: pointer;
    transition: background-color 0.14s ease;
}

.segment-text--selectable:hover {
    background: #fef4e3;
}

.segment-selected-meta {
    margin-top: 0.5rem;
    color: #98521d;
    font-size: 0.88rem;
    font-weight: 600;
}

.anchor-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.anchor-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
    background: #ffe9d1;
    border-bottom: 1px solid #efc9a6;
    cursor: pointer;
}

.drag-handle {
    border: 0;
    background: transparent;
    color: #a4896e;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.2rem;
    border-radius: 6px;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.anchor-toggle {
    border: 1px solid #d7c1a9;
    background: #fffaf2;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 7px;
    font-size: 0.95rem;
    line-height: 1;
    color: #7d5936;
}

.anchor-title {
    flex: 1;
    font-size: 1.07rem;
    font-weight: 700;
    color: var(--ink);
}

.anchor-body {
    padding: 0.8rem;
}

.segment-display + .segment-display {
    margin-top: 0.75rem;
    border-top: 1px dashed #ecdcca;
    padding-top: 0.75rem;
}

.segment-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6e5a47;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.segment-toggle__title {
    color: #5c4b3b;
}

.segment-toggle__meta {
    margin-inline-start: auto;
    color: #8d765f;
    font-size: 0.83rem;
    font-weight: 500;
}

.segment-content {
    margin-top: 0.55rem;
    padding-inline-start: 0.25rem;
}

.segment-text-card {
    position: relative;
    border: 1px solid #eebf95;
    border-radius: 11px;
    background: #fff2df;
    padding: 0.78rem;
    line-height: 1.8;
    cursor: pointer;
    transition: border-color 0.14s ease, background-color 0.14s ease;
}

.segment-text-card:hover {
    border-color: #ee8a43;
    background: #ffe8cd;
}

.segment-hint {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.commentary-display {
    margin-top: 0.52rem;
    border: 1px solid #efcfaf;
    border-inline-start: 4px solid #de6b22;
    border-radius: 10px;
    background: #fff;
    padding: 0.66rem 0.72rem;
}

.commentary-display__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94541f;
    flex: 1;
    min-width: 0;
}

.commentary-display__commentator-row {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: linear-gradient(180deg, #ffe0bf, #ffd3a8);
    border: 1px solid #de9b67;
    border-radius: 8px;
    padding: 0.14rem 0.36rem;
}

.commentary-display__commentator-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6f2c11;
    background: #fff3e4;
    border: 1px solid #e7bf95;
    border-radius: 999px;
    padding: 0.02rem 0.34rem;
}

.commentary-display__commentator {
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 900;
    color: #5f1f08;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    line-height: 1.25;
}

.commentary-display__header {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.commentary-collapse {
    border: 1px solid #e2b78e;
    background: #fff3e4;
    color: #8b4c1d;
    width: 1.8rem;
    height: 1.8rem;
    line-height: 1;
    border-radius: 7px;
    font-size: 0.93rem;
    font-weight: 700;
    padding: 0;
}

.commentary-display__actions {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.commentary-action {
    border: 1px solid #e2b78e;
    background: #fff6ea;
    color: #8b4c1d;
    border-radius: 7px;
    width: 1.8rem;
    height: 1.8rem;
    line-height: 1;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.commentary-action:hover:not(:disabled) {
    background: #ffe6c7;
}

.commentary-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.commentary-action--danger {
    border-color: #e0a2a2;
    color: #a73728;
    background: #fff0ef;
}

.commentary-display__text {
    margin-top: 0.3rem;
    font-size: 0.94rem;
    line-height: 1.68;
    color: #4b3a2d;
}

.section-picker {
    border: 1px solid #ebb997;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff2df, #ffebd4);
    padding: 0.82rem;
}

.section-picker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.section-picker__title {
    margin: 0;
    font-size: 1.12rem;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
}

.section-picker__badge {
    font-size: 0.76rem;
    color: #723f28;
    background: #ffdcb8;
    border: 1px solid #e9b587;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
}

.section-picker__hint {
    margin: 0.55rem 0 0.6rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.section-picker__controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-picker__label {
    font-size: 0.88rem;
    color: #6b5845;
}

.section-picker__select,
.section-picker__input {
    border: 1px solid #ceb79d;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    padding: 0.47rem 0.6rem;
    min-width: 4rem;
    font-size: 1rem;
}

.section-picker__select:focus,
.section-picker__input:focus {
    outline: none;
    border-color: var(--accent-soft);
    box-shadow: 0 0 0 3px rgba(173, 111, 49, 0.2);
}

.section-picker__footer {
    margin-top: 0.58rem;
}

.modal-backdrop-layer {
    background: rgba(34, 10, 8, 0.66);
    backdrop-filter: blur(2px);
}

.modal-card {
    width: min(880px, 100%);
    max-height: 86vh;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #d5c0aa;
    background: #fff;
    box-shadow: var(--shadow-card);
    animation: rise-in 0.22s ease both;
}

.modal-loading {
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 3px solid #edd8be;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.8rem 0.95rem;
    border-bottom: 1px solid #ead8c4;
    background: #fffdf9;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-family: "Alegreya", "Frank Ruhl Libre", serif;
}

.modal-body {
    max-height: calc(86vh - 138px);
    overflow-y: auto;
    padding: 0.9rem;
}

.modal-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    border-top: 1px solid #ead8c4;
    background: #fffdf9;
    padding: 0.8rem 0.95rem;
}

.modal-context {
    margin-bottom: 0.85rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #ead8c4;
}

.modal-context__label {
    margin: 0;
    font-size: 0.84rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-context__ref {
    margin: 0.22rem 0 0;
    font-weight: 700;
    color: var(--ink);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.commentary-group {
    border: 1px solid #e4d2bd;
    border-radius: 11px;
    overflow: hidden;
    margin-bottom: 0.58rem;
}

.commentary-group__header {
    width: 100%;
    border: 0;
    padding: 0.58rem 0.72rem;
    background: #f9f1e6;
    display: flex;
    align-items: center;
    gap: 0.52rem;
    text-align: start;
}

.commentary-group__title {
    font-weight: 700;
    color: #5f4b38;
}

.commentary-group__count {
    margin-inline-start: auto;
    font-size: 0.78rem;
    color: #744417;
    background: #f7dfc2;
    border: 1px solid #deb38c;
    border-radius: 999px;
    padding: 0.08rem 0.45rem;
}

.commentary-group__action {
    font-size: 0.76rem;
    color: var(--accent);
    text-decoration: underline;
}

.commentary-group__items {
    background: #fff;
    padding: 0.45rem;
}

.commentary-source {
    border: 1px solid #ecdece;
    border-radius: 9px;
    margin-bottom: 0.45rem;
    overflow: hidden;
}

.commentary-source:last-child {
    margin-bottom: 0;
}

.commentary-source__header {
    width: 100%;
    border: 0;
    background: #fff;
    padding: 0.46rem 0.56rem;
    display: flex;
    align-items: center;
    gap: 0.48rem;
    text-align: start;
}

.commentary-source__title {
    flex: 1;
    color: #4d3a2a;
    font-weight: 600;
    font-size: 0.94rem;
}

.commentary-source__count {
    font-size: 0.74rem;
    color: #6d5b4b;
    background: #efe4d7;
    border-radius: 999px;
    padding: 0.05rem 0.38rem;
}

.commentary-source__body {
    background: #faf6f0;
    padding: 0.45rem;
}

.commentary-option {
    display: flex;
    align-items: flex-start;
    gap: 0.62rem;
    border-radius: 7px;
    padding: 0.36rem 0.4rem;
    cursor: pointer;
    transition: background-color 0.13s ease;
}

.commentary-option:hover {
    background: #fff;
}

.commentary-option__checkbox {
    margin-top: 0.18rem;
    accent-color: #b96d2f;
    width: 1rem;
    height: 1rem;
}

.commentary-option__content {
    min-width: 0;
}

.commentary-option__title {
    font-size: 0.9rem;
    color: #4c3b2c;
}

.suggestions-block {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #ead8c5;
}

.suggestions-block__title {
    margin: 0;
    color: #5a4736;
    font-size: 1rem;
}

.suggestions-block__hint {
    margin: 0.3rem 0 0.65rem;
    color: var(--muted);
    font-size: 0.87rem;
}

.suggestion-item {
    width: 100%;
    text-align: start;
    border: 1px solid #e7d5c1;
    border-radius: 9px;
    background: #fff;
    padding: 0.53rem 0.62rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.suggestion-item:hover {
    background: #f9f1e6;
}

.suggestion-item__title {
    color: #4d3d2f;
    font-weight: 600;
}

.suggestion-item__meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-action {
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.56rem 0.88rem;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.primary-button {
    border: 1px solid var(--accent-strong);
    background: linear-gradient(180deg, #e05625, #ba2f15);
    color: #fffaf2;
}

.primary-button:hover {
    background: linear-gradient(180deg, #ec642e, #c5391a);
}

.secondary-button {
    border: 1px solid #d1b89b;
    background: #fff;
    color: #5a4430;
}

.secondary-button:hover {
    background: #ffeed8;
}

.danger-button {
    border: 1px solid #c6857a;
    background: #fff4f2;
    color: var(--danger);
    min-width: 2.2rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.danger-button:hover {
    background: #fbe4df;
}

.ghost-action {
    border: 1px solid transparent;
    background: transparent;
    color: var(--accent);
    text-decoration: underline;
    padding: 0.45rem 0.6rem;
}

.ghost-action:hover {
    color: var(--accent-strong);
    background: #ffe8cd;
    text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #f29a4a;
    outline-offset: 2px;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.ghost-action:disabled,
.sheet-add-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

[dir="rtl"] .segment-card__remove {
    right: auto;
    left: 0.42rem;
}

[dir="rtl"] .workspace-panel__scroll {
    padding-right: 0;
    padding-left: 0.15rem;
}

[dir="rtl"] .segment-content {
    padding-inline-start: 0;
}

[dir="rtl"] .commentary-display {
    border-inline-start: 0;
    border-inline-end: 4px solid #d59256;
}

[dir="rtl"] .search-indicator {
    right: auto;
    left: 0.7rem;
}

[dir="rtl"] .search-clear-button {
    right: auto;
    left: 2.3rem;
}

[dir="rtl"] .site-header__brand {
    flex-direction: row-reverse;
}

[dir="rtl"] .site-header__title-wrap {
    text-align: right;
}

[dir="rtl"] .site-nav {
    justify-self: start;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-hebrew {
    font-family: "Frank Ruhl Libre", "Noto Sans Hebrew", serif;
    line-height: 1.8;
}

.he-ref {
    direction: rtl;
    unicode-bidi: plaintext;
}

[x-cloak] {
    display: none !important;
}

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f8e6d1;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: #e7b283;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #d88a48;
}

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

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-drop {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 1024px) {
    .workspace-grid {
        grid-template-columns: 360px minmax(0, 1fr);
    }
}

@media (max-width: 1023px) {
    .site-header__inner {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .site-header__brand {
        width: 100%;
    }

    .site-header__badge {
        width: clamp(3.4rem, 11vw, 4.4rem);
        height: clamp(3.4rem, 11vw, 4.4rem);
    }

    .site-nav {
        margin-top: 0.35rem;
        justify-self: start;
        width: 100%;
        border-radius: 14px;
        padding: 0.42rem;
        gap: 0.34rem;
    }

    .site-nav__link {
        flex: 1 1 calc(33.333% - 0.34rem);
        min-width: 7.5rem;
        text-align: center;
    }

    .site-help {
        white-space: normal;
        width: 100%;
        justify-content: flex-start;
    }

    .workspace-grid {
        min-height: auto;
    }

    .workspace-panel {
        min-height: auto;
        overflow: visible;
    }

    .workspace-panel__scroll {
        max-height: none;
        overflow: visible;
    }

    .sheet-toolbar {
        align-items: stretch;
    }

    .sheet-toolbar__meta {
        width: 100%;
        align-items: flex-start;
    }

    .sheet-toolbar__actions {
        justify-content: flex-start;
    }

    .sheet-rename-input {
        min-width: 0;
        width: 100%;
    }

    .sheet-title {
        font-size: 1.55rem;
    }

    .static-page__hero,
    .static-page__card {
        padding: 0.9rem 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
