:root {
    --black: #1b1b1b;
    --grey: #777777;
    --light: #eeeeee;
    --line: #cccccc;
    --red: #5f2321;
    --ink: #1b1b1b;
    --blue: #0088cc;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: white;
    color: var(--ink);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }

#root { min-height: 100vh; padding-bottom: 96px; }

.app-header {
    background: var(--black);
    color: var(--grey);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 20px;
    min-height: 48px;
}

.brand { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { color: #eee; font-size: 20px; }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav-btn { color: var(--grey); }
.nav-btn.is-on { color: white; }
.account { color: #eee; font-size: 14px; }

.btn {
    background: var(--red);
    color: white;
    border: 0;
    border-radius: 6px;
    padding: 8px 14px;
}
.btn.secondary { background: #e5e7eb; color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; }
.hint { margin: 0; color: #333; font-size: 14px; }
.is-empty { color: #999; font-weight: 400; }

/* A — Brief: writing surface beside the received mail */
.brief {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: start;
}

.write {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 36px 48px 48px;
    min-width: 0;
}

.lock {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin: 0;
    background: var(--black);
    color: white;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
}
.lock b { color: #fbbf24; font-weight: 600; }

.subject-hero, .body-hero {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
}
.subject-hero {
    font-size: 32px;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}
.body-hero {
    min-height: 280px;
    resize: vertical;
    font-size: 18px;
    line-height: 1.5;
}
.subject-hero:focus, .body-hero:focus { outline: none; }

.write-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.preview {
    background: #f3f3f3;
    border-left: 1px solid var(--line);
    padding: 32px 28px;
    min-height: calc(100vh - 48px);
}

.mail {
    background: white;
    border: 1px solid var(--line);
    padding: 28px 24px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}
.meta {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 6px 10px;
    font-size: 13px;
    margin-bottom: 18px;
}
.meta span { color: var(--grey); }
.meta { overflow-wrap: break-word; }
.mail h2 { margin: 0 0 12px; font-size: 20px; }
.mail .text { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.mail footer {
    margin-top: 28px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--grey);
    font-size: 12px;
}

.confirm-band, .receipt {
    border-left: 4px solid var(--red);
    background: var(--light);
    padding: 12px 14px;
    display: grid;
    gap: 10px;
}
.confirm-band p, .receipt p { margin: 0; line-height: 1.45; }
.receipt h2 { margin: 0; font-size: 28px; }

/* B — Versandzettel: the recipient roll is the page */
.slip-page { background: var(--light); min-height: calc(100vh - 48px); }
.slip {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}
.slip-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.slip h1 { margin: 0; font-size: 28px; }
.slip-kicker { margin: 0 0 4px; color: var(--grey); font-size: 13px; letter-spacing: 0.08em; }
.stamp {
    border: 2px solid var(--red);
    color: var(--red);
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 6px 10px;
    transform: rotate(-6deg);
}
.paper {
    background: white;
    border: 1px solid var(--line);
    padding: 16px;
}
.paper + .paper { margin-top: 12px; }
.paper h2 { margin: 0 0 8px; font-size: 16px; }
.note { margin: 8px 0 0; color: #333; font-size: 14px; line-height: 1.45; }

.roll { width: 100%; border-collapse: collapse; background: white; }
.roll th, .roll td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    vertical-align: top;
}
.roll th { font-size: 12px; color: var(--grey); font-weight: 600; }
.roll tfoot td { font-weight: 700; border-bottom: 0; }
.name-btn {
    background: none;
    border: 0;
    padding: 0;
    text-align: left;
    color: var(--blue);
}
.people { margin: 0; padding: 0; list-style: none; }
.people li { padding: 2px 0; }

.slip-fields { display: grid; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.field input, .field textarea {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 8px 10px;
    background: white;
}
.field textarea { min-height: 140px; resize: vertical; }
.static-text { margin: 0; white-space: pre-wrap; line-height: 1.45; }

/* C — Postausgang: the archive is the page, compose is a window */
.outbox { max-width: 880px; margin: 0 auto; padding: 28px 16px 48px; }
.outbox-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}
.outbox-head .btn { flex: none; white-space: nowrap; }
.outbox h1 { margin: 0; font-size: 32px; }
.outbox-count { margin: 4px 0 0; color: var(--grey); }

.row-btn {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) auto;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 4px;
    align-items: baseline;
}
.row-btn strong { font-size: 16px; }
.row-btn span, .row-btn em { color: var(--grey); font-style: normal; font-size: 14px; }
.row-btn:hover { background: #fafafa; }
.row-btn.is-draft { background: #fff7ed; }
.row-btn.is-new strong { color: var(--red); }

.overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
}
.backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    border: 0;
}
.mail-window {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(78vh, 720px);
    overflow: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    padding: 16px;
}
.window-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.window-bar h2 { margin: 0; font-size: 16px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--light);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 13px;
}
.window-subject, .window-body {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0;
    background: transparent;
}
.window-subject { font-size: 20px; font-weight: 700; }
.window-body { min-height: 220px; resize: vertical; line-height: 1.5; }
.window-subject:focus, .window-body:focus { outline: none; }
.window-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 8px;
}

/* Prototype chrome. Not part of the screen under test. */
#chrome, #switcher {
    position: fixed;
    z-index: 80;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}
#chrome { bottom: 64px; gap: 8px; }
#switcher { bottom: 12px; }

.chrome-bar, .switcher-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #111;
    color: white;
    border-radius: 999px;
    padding: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.chrome-bar a, .chrome-bar button, .switcher-bar button {
    background: #2a2a2a;
    color: white;
    border: 0;
    border-radius: 999px;
    padding: 6px 10px;
    text-decoration: none;
}
.chrome-bar button {
    max-width: min(460px, 68vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.switcher-label {
    padding: 0 8px;
    color: #fbbf24;
    white-space: nowrap;
}
.chrome-panel {
    width: min(640px, 100%);
    max-height: 220px;
    overflow: auto;
    background: #111;
    color: #ddd;
    border-radius: 12px;
    padding: 10px 12px;
}
.chrome-panel pre { margin: 8px 0 0; white-space: pre-wrap; }
.chrome-tools { display: flex; gap: 8px; }
.chrome-tools button {
    background: #2a2a2a;
    color: white;
    border: 0;
    border-radius: 999px;
    padding: 6px 10px;
}

@media (max-width: 860px) {
    .brief { grid-template-columns: 1fr; }
    .preview { border-left: 0; border-top: 1px solid var(--line); min-height: 0; }
    .write { padding: 24px 16px 32px; }
    .row-btn { grid-template-columns: 1fr; gap: 2px; }
    .account { display: none; }
    .paper { overflow-x: auto; }
    .roll { min-width: 520px; }
}
