:root {
    color-scheme: light;
    --paper: #f3eee4;
    --ink: #1c1915;
    --muted: #5e584e;
    --line: #e0d6c6;
    --card: #fffdf8;
    --teal: #0e5c56;
    --teal-dark: #0a3f3b;
    --danger: #8f2d2d;
    --shadow: 0 18px 50px rgba(48, 36, 18, 0.08);
    font-family: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 0% -10%, #efe2c8 0%, transparent 60%),
        var(--paper);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, p { margin: 0; }

h1, h2 {
    font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

[hidden] { display: none !important; }

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.mark { display: block; flex: 0 0 auto; }

.brand-title { line-height: 1.2; }

.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: auto;
    object-fit: contain;
}

.brand-logo-topbar {
    height: 2rem;
    max-width: min(9rem, 40vw);
}

.brand-logo-login {
    height: auto;
    max-width: min(16rem, 100%);
    margin: 0 auto;
}

.brand-login {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
}

.brand-topbar .brand-title {
    font-size: 0.95rem;
}

@media (max-width: 520px) {
    .brand-topbar .brand-title {
        display: none;
    }

    .brand-logo-topbar {
        max-width: min(7.5rem, 55vw);
    }
}

.lede { color: var(--muted); margin-top: 0.35rem; }

.webmail-link {
    margin-top: 0.45rem;
    color: var(--muted);
}

.webmail-link a {
    color: var(--teal-dark);
    font-weight: 600;
    text-decoration: none;
}

.webmail-link a:hover { text-decoration: underline; }

.button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: var(--teal);
    color: #f7f4ee;
    padding: 0.65rem 1.05rem;
    font-weight: 600;
}

.button:hover { background: var(--teal-dark); }

.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.button-quiet {
    background: transparent;
    color: var(--teal-dark);
    border: 1px solid var(--line);
}

.button-quiet:hover { background: #f6f0e6; }

.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { background: #732323; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--teal-dark);
    flex: 0 0 auto;
}

.login-body {
    padding: 0;
}

.login-shell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.5rem;
}

.login-shell .login-card {
    width: min(420px, 100%);
}

.login-card, .panel, dialog {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.login-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.6rem;
}

.login-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
}

.login-intro .lede {
    margin-top: 0;
    max-width: 18rem;
}

.login-card > .banner {
    margin-bottom: 0;
}

.stack { display: grid; gap: 0.7rem; }

.stack label { font-weight: 600; }

input, select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
}


.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.92);
    position: sticky;
    top: 0;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav form { margin: 0; }

.nav-button {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    color: var(--muted);
    font-weight: 600;
}

.nav-button.is-active {
    background: #e7f3f1;
    color: var(--teal-dark);
}

.shell {
    width: min(1040px, calc(100% - 2rem));
    margin: 1.5rem auto 2rem;
    flex: 1;
}

.site-footer {
    margin-top: auto;
    padding: 1rem 1.25rem 1.35rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.92);
}

.site-footer p { margin: 0; }

.site-footer a {
    color: var(--teal-dark);
    font-weight: 600;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

.login-body .site-footer {
    align-self: stretch;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
}

.banner, .form-error, .noscript {
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
}

.banner { margin-bottom: 1rem; }
.banner-ok { background: #e7f3ea; color: #1d5c32; }
.banner-error, .form-error, .noscript { background: #f8e8e4; color: #8f2d2d; }

.table-search {
    display: block;
    margin-bottom: 0.75rem;
}

.table-search input {
    max-width: 22rem;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
}

table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

tbody tr:last-child td { border-bottom: 0; }

.empty {
    color: var(--muted);
    text-align: center;
    padding: 2rem 1rem;
}

.address {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--danger);
    background: #f8e8e4;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

.pager {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pager p { color: var(--muted); min-width: 7rem; text-align: center; }

.per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    color: var(--muted);
    font-weight: 600;
}

.per-page select { width: auto; }

.panel { padding: 1.2rem; max-width: 460px; }

dialog {
    width: min(480px, calc(100vw - 2rem));
    padding: 1.25rem;
    border: 1px solid var(--line);
    color: inherit;
}

dialog::backdrop { background: rgba(28, 25, 21, 0.46); }

.local-part {
    display: flex;
    align-items: stretch;
    gap: 0.45rem;
}

.password-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.local-part {
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.local-part input { border: 0; border-radius: 0; min-width: 0; }

.local-part span {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: #f3ece1;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

.password-row input {
    flex: 1;
    min-width: 0;
}

.password-generate {
    width: 100%;
    background: #f3ece1;
    color: var(--teal-dark);
    border: 1px solid var(--line);
}

.password-generate:hover {
    background: #e8dfd0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.noscript {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
}

@media (max-width: 720px) {
    .topbar, .section-head { align-items: stretch; flex-direction: column; }
    .nav { flex-wrap: wrap; }
    .per-page { margin-left: 0; }
    h1 { font-size: 1.7rem; }
}
