:root {
    /* Black/green theme - palette sourced from reference/22.png */
    --bg: #071414;
    --bg-sidebar: #0a1e20;
    --bg-panel: #0f2528;
    --bg-panel-hover: #163338;
    --border: #1f3d40;
    --text: #dff7f0;
    --text-muted: #7fa89f;
    --accent-gold: #3fd0c9;
    --accent-green: #2eaf7d;
    --accent-green-hover: #3fd0c9;
    --accent-red: #e05a4a;
}

* {
    box-sizing: border-box;
}

input[type="text"], select {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-family: inherit;
    font-size: 0.9rem;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent-gold);
}

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

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
    padding: 0 0.75rem;
}

.brand a {
    color: inherit;
    text-decoration: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sidebar-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    background: var(--bg-panel-hover);
    color: var(--text);
}

.sidebar-nav a.active {
    background: var(--bg-panel);
    color: var(--accent-gold);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0.75rem 0;
    margin-top: 1rem;
}

.sidebar-user {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.sidebar-user strong {
    color: var(--text);
}

.content {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 64rem;
}

.content-wide {
    max-width: 1400px;
}

h1, h2, h3 {
    color: var(--accent-gold);
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero-lead {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 40rem;
    line-height: 1.6;
}

.button {
    display: inline-block;
    padding: 0.6rem 1.3rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
}

.button-primary {
    background: var(--accent-green);
    color: #08150a;
}

.button-primary:hover {
    background: var(--accent-green-hover);
}

.button-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.button-secondary:hover {
    background: var(--bg-panel-hover);
}

.button:disabled {
    opacity: 0.6;
    cursor: default;
}

.feature-list {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.panel h2, .panel h3 {
    margin-top: 0;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    text-align: left;
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(224, 90, 74, 0.15);
    border: 1px solid rgba(224, 90, 74, 0.4);
    color: #ff9a8d;
}

.alert-info {
    background: rgba(63, 208, 201, 0.1);
    border: 1px solid rgba(63, 208, 201, 0.35);
    color: var(--accent-gold);
}

.char-summary table th {
    width: 6rem;
}

.char-summary-with-image {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.char-portrait {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.skill-group {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 13rem;
}

.skill-group h3 {
    margin-top: 0;
}

.skill-group table td:last-child {
    text-align: right;
    font-weight: bold;
}

#sector-canvas {
    border: 1px solid var(--border);
    background: #0d0d1a;
    cursor: grab;
    border-radius: 6px;
}

#asteroid-canvas {
    border: 1px solid var(--border);
    background: #0a1414;
    border-radius: 6px;
    cursor: pointer;
}

#asteroid-field-input {
    flex: 1;
    min-width: 20rem;
}

#asteroid-tooltip {
    position: absolute;
    display: none;
    background: rgba(20, 20, 28, 0.97);
    color: #fff;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    white-space: pre-line;
}

#sector-tooltip {
    position: absolute;
    display: none;
    background: rgba(20, 20, 28, 0.97);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    pointer-events: none;
    max-width: 20rem;
    white-space: pre-line;
}

.sector-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0.75rem;
}

.sector-controls {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.sector-controls select {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
}

.sector-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1rem;
}

.sector-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
}

.legend-triangle {
    width: 0;
    height: 0;
    display: inline-block;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid; /* color comes from the inline style above */
    background: none; /* not needed for a border-triangle, but explicit in case .legend-swatch sets one */
}

.note-editor textarea {
    width: 100%;
    min-height: 5rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.note-editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
    align-items: center;
}

.note-editor-status {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.note-editor-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.admin-table {
    width: max-content;
    min-width: 100%;
}

.admin-table th, .admin-table td {
    white-space: nowrap;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.admin-table-group {
    text-align: center;
    border-bottom: 2px solid var(--accent-green);
}

/* Subtle column banding - every other column gets a faint highlight, on
   top of whichever group tint (below) is already there. Deliberately close
   in value to the panel background, not a strong zebra effect. */
.admin-table td:nth-child(even), .admin-table th:nth-child(even) {
    background-image: linear-gradient(rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.035));
}

/* Skill-group columns additionally alternate a faint tint group-to-group,
   reinforcing the colspan headers above them - two hues only, cycled. */
.admin-table .group-even {
    background-color: rgba(46, 175, 125, 0.07);
}

.admin-table .group-odd {
    background-color: rgba(63, 208, 201, 0.07);
}

.admin-avatar {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.group-create-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.note-editor-share {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
