:root {
    font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    color-scheme: light;
    --text: #17233a;
    --background: #f4f7fc;
    --surface: #fff;
    --border: #dee6f1;
    --input-border: #b9c7d9;
    --button-border: #cbd6e4;
    --button-text: #1a2b4a;
    --hover: #eaf0f8;
    --muted: #62728a;
    --error: #b42318;
    --danger-border: #f3c6c6;
    --link: #16803a;
    color: var(--text);
    background: var(--background)
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input,
textarea {
    font: inherit
}

button {
    cursor: pointer;
    border: 1px solid var(--button-border);
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--surface);
    color: var(--button-text);
    font-weight: 650
}

button:hover {
    background: var(--hover)
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid #78a4ff;
    outline-offset: 2px
}

.primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb
}

.primary:hover {
    background: #154bc0
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #101b33;
    color: white;
    padding: 16px max(20px, calc((100% - 1100px)/2));
    gap: 14px;
    font-size: 13px
}

.top a {
    color: white;
    font-weight: 800;
    font-size: 20px;
    text-decoration: none
}

main {
    max-width: 1100px;
    margin: auto;
    padding: 20px 16px
}

.hero {
    background: linear-gradient(125deg, #12213f, #1d4384);
    border-radius: 20px;
    padding: 36px;
    color: white;
    margin-bottom: 20px
}

.eyebrow {
    color: #a9f3d1;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: .05em
}

.hero h1 {
    font-size: clamp(28px, 4.5vw, 46px);
    margin: 10px 0 14px;
    line-height: 1.28
}

.hero>p {
    max-width: 810px;
    line-height: 1.9
}

.notice {
    background: #ffffff14;
    padding: 12px;
    border-left: 3px solid #fcd079;
    font-size: 13px
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    margin: 16px 0;
    box-shadow: 0 4px 20px #10295208
}

.panel h2 {
    margin: 0 0 8px
}

.muted {
    color: var(--muted)
}

.small,
.minor {
    font-size: 13px
}

.minor {
    margin-top: 16px;
    color: var(--muted)
}

label {
    display: block;
    font-size: 13px;
    font-weight: 750;
    margin: 15px 0 7px
}

input,
textarea {
    border: 1px solid var(--input-border);
    border-radius: 9px;
    padding: 11px 12px;
    width: 100%;
    background: var(--surface);
    color: var(--text)
}

textarea {
    resize: vertical
}

#authForm {
    max-width: 500px
}

#authForm button {
    margin-top: 20px
}

#authError {
    color: var(--error);
    margin-top: 10px
}

.restoreBackup {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 8px
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap
}

.toolbar h2 {
    margin: 0
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

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

.findbar label {
    margin: 0
}

.findbar input {
    max-width: 400px;
    flex: 1;
    min-width: 160px
}

.list {
    display: grid;
    gap: 10px
}

.entry {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 17px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px
}

.entry.dragging {
    opacity: .45
}

.handle {
    color: var(--muted);
    cursor: grab;
    font-size: 19px;
    user-select: none
}

.entry h3 {
    font-size: 17px;
    margin: 0 0 9px;
    overflow-wrap: anywhere
}

.fields {
    display: grid;
    gap: 8px
}

.field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
    min-width: 0
}

.field strong {
    min-width: 80px;
    color: var(--muted);
    font-size: 12px
}

.field .val {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    max-width: 100%
}

.field button,
.entryActions button {
    font-size: 12px;
    padding: 6px 9px
}

.entryActions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    max-width: 200px
}

.empty {
    text-align: center;
    padding: 38px
}

.danger {
    margin-top: 25px
}

.danger h3 {
    margin-top: 0
}

.danger button:last-child {
    color: var(--error);
    border-color: var(--danger-border)
}

.info {
    margin-top: 48px;
    line-height: 1.85
}

.infoGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px
}

.infoGrid article {
    padding: 16px;
    background: var(--surface);
    border-radius: 14px
}

.infoGrid h3 {
    margin-bottom: 0;
    margin-top: 0
}

.infoGrid p {
    margin-bottom: 0
}

footer {
    text-align: center;
    margin: 16px 0;
    color: var(--muted)
}

footer a {
    color: var(--link)
}

.adsbygoogle {
    display: block;
    margin: 16px 0;
    text-align: center;
}

dialog {
    background: var(--surface);
    color: var(--text);
    border: 0;
    border-radius: 17px;
    width: min(540px, calc(100% - 24px));
    max-height: 90vh;
    overflow: auto;
    padding: 24px;
    box-shadow: 0 25px 100px #0004
}

dialog::backdrop {
    background: #0c1529b8
}

dialog h2 {
    margin-top: 0
}

.pwfield {
    display: flex;
    gap: 6px
}

.pwfield input {
    min-width: 0;
    flex: 1
}

.pwfield button {
    white-space: nowrap
}

.modalActions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 23px
}

#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #13213c;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    max-width: 90vw
}

#toast.show {
    opacity: 1
}

[hidden] {
    display: none !important
}

@media(max-width:660px) {
    .hero {
        padding: 22px
    }

    .panel {
        padding: 15px
    }

    .entry {
        grid-template-columns: auto minmax(0, 1fr)
    }

    .entryActions {
        grid-column: 2;
        justify-content: flex-start;
        max-width: none
    }

    .infoGrid {
        grid-template-columns: 1fr
    }

    .toolbar {
        align-items: flex-start
    }

    .actions button {
        font-size: 13px;
        padding: 9px
    }

    .pwfield {
        flex-wrap: wrap
    }

    .pwfield input {
        flex-basis: 100%
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --text: #e6edf7;
    --background: #0b1220;
    --surface: #162238;
    --border: #33445f;
    --input-border: #536581;
    --button-border: #536581;
    --button-text: #e6edf7;
    --hover: #283b58;
    --muted: #b0bfd3;
    --error: #ffaaa2;
    --danger-border: #9c575d;
    --link: #8be0a7;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted);
    opacity: 1
}

.topActions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap
}

#themeToggle {
    font-size: 13px;
    white-space: nowrap
}

@media(max-width:660px) {
    .top {
        flex-wrap: wrap
    }
}
