:root {
    --bg: #FAFAF7;
    --accent: #0F5C5C;
    --text: #1A1A1A;
    --border: #D8D8D0;
}

* {
    box-sizing: border-box;
}

body {
    position: relative;
    margin: 0;
    padding: 0 1.5rem 3rem;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("images/ekg_monitor.png") center center no-repeat;
    background-size: cover;
    opacity: 0.12;
    z-index: -1;
}

.chart-header {
    border-bottom: 2px solid var(--accent);
    padding: 1.5rem 0 1rem;
    margin-bottom: 1.5rem;
}

.chart-header h1 {
    margin: 0;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.subtitle {
    margin: 0.25rem 0 0;
    color: #555;
    font-size: 0.95rem;
}

main {
    max-width: 720px;
    margin: 0 auto;
}

h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}

.new-entry {
    margin-bottom: 2rem;
}

.entry-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

textarea,
input[type="date"] {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.6rem;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input[type="date"] {
    align-self: flex-start;
}

button {
    align-self: flex-start;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.5rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

:focus-visible {
    outline: 3px solid var(--red, #cb2e26);
    outline-offset: 3px;
}

.chart {
    display: flex;
    flex-direction: column;
}

.chart-row {
    display: grid;
    grid-template-columns: 11rem 1fr auto;
    gap: 1rem;
    align-items: start;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border);
    border-top: none;
    background: #fff;
}

.chart-row:first-child {
    border-top: 1px solid var(--border);
}

.timestamp {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 0.85rem;
    color: #444;
}

.note {
    font-size: 0.95rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.actions a,
.link-button {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1;
    color: var(--accent);
    text-decoration: none;
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
}

.actions a:hover,
.link-button:hover {
    text-decoration: underline;
}

.inline-form {
    display: contents;
}

.empty {
    color: #777;
    font-style: italic;
}

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--accent);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    body {
        padding: 0 1rem 2rem;
    }

    .chart-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .actions {
        justify-content: flex-start;
    }
}

/* Rebranded incident-record presentation. */
:root {
    --paper: #fff2f7;
    --surface: #fffafd;
    --ink: #20171d;
    --red: #d63154;
    --blue: #73cbed;
    --line: #e8bfd0;
    --muted: #765d69;
}

body {
    min-height: 100vh;
    padding: 0 1.5rem 3rem;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(240, 79, 109, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(115, 203, 237, 0.2) 2px, transparent 2px);
    background-size: 24px 24px;
    color: var(--ink);
    font-family: "Avenir Next", Avenir, "Century Gothic", sans-serif;
}

body::before {
    display: none;
}

.site-header,
main {
    max-width: 840px;
    margin: 0 auto;
}

.site-header {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: end;
    padding: 2.5rem 0 1.5rem;
    border-bottom: 3px solid var(--ink);
}

.eyebrow,
.section-number {
    margin: 0 0 0.25rem;
    color: var(--red);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.site-header .eyebrow {
    margin-bottom: 0.5rem;
}

.site-header h1,
.section-heading h2,
.empty {
    font-family: Rockwell, "Roboto Slab", Georgia, serif;
}

.site-header h1 {
    margin: 0;
    color: var(--ink);
    font-size: 3.4rem;
    line-height: 0.9;
    letter-spacing: 0;
}

.subtitle {
    max-width: 25rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.45;
}

main {
    padding-top: 2rem;
}

.entry-panel,
.incident-list {
    margin-bottom: 3rem;
}

.section-heading {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--ink);
}

.section-heading h2,
.section-heading p {
    margin-bottom: 0;
}

.section-heading h2 {
    color: var(--ink);
    border: 0;
    padding: 0;
    font-size: 1.35rem;
    letter-spacing: 0;
    text-transform: none;
}

.entry-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding-top: 1rem;
}

.entry-form label:last-of-type,
.entry-form > button {
    grid-column: 1 / -1;
}

label span {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 800;
}

textarea,
input[type="date"],
input[type="email"],
input[type="file"],
.password-input,
select {
    width: 100%;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
    padding: 0.7rem;
}

textarea {
    min-height: 7rem;
}

input[type="file"] {
    padding: 0.5rem;
}

input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    border: 1px solid var(--ink);
    background: var(--blue);
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
}

input[type="date"] {
    align-self: auto;
}

.entry-form > button {
    justify-self: start;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--blue);
    color: var(--ink);
    font-weight: 800;
    padding: 0.7rem 1rem;
}

.entry-form > button:hover,
.entry-form > button:focus-visible {
    background: var(--red);
    color: #fff;
}

.entries {
    border-top: 1px solid var(--line);
    list-style: none;
    margin: 0;
    padding: 0;
}

.entries > li {
    margin: 0;
    padding: 0;
}

.incident {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.incident-meta {
    display: grid;
    gap: 0.45rem;
}

time {
    font-size: 0.85rem;
    font-weight: 800;
}

.category {
    width: fit-content;
    background: var(--red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
    padding: 0.25rem 0.4rem;
}

.incident .note {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.45;
}

.incident-body {
    min-width: 0;
}

.upload-error {
    margin-bottom: 1rem;
    border: 2px solid var(--red);
    background: var(--surface);
    padding: 0.75rem 1rem;
}

.upload-error p {
    margin: 0;
    line-height: 1.4;
}

.upload-error p + p {
    margin-top: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.screenshot-field,
.existing-screenshot,
.remove-screenshot {
    grid-column: 1 / -1;
}

.screenshot-field small {
    display: block;
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.field-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 800;
}

.screenshot-link {
    display: inline-block;
    margin-top: 0.75rem;
    border: 2px solid var(--ink);
    background: var(--surface);
    line-height: 0;
}

.screenshot-link:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 3px;
}

.screenshot-thumbnail {
    display: block;
    width: auto;
    max-width: min(320px, 100%);
    height: auto;
}

.remove-screenshot {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: fit-content;
    font-weight: 800;
}

.remove-screenshot input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: var(--red);
}

.remove-screenshot span {
    margin: 0;
}

.actions {
    display: flex;
    gap: 0.75rem;
    white-space: nowrap;
}

.actions form {
    margin: 0;
}

.actions a,
.link-button,
.back-link {
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration-color: var(--red);
    text-underline-offset: 0.2em;
}

.link-button {
    border: 0;
    background: transparent;
    padding: 0;
}

.link-button:hover,
.link-button:focus-visible {
    background: transparent;
    color: var(--red);
}

.account {
    display: grid;
    justify-items: end;
    gap: 0.4rem;
}

.account form {
    margin: 0;
}

.auth-main {
    max-width: 560px;
}

.auth-panel {
    margin-top: 1rem;
}

.auth-form label,
.auth-form .form-field,
.auth-form > button {
    grid-column: 1 / -1;
}

.password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.password-toggle {
    align-self: stretch;
    min-height: 44px;
    min-width: 44px;
    border: 1px solid var(--ink);
    border-radius: 0;
    background: var(--blue);
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.5rem 0.75rem;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: var(--red);
    color: #fff;
}

.password-toggle[hidden] {
    display: none;
}

.messages {
    margin-top: 1rem;
}

.message {
    margin: 0;
    border-left: 4px solid var(--red);
    background: var(--surface);
    padding: 0.75rem;
    font-weight: 700;
}

.auth-switch {
    margin-top: 1rem;
    color: var(--muted);
}

.auth-switch a {
    color: var(--ink);
    font-weight: 800;
    text-decoration-color: var(--red);
    text-underline-offset: 0.2em;
}

.auth-intro {
    margin: 1rem 0 0;
    color: var(--muted);
}

.account-links {
    margin: 0;
}

.account-links a {
    color: var(--ink);
    font-weight: 800;
    text-decoration-color: var(--red);
    text-underline-offset: 0.2em;
}

.account-details {
    margin: 1rem 0 0;
    display: grid;
    gap: 0.75rem;
}

.account-details div {
    display: grid;
    gap: 0.15rem;
}

.account-details dt {
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.account-details dd {
    margin: 0;
    font-weight: 700;
    word-break: break-word;
}

.danger-panel {
    border-color: var(--red);
}

.danger-warning {
    margin: 1rem 0 0;
    border-left: 4px solid var(--red);
    background: var(--surface);
    padding: 0.75rem;
    font-weight: 700;
}

.confirm-delete {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.confirm-delete input {
    margin-top: 0.3rem;
}

.danger-button {
    background: var(--red);
    color: #fff;
}

.danger-button:hover,
.danger-button:focus-visible {
    background: var(--ink);
}

.empty {
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 1.15rem;
}

@media (max-width: 600px) {
    body {
        padding: 0 1rem 2rem;
    }

    .site-header {
        display: block;
        padding-top: 1.75rem;
    }

    .site-header h1 {
        font-size: 2.8rem;
    }

    .subtitle {
        margin-top: 1rem;
    }

    .account {
        justify-items: start;
        margin-top: 1rem;
    }

    .entry-form,
    .incident {
        grid-template-columns: 1fr;
    }

    .incident {
        gap: 0.7rem;
    }

    .screenshot-thumbnail {
        max-width: 100%;
    }

    .incident-meta {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }
}
