:root {
    --ink: #1c2230;
    --muted: #5c6678;
    --line: #dde2ea;
    --paper: #ffffff;
    --page: #f4f6f9;
    --accent: #2f5596;
    --accent-ink: #ffffff;
    --error: #b3261e;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
}

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

h1 {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.3;
}

h2 {
    margin: 0 0 10px;
    font-size: 17px;
}

.page {
    min-height: 100vh;
}

.top {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.top .brand {
    margin-right: auto;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}

.top .who {
    color: var(--muted);
}

.top form {
    margin: 0;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    font: inherit;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
}

button.primary,
.button.primary {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: var(--accent);
}

button.mark-done {
    color: #fff;
    background: #227542;
    border-color: #227542;
}

button.link {
    padding: 0;
    color: var(--accent);
    background: none;
    border: 0;
}

input,
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid #c9d0db;
    border-radius: 6px;
}

input[type=file] {
    padding: 6px;
}

textarea {
    resize: vertical;
}

label {
    display: block;
    margin: 14px 0 4px;
    font-weight: 600;
}

.error {
    color: var(--error);
}

.hint,
.empty,
.meta,
.crumbs,
.count {
    color: var(--muted);
}

.hint {
    margin: 4px 0 0;
    font-size: 13px;
}

.crumbs {
    margin: 0 0 4px;
}

.heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.heading h1 {
    margin: 0;
    flex: 1 1 300px;
}

.number {
    color: var(--muted);
    font-weight: 400;
}

/* Sign in */
.signin {
    max-width: 360px;
    margin: 12vh auto 0;
    padding: 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.signin button {
    width: 100%;
    margin-top: 18px;
}

.validation-message {
    margin: 4px 0 0;
    color: var(--error);
    font-size: 13px;
}

/* Lists */
.organisation {
    margin: 20px 0 8px;
}

.organisation:first-of-type {
    margin-top: 0;
}

.projects,
.issues {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.projects li,
.issues > li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
}

.projects li:first-child,
.issues > li:first-child {
    border-top: 0;
}

.projects a,
.issues .title {
    flex: 1 1 320px;
    font-weight: 600;
    text-decoration: none;
}

.issues .title:hover,
.projects a:hover {
    text-decoration: underline;
}

.issues .meta {
    flex-basis: 100%;
    font-size: 13px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.tabs a {
    padding: 6px 12px;
    color: var(--ink);
    text-decoration: none;
    border-radius: 6px;
}

.tabs a[aria-current=page] {
    font-weight: 600;
    background: var(--paper);
    box-shadow: inset 0 0 0 1px var(--line);
}

/* Status badges */
.status {
    display: inline-block;
    padding: 1px 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 999px;
}

.status.open { color: #1d5b2e; background: #dcf1e2; }
.status.inprogress { color: #1f4a8a; background: #dde8f8; }
.status.waitingonclient { color: #7a4b00; background: #fbeccc; }
.status.resolved { color: #0b5e62; background: #d7f0f1; }
.status.done { color: #4b3a8a; background: #e8e2f7; }
.status.parked { color: #505a68; background: #e6e9ee; }

/* An issue's thread */
.thread {
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.entry {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.entry.latest {
    border-color: #b9c8e3;
}

.entry .meta {
    margin: 0;
    font-size: 13px;
}

.entry .meta b {
    color: var(--ink);
}

.entry .body {
    margin-top: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.files img,
.files video {
    display: block;
    max-width: min(100%, 420px);
    max-height: 320px;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.reply {
    padding: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.issue-form .actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.reply select {
    max-width: 260px;
}

.status.planned { color: #0b5e62; background: #d7f0f1; }

/* Issues and New Features, above the list's own tabs. */
.sections {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.sections a {
    margin-bottom: -1px;
    padding: 6px 2px 8px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.sections a[aria-current=page] {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.sections .count {
    font-weight: 400;
}

/* Type badges: a bug in what was built, a change to it, missing from the current system, or a new feature. */
.kind {
    display: inline-block;
    padding: 1px 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px currentColor;
}

.kind.bug { color: #a0281e; }
.kind.change { color: #6b3fa0; }
.kind.missing { color: #8a5a00; }
.kind.feature { color: #1f5fa8; }

/* The new item form's choice of type. */
.kinds {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.kinds legend {
    margin-bottom: 4px;
    font-weight: 600;
}

.kinds label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-weight: 400;
}

.kinds .hint {
    color: var(--muted);
}

.issue-form .kinds label {
    justify-content: flex-start;
    margin: 0;
}

.issue-form .kinds input {
    flex: none;
    width: auto;
    margin: 0;
}

/* The build, fixed at the bottom left of the window whatever the page's length or zoom. */
.build {
    position: fixed;
    left: 0;
    bottom: 0;
    padding: 3px 8px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--muted);
    background: var(--paper);
    border-top-right-radius: 6px;
    box-shadow: 0 0 0 1px var(--line);
    pointer-events: none;
    z-index: 10;
}

/* Room for it under the last thing on the page. */
.page {
    padding-bottom: 28px;
}

/* Bug details follow the selected type without requiring JavaScript. */
.bug-fields { display: none; }
.issue-form:has(input[name="kind"][value="bug"]:checked) .bug-fields { display: block; }
.issue-form:has(input[name="kind"][value="bug"]:checked) .general-description { display: none; }
.report-section { margin-top: 16px; }
.report-section h2 { margin: 0; font-size: 15px; }
.entry .report-section .body { margin-top: 4px; }

/* Editing a report */
.entry .meta .edit { margin-left: 8px; }
.edit-files { margin: 8px 0 0; }
.earlier { margin-top: 8px; }
.earlier summary { cursor: pointer; color: var(--muted); }
.current-files { margin: 16px 0 0; padding: 0; border: 0; }
.current-files label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-weight: normal; }

/* Status definitions stay hidden until the question mark is opened. */
.status-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 4px;
}
.status-label label { margin: 0; }
.status-help { position: relative; }
.status-help summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: var(--muted);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
}
.status-help summary::-webkit-details-marker { display: none; }
.status-help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-help-content {
    position: absolute;
    bottom: calc(100% + 6px);
    left: -52px;
    z-index: 5;
    width: min(320px, calc(100vw - 64px));
    padding: 12px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px #1c223026;
    font-size: 13px;
}
.status-help-content p { margin: 8px 0 0; }

.status.requirescall { color: #7a4b00; background: #fbeccc; }

/* Small attachment links in every client's issue lists. */
.attachment-previews {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    flex-basis: 100%;
    margin: 2px 0;
    padding: 0;
    list-style: none;
}
.attachment-previews > li { margin: 0; padding: 0; border: 0; }
.attachment-preview {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 44px;
    overflow: hidden;
    color: var(--muted);
    text-decoration: none;
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: 4px;
}
.attachment-preview:hover { border-color: var(--accent); }
.attachment-preview:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.attachment-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.attachment-format {
    position: absolute;
    bottom: 3px;
    padding: 0 3px;
    background: var(--paper);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
    border-radius: 2px;
}
.attachment-format.pdf { color: #b3261e; }

/* Reply ownership is separate from the issue's progress status. */
.reply-badge {
    display: inline-block;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
}
.reply-needed { color: #7a4b00; background: #fbeccc; }
.reply-waiting { color: #1f4a8a; background: #dde8f8; }
.issue-form .actions { flex-wrap: wrap; }
