:root {
    color-scheme: light;
    --bg: #fbfaf7;
    --ink: #1a1916;
    --muted: #6f6a62;
    --line: #e4dfd6;
    --paper: #ffffff;
    --soft: #f3efe6;
    --danger: #8c3a32;
    --ok: #2d5a45;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", sans-serif;
    line-height: 1.5;
}

body.home {
    display: grid;
    place-items: center;
}

body.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.home-main {
    width: min(40rem, calc(100% - 3rem));
    text-align: center;
}

.name {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    width: fit-content;
    max-width: 100%;
    text-align: left;
}

p {
    margin: 0;
}

.welcome,
.tagline,
.lead,
.hint,
.meta {
    color: var(--muted);
}

.welcome {
    font-size: 1.35rem;
}

.tagline {
    margin-top: 1.1rem;
    font-size: 1.05rem;
}

h1 {
    margin: 0.7rem 0 0;
    font-family: Georgia, "Iowan Old Style", Palatino, serif;
    font-size: clamp(2.4rem, 10vw, 5.4rem);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 0.95;
}

.panel h1,
.top + main h1 {
    font-size: 1.55rem;
}

h2 {
    margin: 0;
    font-family: Georgia, "Iowan Old Style", Palatino, serif;
    font-size: 1.7rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

[hidden] {
    display: none !important;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: min(70rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0.85rem 0 0;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.top-actions form {
    margin: 0;
}

.top-actions .btn,
.top-actions button {
    padding: 0.28rem 0.6rem;
    font-size: 0.78rem;
}

.brand {
    color: var(--ink);
    font-family: Georgia, "Iowan Old Style", Palatino, serif;
    font-size: 0.95rem;
    text-decoration: none;
}

.brand:hover {
    text-decoration: underline;
}

.panel {
    width: min(70rem, calc(100% - 2rem));
    margin: 1.25rem auto 2.5rem;
    padding: 1.4rem 1.3rem 1.5rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.panel.app {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.panel.app form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.panel.narrow {
    width: min(28rem, calc(100% - 2rem));
    margin-top: 8vh;
}

.lead {
    margin-top: 0.9rem;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1rem;
}

.panel.app .stack {
    flex: 1 1 auto;
    min-height: 0;
}

.panel.app textarea {
    flex: 1 1 auto;
    height: auto;
    min-height: 6rem;
}

label {
    font-size: 0.92rem;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 8rem;
    resize: vertical;
    padding: 0.9rem 1rem;
    font-family: Consolas, "Cascadia Mono", "Segoe UI Mono", ui-monospace, monospace;
    font-size: 0.92rem;
    line-height: 1.45;
    tab-size: 2;
}

input:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
button:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.7rem 1.15rem;
    border: 1px solid var(--ink);
    border-radius: 4px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    cursor: pointer;
}

.home-main .btn {
    margin-top: 2.25rem;
}

.btn:hover,
button:hover {
    background: var(--ink);
    color: var(--bg);
}

.btn.primary,
button.primary {
    background: var(--ink);
    color: var(--bg);
}

.btn.primary:hover,
button.primary:hover {
    background: transparent;
    color: var(--ink);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.9rem;
}

.actions form {
    margin: 0;
}

td .actions {
    margin-top: 0;
}

.hint {
    margin-top: 0.85rem;
    font-size: 0.95rem;
}

.expiry {
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.message {
    margin-top: 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 4px;
}

.message.error {
    color: var(--danger);
    background: #f8ecea;
}

.message.ok {
    color: var(--ok);
    background: #e7f2ec;
}

.secret {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 4px;
    background: var(--soft);
}

.secret p + p,
.secret input {
    margin-top: 0.55rem;
}

.table-wrap {
    margin-top: 1.4rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.6rem 0.45rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.split {
    margin-top: 1.6rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
