* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    background: #f5f5f5;
    height: 100%;
    overflow: hidden;
}

.app { max-width: 960px; margin: 0 auto; padding: 20px; height: 100%; display: flex; flex-direction: column; overflow: hidden; }

.content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 24px;
}

.navbar a { color: #333; text-decoration: none; margin-right: 16px; }
.navbar a:hover { text-decoration: underline; }
.navbar a.nav-active { border-bottom: 4px solid #888; padding-bottom: 2px; text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 8px; }

.public-page, .my-data-page { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.page-header { flex-shrink: 0; }
.data-table-wrapper { flex: 1; min-height: 0; overflow-y: auto; }

table { width: 100%; border-collapse: collapse; margin-top: 16px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid #ddd; }
th { cursor: pointer; background: #f9f9f9; user-select: none; }
th:hover { background: #eee; }

input, textarea, select {
    display: block;
    width: 100%;
    padding: 8px;
    margin: 4px 0 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

button {
    padding: 8px 16px;
    background: #888;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
button:hover { background: #666; }

.error { color: #c00; margin-top: 16px; padding: 8px; background: #fee; border-radius: 4px; }

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
}
.page-header h2 { white-space: nowrap; }

.search-bar { margin-bottom: 0; }
.search-bar input { display: inline-block; width: 300px; margin: 0; }

label { font-weight: 600; display: block; margin-top: 8px; }

.form-group { margin-bottom: 16px; max-width: 400px; }

.expanded-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #fafafa;
    max-height: calc(100vh - 160px);
    overflow: hidden;
}

.display-mode-toggle { flex-shrink: 0; }
.btn-small { padding: 3px 10px; font-size: 12px; }
.content-display {
    width: 65ch;
    padding: 1.5rem;
    padding-bottom: 6rem;
    border: 1px solid #ccc;
    word-wrap: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    max-height: calc(100vh - 190px);
    overflow-y: auto;
}
.content-display iframe {
    width: 100%;
    height: calc(100vh - 250px);
}

.source-content { white-space: pre-wrap; }
.expanded-content-noscroll { overflow: hidden; padding-bottom: 0; }
.iframe-content { padding-bottom: 0; }

.col-index { width: 2em; text-align: right; color: #999; }
.actions { display: flex; gap: 8px; white-space: nowrap; }

.scripta-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.scripta-title {
    font-size: 1.4rem;
    font-weight: 600;
}
.scripta-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.scripta-layout .content-display { flex: 1; }
.toc-panel {
    width: 200px;
    flex-shrink: 0;
    padding: 12px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: calc(100vh - 190px);
    overflow-y: auto;
}
