/**
 * Social Post Prompt Generator - Styles.
 * Compact, clean layout.
 */

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.35;
    color: #333;
    background-color: #fff;
}

/* Layout: use full width, no narrow column */
.page {
    max-width: 100%;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
}

/* Header – compact */
.header {
    flex-shrink: 0;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.header-brand {
    flex: 0 1 auto;
}

.title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #222;
    letter-spacing: -0.02em;
}

.header-factoid {
    margin: 4px 0 0 0;
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
    letter-spacing: 0;
}

.btn-user-guide {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
}

.btn-user-guide:hover {
    background: #eee;
    color: #222;
    border-color: #ccc;
}

/* Main: single column, 90% width */
.main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 90%;
    margin: 0 auto;
}

.usage-panel {
    flex-shrink: 0;
}

.usage-title {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
}

.usage-text {
    margin: 0;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.35;
}

/* Panels – tight padding */
.panel {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
}

.generation-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.panel-desc {
    margin: 0;
    font-size: 0.75rem;
    color: #555;
    line-height: 1.3;
}

.btn-generate {
    align-self: flex-start;
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: #222;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.btn-generate:hover:not(:disabled) {
    background: #444;
}

.btn-generate:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-generate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Output type: mutually exclusive radios */
.output-type-fieldset {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fafafa;
}
.output-type-legend {
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    padding: 0 6px;
    margin-bottom: 6px;
}
.output-type-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.output-type-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #333;
    cursor: pointer;
}
.output-type-option input {
    margin: 0;
}

/* Output panel – fills remaining space, compact rows */
.output-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.output-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #222;
    flex-shrink: 0;
}

.output-content {
    margin: 0;
    min-height: 0;
    overflow: auto;
}

.output-placeholder {
    margin: 0;
    color: #888;
    font-size: 0.8rem;
}

/* Single combined Canva prompt output */
.output-canva {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.canva-prompt-field {
    width: 100%;
    min-height: 0;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #222;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    resize: vertical;
    cursor: text;
}

.canva-prompt-field:focus {
    outline: none;
    border-color: #999;
    background: #fff;
}

.btn-copy {
    align-self: flex-start;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #222;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-copy:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.output-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.output-sections .output-row p {
    margin: 0;
}

.output-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2px 8px;
    padding: 2px 0 4px 0;
    border-bottom: 1px solid #eee;
    min-height: 0;
}

.output-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.output-row--block {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
}

.output-row--block .output-label {
    margin-bottom: 1px;
}

.output-label {
    flex: 0 0 100px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.output-value {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: #222;
}

.output-value--copy {
    margin: 0;
    padding: 2px 6px 3px 6px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 3px;
    cursor: text;
    user-select: text;
    font-size: 0.8rem;
    line-height: 1.25;
}

.output-value--copy:hover {
    background: #f5f5f5;
}

/* First row: Topic, Post type, Tone on one line to save vertical space */
.output-row--meta {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto 1fr;
    gap: 2px 8px;
    align-items: center;
    padding-bottom: 4px;
}

.output-row--meta .output-label {
    flex: none;
}

.output-row--meta .output-value {
    flex: none;
}

/* Output: each field with lock alongside */
.output-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e5e5;
}

.output-field-row {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 12px;
    align-items: center;
    font-size: 0.85rem;
    min-height: 28px;
}

.output-field-label {
    font-weight: 600;
    color: #555;
}

.output-field-value {
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.output-field-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.output-field-lock {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.output-field-lock-input {
    margin: 0;
}

.output-field-lock-label {
    font-size: 0.8rem;
    color: #555;
}

.btn-reroll {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: #333;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-reroll:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}

.btn-reroll:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.output-hint {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.4;
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.btn-save-prompt {
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
    background: #fff;
    border: 1px solid #222;
    border-radius: 5px;
    cursor: pointer;
}

.btn-save-prompt:hover {
    background: #222;
    color: #fff;
}

/* Saved prompts – grid spans 90% of page width */
.saved-panel {
    width: 90vw;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

.saved-title {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
}

.saved-desc {
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: #555;
}

.saved-tiles {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
    grid-auto-rows: minmax(min-content, auto);
}

.saved-empty {
    margin: 0;
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.saved-tile {
    padding: 14px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left-width: 4px;
    border-radius: 6px;
}

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

.saved-tile-topic {
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

.saved-tile-tone {
    font-size: 0.85rem;
    color: #666;
}

.saved-tile-objective {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.saved-tile-date {
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
}

.saved-tile-overlay {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    color: #222;
}

.saved-tile-caption {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: #555;
}

.saved-tile-prompt {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    border: 1px solid #eee;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
}

.saved-tile-actions {
    display: flex;
    gap: 8px;
}

.btn-tile-copy,
.btn-tile-assign,
.btn-tile-delete {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}

.btn-tile-copy:hover,
.btn-tile-assign:hover {
    background: #f0f0f0;
}

.btn-tile-delete {
    color: #b33;
    border-color: #ecc;
}

.btn-tile-delete:hover {
    background: #fee;
}

/* Calendar – left/right split */
/* Calendar – 90% width like saved panel */
.calendar-panel {
    width: 90vw;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

.calendar-split {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.calendar-left {
    flex: 0 0 auto;
    min-width: 280px;
    max-width: 420px;
}

.calendar-right {
    flex: 1 1 auto;
    min-width: 240px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fafafa;
}

.calendar-upcoming-title {
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #222;
}

.calendar-upcoming-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.calendar-upcoming-section {
    border-bottom: 1px solid #eee;
}

.calendar-upcoming-section:last-child {
    border-bottom: none;
}

.calendar-upcoming-toggle {
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calendar-upcoming-toggle:hover {
    background: #e8e8e8;
}

.calendar-upcoming-toggle::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    transition: transform 0.2s;
}

.calendar-upcoming-section.collapsed .calendar-upcoming-toggle::after {
    transform: rotate(-90deg);
}

.calendar-upcoming-content {
    padding: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.calendar-upcoming-content--collapsed,
.calendar-upcoming-section.collapsed .calendar-upcoming-content {
    display: none;
}

.calendar-upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-upcoming-item {
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left-width: 4px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.calendar-upcoming-item-topic {
    font-weight: 600;
    color: #222;
}

.calendar-upcoming-item-date {
    font-size: 0.75rem;
    color: #666;
    margin-top: 2px;
}

.calendar-upcoming-empty {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    padding: 8px 0;
}

.calendar-title {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
}

.calendar-desc {
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: #555;
}

.calendar-schedule-month {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-schedule-month {
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: #4a90d9;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-schedule-month:hover {
    background: #3a7bc8;
}

.btn-export-csv {
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
}

.btn-export-csv:hover {
    background: #eee;
}

.calendar-schedule-hint {
    font-size: 0.8rem;
    color: #666;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.btn-calendar-prev,
.btn-calendar-next {
    padding: 8px 16px;
    font-size: 1.2rem;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.btn-calendar-prev:hover,
.btn-calendar-next:hover {
    background: #f5f5f5;
}

.calendar-month-year {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-weekday {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    padding: 4px;
    text-align: center;
}

.calendar-day {
    min-height: 64px;
    padding: 6px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.calendar-day:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

.calendar-day-num {
    font-size: 0.9rem;
    font-weight: 600;
}

.calendar-day-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 4px;
}

.calendar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.calendar-dot-more {
    font-size: 0.7rem;
    color: #666;
}

.calendar-day-detail {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fafafa;
}

.calendar-day-detail.hidden {
    display: none !important;
}

.calendar-day-detail-title {
    margin: 0 0 12px 0;
    font-size: 1rem;
}

.calendar-day-prompts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-day-empty {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.calendar-day-card {
    padding: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left-width: 4px;
    border-radius: 4px;
}

.calendar-day-card-topic {
    font-weight: 600;
    font-size: 0.85rem;
}

.calendar-day-card-overlay {
    margin: 4px 0 8px 0;
    font-size: 0.85rem;
    color: #555;
}

.calendar-day-card-prompt-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin: 8px 0 4px 0;
}

.calendar-day-card-prompt {
    width: 100%;
    margin: 0 0 10px 0;
    padding: 10px;
    font-size: 0.8rem;
    font-family: inherit;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
    min-height: 120px;
}

.calendar-day-card-engagement {
    margin: 10px 0;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.calendar-day-card-engagement-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.calendar-day-card-engagement-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.engagement-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.engagement-field span {
    min-width: 58px;
    color: #555;
}

.engagement-input {
    width: 60px;
    padding: 4px 6px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.engagement-notes .engagement-input {
    width: 140px;
}

.calendar-day-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-calendar-day-copy {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}

.btn-calendar-day-copy:hover {
    background: #f0f0f0;
}

.btn-calendar-day-copy.copied {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.btn-unassign {
    padding: 4px 10px;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
}

.btn-unassign:hover {
    background: #fee;
    color: #b33;
}

.input-date {
    width: 100%;
    padding: 8px;
    font-size: 1rem;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

/* Tabs */
.nav-tabs {
    margin-top: 8px;
    flex-basis: 100%;
    display: flex;
    gap: 4px;
}

.tab-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
}

.tab-btn:hover {
    background: #eee;
    color: #222;
}

.tab-btn.active {
    background: #222;
    color: #fff;
    border-color: #222;
}

.tab-panel.hidden {
    display: none !important;
}

/* Manage phrases: span 90% width, not constrained by main */
#tabManage {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 100vw;
}

.manage-panel {
    grid-column: 1 / -1;
    width: 90%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
}

.manage-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #222;
}

.manage-desc {
    margin: 0 0 12px 0;
    font-size: 0.8rem;
    color: #555;
}

.manage-desc code {
    font-size: 0.75rem;
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 3px;
}

/* Wrapper with visible scrollbars so users see the page may scroll */
.manage-columns-wrapper {
    overflow: auto;
    overflow-x: auto;
    overflow-y: auto;
    max-height: min(75vh, 800px);
    padding-bottom: 12px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
    scrollbar-gutter: stable;
}

.manage-columns {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    align-items: start;
    min-width: min-content;
}

.manage-column {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fafafa;
    min-height: 0;
    height: auto;
}

.manage-col-title {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
}

.manage-col-hint {
    margin: 0 0 8px 0;
    font-size: 0.75rem;
    color: #666;
}

.manage-col-note {
    margin: 0 0 8px 0;
    font-size: 0.75rem;
    padding: 6px 8px;
    border-radius: 4px;
}

.manage-col-note--dev {
    background: #fff8e6;
    color: #7d6600;
    border: 1px solid #e6d98a;
}

.manage-col-note--dev::before {
    content: 'ℹ ';
}

.manage-columns-wrapper::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.manage-columns-wrapper::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 4px;
}

.manage-columns-wrapper::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
}

.manage-columns-wrapper::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.btn-add-frustration {
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

.btn-add-frustration:hover {
    background: #f0f0f0;
}

.btn-add {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #222;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
}

.btn-add:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.manage-list {
    min-height: 0;
    overflow-y: visible;
}

.manage-subsection {
    margin-bottom: 12px;
}

.manage-subsection:last-child {
    margin-bottom: 0;
}

/* Collapsible subsection */
.manage-subsection.collapsible .manage-subsection-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    margin: 0 0 6px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
}

.manage-subsection.collapsible .manage-subsection-toggle:hover {
    background: #e5e5e5;
}

.manage-subsection-arrow {
    flex-shrink: 0;
    font-size: 0.7rem;
}

.manage-subsection.collapsed .manage-sublist {
    display: none;
}

.manage-subtitle {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
}

.manage-subsection-toggle .manage-subtitle {
    margin-bottom: 0;
    color: #333;
}

.manage-sublist {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.manage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 0.8rem;
}

.manage-item-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-item-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.btn-edit,
.btn-delete {
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
}

.btn-edit:hover,
.btn-delete:hover {
    background: #f0f0f0;
}

.btn-delete {
    color: #b33;
    border-color: #ecc;
}

.btn-delete:hover {
    background: #fee;
}

.manage-error {
    margin: 0;
    font-size: 0.8rem;
    color: #b33;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

.modal-title {
    margin: 0;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
}

.modal-body {
    padding: 16px;
}

.modal--guide {
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-body--guide {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.user-guide-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
}

.user-guide-content h3 {
    margin: 1em 0 0.4em 0;
    font-size: 1rem;
    font-weight: 600;
    color: #222;
}

.user-guide-content h3:first-child {
    margin-top: 0;
}

.user-guide-content p {
    margin: 0 0 0.6em 0;
}

.modal-actions {
    padding: 12px 16px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-cancel,
.btn-save {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
}

.btn-cancel {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.btn-save {
    background: #222;
    border: none;
    color: #fff;
}

.btn-cancel:hover {
    background: #f5f5f5;
}

.btn-save:hover {
    background: #444;
}

.form-group {
    margin-bottom: 12px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-group input.readonly {
    background: #f5f5f5;
    color: #666;
}

/* Responsive: stack on narrow/small screens */
@media (max-width: 1100px) {
    .manage-columns {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .manage-columns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .page {
        max-height: none;
    }

    .main {
        grid-template-columns: 1fr;
    }

    .output-row--meta {
        grid-template-columns: auto 1fr;
    }

    .manage-columns {
        grid-template-columns: 1fr;
    }

    .output-field-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 8px;
    }

    .output-field-label {
        grid-column: 1;
        grid-row: 1;
    }

    .output-field-value {
        grid-column: 1;
        grid-row: 2;
    }

    .output-field-actions {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: center;
    }
}
