* { box-sizing: border-box; }
body {
    font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
    background: #f4f6f8;
    color: #222;
    margin: 0;
}
.page { min-height: 100vh; }

/* ブランドヘッダー */
.site-brand {
    position: relative;
    background: #fff;
    border-bottom: 1px solid #e2e6ea;
    padding: 28px 16px 20px;
    text-align: center;
}
.brand-link {
    display: inline-block;
    line-height: 0;
}
.brand-logo {
    max-width: 240px;
    width: min(240px, 72vw);
    height: auto;
    display: block;
}
.portal-title {
    margin: 14px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a5568;
    letter-spacing: 0.04em;
}
.user-id {
    margin: 0;
    font-size: 0.88rem;
    color: #718096;
}
.header-user-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 16px;
    margin: 0 0 12px;
}
@media (min-width: 640px) {
    .header-user-bar {
        position: absolute;
        top: 16px;
        right: 16px;
        justify-content: flex-end;
        margin: 0;
        max-width: calc(100% - 32px);
    }
    .header-user-bar .user-id {
        text-align: right;
    }
}
.button-header {
    width: auto;
    margin-top: 0;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.container { max-width: 480px; margin: 0 auto; padding: 28px 16px 48px; }
.muted { color: #666; font-size: 0.95rem; }
.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card h2 { margin-top: 0; font-size: 1.25rem; }
label { display: block; margin-bottom: 16px; font-weight: 600; }
input[type="email"], input[type="password"], input[type="text"] {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}
input[readonly] { background: #f5f7fa; color: #333; cursor: default; }
button, .button-link {
    display: inline-block;
    background: #1a5fb4;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
button:hover, .button-link:hover { background: #134a8e; }
button { width: 100%; margin-top: 4px; }

/* ダッシュボードは幅広 */
.container-wide {
    max-width: min(1040px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 16px 48px;
}
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar .button-link { width: auto; margin-top: 0; }
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
}
table { width: 100%; border-collapse: collapse; }
.mail-account-table {
    min-width: 520px;
    table-layout: auto;
}
.mail-account-table th,
.mail-account-table td {
    border-bottom: 1px solid #eee;
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
}
.mail-account-table th {
    font-size: 0.85rem;
    color: #64748b;
    white-space: nowrap;
}
.mail-account-table .col-mail {
    min-width: 200px;
    word-break: break-all;
}
.mail-account-table .col-date {
    min-width: 150px;
    white-space: nowrap;
}
.mail-account-table .col-action {
    min-width: 200px;
    white-space: nowrap;
    text-align: right;
}
.mail-account-table .action-link {
    display: inline-block;
    color: #1a5fb4;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    margin-left: 12px;
}
.mail-account-table .action-link:first-child { margin-left: 0; }
.mail-account-table .action-link-sub {
    font-weight: 500;
    color: #475569;
}
.mail-account-table .action-link:hover { text-decoration: underline; }
.breadcrumb {
    margin: 0 0 6px;
    font-size: 0.85rem;
    color: #64748b;
}
.breadcrumb a { color: #1a5fb4; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0;
}
.settings-actions .button-secondary,
.settings-actions .button-password,
.settings-actions .button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    min-height: 42px;
}
.settings-actions .button-password {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}
.settings-actions .button-password:hover {
    background: #b91c1c;
    color: #fff;
}
.button-secondary {
    display: inline-block;
    background: #e2e8f0;
    color: #334155;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.button-secondary:hover { background: #cbd5e1; }
.button-inline {
    width: auto;
    margin-top: 0;
}
.settings-body {
    margin: 0;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: Consolas, "Segoe UI", monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
}
#settings-page .pw-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
#settings-page .settings-full,
#settings-page .pw-hide {
    display: none;
}
#settings-page .pw-toggle:checked ~ .settings-actions .pw-show {
    display: none;
}
#settings-page .pw-toggle:checked ~ .settings-actions .pw-hide {
    display: inline-flex;
}
#settings-page .pw-toggle:checked ~ .settings-masked {
    display: none;
}
#settings-page .pw-toggle:checked ~ .settings-full {
    display: block;
}
#settings-page .settings-footer {
    margin-top: 20px;
}
#settings-page .settings-footer .button-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    min-height: 42px;
    width: auto;
}
.mail-account-table .download-link {
    display: inline-block;
    color: #1a5fb4;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.mail-account-table .download-link:hover { text-decoration: underline; }
th, td { border-bottom: 1px solid #eee; padding: 10px 8px; text-align: left; vertical-align: top; }
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: #611a15; border: 1px solid #f5c2c0; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.form-footer { margin-top: 20px; text-align: center; font-size: 0.95rem; }
.form-footer a { color: #1a5fb4; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

@media (min-width: 768px) {
    .container { max-width: 1000px; }
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.logout-form { margin: 0; display: inline; }
.logout-form button { width: auto; margin-top: 0; }
