.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 38px 12px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 15px;
}

.search-box.inline input {
    padding: 10px 36px 10px 12px;
}

.search-box button {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--muted);
}

.search-results {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow: auto;
    position: absolute;
    width: 100%;
    z-index: 20;
}

.search-result {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

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

.search-result:hover {
    background: rgba(37, 99, 235, 0.06);
}

.search-result small {
    color: var(--muted);
}

.laws-layout {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 260px;
    gap: 14px;
    align-items: start;
    padding-right: 12px;
    height: calc(100vh - 160px);
    min-height: 480px;
}

.law-main-wrapper {
    background: transparent;
    height: 100%;
    min-height: 0;
}

.law-sidebar,
.law-sidebar-right {
    padding: 14px;
    height: 100%;
}

.law-sidebar {
    width: 300px;
}

.law-sidebar-right {
    width: 260px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.pill.small {
    padding: 6px 10px;
    font-size: 12px;
}

.pill.small.ghost {
    background: #fff;
    border-color: var(--border);
    cursor: pointer;
}

.law-list {
    height: 100%;
    overflow-y: auto;
    height: 85vh;
    display: flow;
    gap: 8px;
}

.law-item {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.law-item:hover {
    border-color: rgba(37, 99, 235, 0.3);
}

.law-item .title {
    font-weight: 700;
}

.law-item .favorite {
    color: rgba(37, 99, 235, 0.8);
}

.law-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.law-actions button {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    font-weight: 700;
}

.law-actions button:hover {
    border-color: rgba(37, 99, 235, 0.35);
}

.law-main-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.law-main-wrapper {
    height: 100%;
}

.law-content {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 12px;
    padding: 8px 0;
    height: 100%;
    min-height: 0;
    overflow: auto;
}

.law-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 12px;
    height: fit-content;
    max-height: 100%;
    overflow: hidden;
}

.law-panel.placeholder {
    box-shadow: none;
    border-style: dashed;
    color: var(--muted);
}

.law-panel.active {
    border-color: rgba(37, 99, 235, 0.4);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.16);
}

/* Soft, pastel color themes per law */
.law-panel.theme-1 { background: rgba(231, 240, 255, 0.9); } /* zartes Blau */
.law-panel.theme-2 { background: rgba(228, 248, 239, 0.9); } /* sanftes Grün */
.law-panel.theme-3 { background: rgba(255, 243, 228, 0.9); } /* warmes Apricot */
.law-panel.theme-4 { background: rgba(245, 236, 255, 0.9); } /* leichtes Flieder */
.law-panel.theme-5 { background: rgba(255, 248, 234, 0.9); } /* helles Creme-Gelb */

.law-panel.theme-1 .law-panel.theme-2 .law-panel.theme-3 .law-panel.theme-4 .law-panel.theme-4 {
    height: 100%;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.panel-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    font-weight: 700;
    flex-wrap: wrap;
}

.panel-tab-title {
    color: var(--text);
}

.panel-tab-subtitle {
    color: var(--muted);
    font-weight: 600;
}

.panel-header .muted.tiny {
    font-size: 12px;
    margin: 0;
}

.panel-close {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-weight: 700;
}

.panel-close:hover {
    border-color: rgba(37, 99, 235, 0.35);
}

.panel-nav {
    display: inline-flex;
    gap: 6px;
}

.nav-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-weight: 700;
    color: var(--muted);
}

.nav-btn:hover {
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--text);
}

.paragraph {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.paragraph:last-child {
    border-bottom: none;
}

.paragraph h3 {
    margin: 0 0 6px;
}

.paragraph .number {
    color: var(--accent);
    font-weight: 700;
    margin-right: 6px;
}

.paragraph .title {
    color: var(--muted);
}

.paragraph .favorite {
    cursor: pointer;
    color: rgba(37, 99, 235, 0.7);
    margin-left: 8px;
}

.paragraph-body {
    max-height: 60vh;
    overflow: auto;
}

.paragraph-list {
    height: 100%;
    height: 85vh;
    overflow-y: auto;
    display: grid;
    gap: 6px;
}

.paragraph-item {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    position: relative;
    width: 200px;
}

.paragraph-item.active {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.06);
}

.paragraph-item .number {
    font-weight: 700;
    margin-right: 6px;
}

.paragraph-item .title {
    color: var(--muted);
}

.paragraph-pin {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 4px 6px;
    cursor: pointer;
    display: none;
}

.paragraph-item:hover .paragraph-pin {
    display: inline-flex;
}

@media (max-width: 1100px) {
    .laws-layout {
        grid-template-columns: 1fr;
    }
    .law-sidebar,
    .law-sidebar-right {
        order: 2;
    }
}
