:root {
    --fg: #1a1a1a;
    --muted: #6b6b6b;
    --bg: #fafaf8;
    --border: #d8d8d4;
    --accent: #1a1a1a;
    --accent-fg: #fafaf8;
    --error: #b00020;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.topbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 32px;
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-link:hover {
    color: var(--fg);
}

.actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

button {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 20px;
    background: var(--accent);
    color: var(--accent-fg);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
}

button:hover:not(:disabled) {
    opacity: 0.85;
}

button:disabled {
    opacity: 0.5;
    cursor: progress;
}

.error {
    margin-top: 16px;
    padding: 12px 14px;
    color: var(--error);
    background: #fbe9ec;
    border: 1px solid #f1c6cd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.success {
    margin-top: 16px;
    padding: 12px 14px;
    color: #1a4d2e;
    background: #e6f4ea;
    border: 1px solid #b7dfc1;
    border-radius: 6px;
    font-size: 0.9rem;
}

.field-group {
    margin: 0 0 24px;
    padding: 16px 20px 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.field-group legend {
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.grid label span {
    font-weight: 500;
    color: var(--fg);
}

.grid label.span-2 {
    grid-column: 1 / -1;
}

.grid input[type="text"],
.grid textarea,
.grid select {
    width: 100%;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--fg);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    resize: vertical;
}

.grid select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%231a1a1a' d='M0 0l5 6 5-6z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.grid input[type="text"]:focus,
.grid textarea:focus,
.grid select:focus {
    outline: none;
    border-color: var(--fg);
}

.grid input:disabled,
.grid textarea:disabled,
.grid select:disabled {
    background: #f1f1ef;
    color: var(--muted);
    cursor: not-allowed;
}

.grid label .req {
    color: var(--error);
    font-style: normal;
    margin-left: 2px;
}

.grid label .form-help {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

.grid label.inline-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.grid label.inline-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--fg);
}

.grid label.inline-check span {
    font-weight: 500;
}

button.secondary {
    background: transparent;
    color: var(--fg);
    border-color: var(--border);
}

button.secondary:hover:not(:disabled) {
    border-color: var(--fg);
    opacity: 1;
}

#evidence-form .actions {
    gap: 12px;
}

@media (max-width: 560px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .grid label.span-2 {
        grid-column: auto;
    }
}

.list-main {
    max-width: 960px;
}

.empty-state {
    margin-top: 32px;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

table.entries {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.92rem;
}

table.entries th,
table.entries td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

table.entries thead th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: #f5f5f2;
    border-bottom: 1px solid var(--border);
}

table.entries tbody tr.entry-row {
    cursor: pointer;
}

table.entries tbody tr.entry-row:hover,
table.entries tbody tr.entry-row:focus {
    background: #f5f5f2;
    outline: none;
}

table.entries tbody tr.entry-row.open {
    background: #f0efeb;
}

table.entries th.col-date,
table.entries td:first-child {
    white-space: nowrap;
    color: var(--muted);
}

table.entries .detail-row td {
    padding: 16px 20px 20px;
    background: #fafaf8;
    border-bottom: 1px solid var(--border);
}

.detail-list {
    margin: 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
}

.detail-list dt {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding-top: 2px;
}

.detail-list dd {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--fg);
}

.detail-empty {
    margin: 0;
    color: var(--muted);
    font-style: italic;
}

@media (max-width: 720px) {
    table.entries th.col-capability,
    table.entries tbody td:nth-child(4) {
        display: none;
    }
    .detail-list {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }
    .detail-list dd {
        margin-bottom: 8px;
    }
}
