:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #20242b;
    --muted: #667085;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #b42318;
    --success: #027a48;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; text-decoration: none; }
.nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav a, .logout-form button {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}
.nav .primary { background: var(--primary); color: white; border-color: var(--primary); }
.logout-form { margin: 0; }
.container { width: min(1100px, 100%); margin: 0 auto; padding: 24px 16px; }
.login-card, .compose-card, .message-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
    padding: 24px;
}
.login-card { max-width: 460px; margin: 40px auto; }
h1 { margin-top: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.muted { color: var(--muted); }
.form { display: grid; gap: 10px; }
.form label { font-weight: 700; margin-top: 8px; }
input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; }
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    margin-top: 12px;
}
.primary-button:hover { background: var(--primary-dark); }
.primary-button.small { padding: 8px 12px; border-radius: 999px; margin-top: 0; }
.validation { color: var(--danger); font-size: .92rem; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line); }
.alert.success { color: var(--success); }
.alert.error { color: var(--danger); }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.mail-list { display: grid; gap: 8px; }
.mail-row {
    display: grid;
    grid-template-columns: minmax(160px, 260px) 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    text-decoration: none;
}
.mail-row.unseen { border-color: #93c5fd; background: #eff6ff; font-weight: 700; }
.mail-from, .mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-date { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.badge { display: inline-block; font-size: .75rem; background: var(--primary); color: white; border-radius: 999px; padding: 2px 7px; margin-right: 6px; }
.badge.attach { background: #475467; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 32px; text-align: center; color: var(--muted); }
.message-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.meta { display: grid; grid-template-columns: 90px 1fr; gap: 8px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; }
.meta dt { color: var(--muted); font-weight: 700; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.attachments { margin-top: 18px; padding: 14px; background: #f9fafb; border-radius: 12px; }
.attachments h2 { font-size: 1rem; margin-top: 0; }
.attachment { display: inline-block; margin: 4px 8px 4px 0; padding: 8px 10px; border-radius: 999px; background: white; border: 1px solid var(--line); text-decoration: none; }
.body { margin-top: 22px; line-height: 1.7; overflow-wrap: anywhere; }
.body pre { white-space: pre-wrap; font-family: inherit; }

@media (max-width: 720px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .nav { width: 100%; }
    .mail-row { grid-template-columns: 1fr; gap: 6px; }
    .mail-date { white-space: normal; }
    .meta { grid-template-columns: 1fr; }
    .container { padding: 16px 10px; }
    .login-card, .compose-card, .message-card { padding: 18px; border-radius: 14px; }
}

.folder-table-wrap { overflow-x: auto; background: #fff; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.folder-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.folder-table th, .folder-table td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; text-align: left; }
.folder-table th { background: #f8fafc; }
.folder-table code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; }

/* 3ペインWebメール画面 */
.container:has(.webmail-shell) {
    width: 100%;
    max-width: none;
    height: calc(100vh - 62px);
    padding: 0;
}
.webmail-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    height: calc(100vh - 62px);
    background: #f8fafc;
}
.folder-pane {
    border-right: 1px solid var(--line);
    background: #fff;
    padding: 16px 12px;
    overflow-y: auto;
}
.compose-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 44px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    margin-bottom: 18px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}
.folder-title {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 800;
    padding: 0 10px 8px;
}
.folder-list { display: grid; gap: 4px; }
.folder-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 12px;
    color: #344054;
    text-decoration: none;
}
.folder-item:hover { background: #f2f4f7; }
.folder-item.active {
    background: #eaf2ff;
    color: #174ea6;
    font-weight: 800;
}
.folder-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.folder-count {
    min-width: 28px;
    text-align: right;
    color: var(--muted);
    font-size: .84rem;
}
.mailbox-pane {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mailbox-header {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.mailbox-header h1 {
    margin: 0;
    font-size: 1.28rem;
}
.folder-fullname {
    color: var(--muted);
    font-size: .84rem;
    margin-top: 2px;
}
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
}
.split-pane {
    flex: 1;
    display: grid;
    grid-template-rows: minmax(210px, 38%) minmax(0, 62%);
    min-height: 0;
}
.message-list-pane {
    overflow-y: auto;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.message-list { display: grid; }
.message-row {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid #eef2f7;
    color: var(--text);
    text-decoration: none;
}
.message-row:hover { background: #f8fafc; }
.message-row.unseen { font-weight: 800; background: #fbfdff; }
.message-row.selected {
    background: #eaf2ff;
    box-shadow: inset 4px 0 0 var(--primary);
}
.message-row-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.message-from,
.message-subject {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.message-date {
    color: var(--muted);
    font-size: .82rem;
    white-space: nowrap;
    font-weight: 500;
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--primary);
    margin-right: 6px;
    vertical-align: middle;
}
.message-preview-pane {
    min-height: 0;
    overflow-y: auto;
    background: #f8fafc;
    padding: 16px;
}
.preview-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    min-height: 100%;
}
.preview-card h2 {
    margin: 0 0 12px;
    font-size: 1.25rem;
}
.preview-meta {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 6px 12px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
    margin: 0 0 14px;
}
.preview-meta dt { color: var(--muted); font-weight: 800; }
.preview-meta dd { margin: 0; overflow-wrap: anywhere; }
.preview-empty {
    height: 100%;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--muted);
}
.preview-icon { font-size: 2.4rem; margin-bottom: 8px; }
.preview-body { max-width: 100%; }
.compact-attachments h3 { font-size: .96rem; margin-top: 0; }
.empty.compact { margin: 14px; padding: 24px; }

@media (max-width: 900px) {
    .container:has(.webmail-shell),
    .webmail-shell { height: auto; min-height: calc(100vh - 62px); }
    .webmail-shell { grid-template-columns: 1fr; }
    .folder-pane {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow-x: auto;
    }
    .folder-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .folder-item {
        min-width: 140px;
        flex: 0 0 auto;
    }
    .split-pane {
        grid-template-rows: auto auto;
    }
    .message-list-pane {
        max-height: 42vh;
    }
    .message-preview-pane {
        min-height: 380px;
    }
}

/* 右クリックメニュー・本文操作 */
.context-menu {
    position: fixed;
    z-index: 9999;
    width: 180px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}
.context-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 9px 10px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}
.context-menu button:hover { background: #f2f4f7; }
.context-menu button:disabled {
    color: #98a2b3;
    cursor: default;
}
.context-menu button:disabled:hover { background: transparent; }
.context-separator {
    height: 1px;
    background: var(--line);
    margin: 5px 0;
}
.preview-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.preview-titlebar h2 { margin: 0; }
.preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.inline-form { margin: 0; display: inline; }
.mini-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.mini-button:hover { background: #f8fafc; }
@media (max-width: 900px) {
    .preview-titlebar { flex-direction: column; }
    .preview-actions { justify-content: flex-start; }
}

/* K4風 業務用Webメール画面 */
.container:has(.k4-shell) {
    width: 100%;
    max-width: none;
    height: calc(100vh - 62px);
    padding: 0;
}
.k4-shell {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    height: calc(100vh - 62px);
    background: #dfe7f2;
    border-top: 1px solid #b7c4d6;
}
.k4-sidebar {
    min-width: 0;
    overflow-y: auto;
    background: linear-gradient(#f9fbff, #edf3fb);
    border-right: 1px solid #9fb1c8;
    padding: 10px;
}
.k4-sidebar-head {
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid #9fb1c8;
    background: linear-gradient(#ffffff, #dbe8f7);
    font-weight: 800;
    color: #1f3d5c;
}
.k4-compose {
    display: block;
    margin-bottom: 10px;
    padding: 9px 12px;
    border: 1px solid #2f5f99;
    background: linear-gradient(#4f8bd3, #2f6fb8);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-weight: 800;
}
.k4-section-title {
    margin: 10px 0 4px;
    padding: 5px 8px;
    background: #cbd9ea;
    border: 1px solid #aab9ca;
    color: #23384d;
    font-size: .86rem;
    font-weight: 800;
}
.k4-section-title.lower { margin-top: 18px; }
.k4-folder-list { display: grid; gap: 2px; }
.k4-folder,
.k4-side-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 31px;
    padding: 6px 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #1f2937;
    text-decoration: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.k4-folder:hover,
.k4-side-button:hover { background: #fff; border-color: #c3cede; }
.k4-folder.active {
    background: #fff6d7;
    border-color: #d8b23f;
    font-weight: 800;
}
.k4-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k4-folder-count {
    min-width: 28px;
    text-align: right;
    color: #64748b;
    font-size: .82rem;
}
.k4-side-button {
    border-color: #c5d1df;
    background: #fff;
    margin-bottom: 4px;
}
.k4-side-button.disabled { color: #98a2b3; cursor: default; background: #f3f6fa; }
.k4-main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    overflow: hidden;
    background: #f4f7fb;
}
.k4-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid #9fb1c8;
    background: linear-gradient(#ffffff, #d8e6f6);
}
.k4-header h1 {
    margin: 0;
    font-size: 1.1rem;
    color: #17395d;
}
.k4-path,
.k4-header-count {
    color: #556987;
    font-size: .82rem;
}
.k4-toolbar {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 42px;
    padding: 6px 8px;
    border-bottom: 1px solid #aab9ca;
    background: #eef4fb;
    overflow-x: auto;
}
.k4-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 11px;
    border: 1px solid #8ea4bd;
    background: linear-gradient(#ffffff, #dbe5f1);
    color: #18283a;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.k4-tool:hover { background: linear-gradient(#ffffff, #cbdcf0); }
.k4-tool.primary {
    border-color: #2f6fb8;
    background: linear-gradient(#5a95db, #2f6fb8);
    color: #fff;
}
.k4-tool.danger { color: #9f1d16; }
.k4-toolbar-sep {
    height: 24px;
    width: 1px;
    background: #aab9ca;
    margin: 0 4px;
}
.k4-content {
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(180px, 42%) minmax(0, 58%);
    overflow: hidden;
}
.k4-list-pane {
    min-height: 0;
    overflow: auto;
    background: #fff;
    border-bottom: 1px solid #9fb1c8;
}
.k4-mail-table {
    min-width: 860px;
    display: grid;
}
.k4-mail-head,
.k4-mail-row {
    display: grid;
    grid-template-columns: 38px 62px minmax(130px, 220px) minmax(260px, 1fr) 138px 48px;
    align-items: center;
}
.k4-mail-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 32px;
    background: linear-gradient(#f8fbff, #d7e4f3);
    border-bottom: 1px solid #9fb1c8;
    color: #23384d;
    font-weight: 800;
    font-size: .86rem;
}
.k4-mail-row {
    min-height: 34px;
    border-bottom: 1px solid #e1e8f0;
    cursor: pointer;
    font-size: .92rem;
}
.k4-mail-row:nth-child(even) { background: #fbfdff; }
.k4-mail-row:hover { background: #eef6ff; }
.k4-mail-row.unseen { font-weight: 800; background: #fffef5; }
.k4-mail-row.selected {
    background: #dcebff;
    outline: 1px solid #6ca5e8;
    outline-offset: -1px;
}
.k4-col-check,
.k4-col-state,
.k4-col-from,
.k4-col-subject,
.k4-col-date,
.k4-col-attach {
    min-width: 0;
    padding: 5px 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-right: 1px solid #edf1f6;
}
.k4-col-check { text-align: center; }
.k4-col-state { color: #475569; }
.k4-mail-row.unseen .k4-col-state { color: #1d4ed8; }
.k4-col-date,
.k4-col-attach { text-align: center; }
.k4-preview-pane {
    min-height: 0;
    overflow: auto;
    padding: 10px;
    background: #edf3fb;
}
.k4-preview-card {
    min-height: 100%;
    background: #fff;
    border: 1px solid #aab9ca;
}
.k4-preview-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid #c7d2e0;
    background: linear-gradient(#ffffff, #eef4fb);
}
.k4-preview-titlebar h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #18283a;
}
.k4-preview-meta {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 4px 10px;
    margin: 0;
    padding: 9px 10px;
    border-bottom: 1px solid #d9e2ec;
    font-size: .9rem;
}
.k4-preview-meta dt { color: #556987; font-weight: 800; }
.k4-preview-meta dd { margin: 0; overflow-wrap: anywhere; }
.k4-preview-card .attachments {
    margin: 10px;
    border: 1px solid #d9e2ec;
    background: #f8fafc;
}
.k4-preview-card .preview-body {
    padding: 4px 12px 18px;
}
.k4-preview-card .body pre { white-space: pre-wrap; font-family: inherit; }
.context-menu button[data-action="delete"] { color: #9f1d16; }
@media (max-width: 900px) {
    .container:has(.k4-shell),
    .k4-shell { height: auto; min-height: calc(100vh - 62px); }
    .k4-shell { grid-template-columns: 1fr; }
    .k4-sidebar { border-right: 0; border-bottom: 1px solid #9fb1c8; }
    .k4-folder-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
    .k4-folder { min-width: 150px; flex: 0 0 auto; }
    .k4-content { grid-template-rows: auto auto; }
    .k4-list-pane { max-height: 42vh; }
    .k4-preview-pane { min-height: 380px; }
    .k4-preview-titlebar { flex-direction: column; }
}

/* Outlook風 3カラムWebメール画面 */
.container:has(.outlook-shell) {
    width: 100%;
    max-width: none;
    height: calc(100vh - 62px);
    padding: 0;
}
.outlook-shell {
    display: grid;
    grid-template-columns: 235px minmax(320px, 430px) minmax(420px, 1fr);
    height: calc(100vh - 62px);
    overflow: hidden;
    background: #f3f2f1;
    border-top: 1px solid #d2d0ce;
}
.outlook-folder-pane {
    min-width: 0;
    overflow-y: auto;
    background: #faf9f8;
    border-right: 1px solid #d2d0ce;
    padding: 12px 10px;
}
.outlook-compose-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0 2px 14px;
    border-radius: 4px;
    background: #0078d4;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.outlook-compose-button:hover { background: #106ebe; }
.outlook-section-title {
    padding: 8px 10px 6px;
    color: #605e5c;
    font-size: .82rem;
    font-weight: 700;
}
.outlook-section-title.lower { margin-top: 16px; }
.outlook-folder-list { display: grid; gap: 1px; }
.outlook-folder,
.outlook-side-link {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 3px;
    color: #323130;
    text-decoration: none;
    gap: 6px;
}
.outlook-folder:hover,
.outlook-side-link:hover { background: #edebe9; }
.outlook-folder.active {
    background: #e1dfdd;
    box-shadow: inset 3px 0 0 #0078d4;
    font-weight: 700;
}
.outlook-folder-icon { text-align: center; }
.outlook-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outlook-folder-count { color: #605e5c; font-size: .82rem; }
.outlook-side-link {
    grid-template-columns: 1fr;
    margin: 1px 0;
    color: #323130;
}
.outlook-list-pane {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    background: #fff;
    border-right: 1px solid #d2d0ce;
    overflow: hidden;
}
.outlook-list-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid #edebe9;
}
.outlook-list-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #323130;
}
.outlook-folder-path,
.outlook-count,
.outlook-search-note {
    color: #605e5c;
    font-size: .82rem;
}

.outlook-count-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.outlook-refresh-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #d2d0ce;
    background: #ffffff;
    color: #323130;
    text-decoration: none;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.outlook-refresh-button:hover,
.outlook-refresh-button:focus {
    border-color: #0078d4;
    color: #005a9e;
    background: #f3f9fd;
    text-decoration: none;
}

.outlook-commandbar {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 6px 8px;
    border-bottom: 1px solid #edebe9;
    overflow-x: auto;
    background: #fff;
}
.outlook-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    color: #323130;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.outlook-command:hover { background: #f3f2f1; border-color: #edebe9; }
.outlook-command.primary { color: #0078d4; font-weight: 700; }
.outlook-command.danger { color: #a4262c; }
.outlook-separator {
    width: 1px;
    height: 24px;
    background: #d2d0ce;
    margin: 0 3px;
}
.outlook-search-note {
    padding: 8px 14px;
    border-bottom: 1px solid #edebe9;
    background: #faf9f8;
}
.outlook-message-list {
    min-height: 0;
    overflow-y: auto;
    background: #fff;
}
.outlook-message-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 2px;
    min-height: 72px;
    padding: 8px 10px 8px 4px;
    border-bottom: 1px solid #edebe9;
    cursor: pointer;
    color: #323130;
}
.outlook-message-row:hover { background: #f8f8f8; }
.outlook-message-row.selected {
    background: #deecf9;
    box-shadow: inset 3px 0 0 #0078d4;
}
.outlook-message-row.unseen {
    font-weight: 700;
    background: #fbfdff;
}
.outlook-row-check { display: flex; justify-content: center; padding-top: 4px; }
.outlook-row-main { min-width: 0; display: grid; gap: 4px; }
.outlook-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}
.outlook-from,
.outlook-subject {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.outlook-from { color: #201f1e; }
.outlook-date {
    color: #605e5c;
    font-size: .78rem;
    white-space: nowrap;
    font-weight: 400;
}
.outlook-subject-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: #323130;
}
.unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: #0078d4;
    flex: 0 0 auto;
}
.attach-mark { flex: 0 0 auto; color: #605e5c; }
.outlook-reading-pane {
    min-width: 0;
    overflow-y: auto;
    background: #fff;
}
.outlook-pane-titlebar {
    min-height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #edebe9;
    background: #fff;
}
.outlook-pane-titlebar h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #201f1e;
}
.outlook-close {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 3px;
    text-decoration: none;
    color: #605e5c;
    font-size: 1.4rem;
}
.outlook-close:hover { background: #f3f2f1; }
.outlook-compose-pane,
.outlook-message-preview { min-height: 100%; background: #fff; }
.outlook-compose-form {
    display: grid;
    gap: 8px;
    padding: 14px 18px 22px;
}
.outlook-compose-form label {
    margin: 6px 0 0;
    color: #605e5c;
    font-size: .84rem;
    font-weight: 700;
}
.outlook-compose-form input,
.outlook-compose-form textarea {
    border-radius: 2px;
    border: 1px solid #d2d0ce;
    padding: 9px 10px;
}
.outlook-compose-form textarea {
    min-height: 260px;
    resize: vertical;
}
.outlook-compose-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 6px;
}
.outlook-send {
    min-height: 34px;
    padding: 7px 18px;
    border: 0;
    border-radius: 3px;
    background: #0078d4;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.outlook-send:hover { background: #106ebe; }
.message-titlebar { align-items: flex-start; }
.outlook-message-date { color: #605e5c; font-size: .84rem; margin-top: 4px; }
.outlook-preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}
.outlook-preview-meta {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 5px 12px;
    margin: 0;
    padding: 12px 18px;
    border-bottom: 1px solid #edebe9;
}
.outlook-preview-meta dt { color: #605e5c; font-weight: 700; }
.outlook-preview-meta dd { margin: 0; overflow-wrap: anywhere; }
.outlook-attachments { margin: 14px 18px 0; }
.outlook-preview-body {
    padding: 4px 18px 24px;
    line-height: 1.65;
}
.outlook-preview-body pre { white-space: pre-wrap; font-family: inherit; }
.outlook-empty-reading {
    height: 100%;
    display: grid;
    place-content: center;
    text-align: center;
    color: #605e5c;
}
.outlook-empty-icon { font-size: 2.8rem; margin-bottom: 8px; }
@media (max-width: 1000px) {
    .container:has(.outlook-shell),
    .outlook-shell { height: auto; min-height: calc(100vh - 62px); }
    .outlook-shell { grid-template-columns: 1fr; overflow: visible; }
    .outlook-folder-pane { border-right: 0; border-bottom: 1px solid #d2d0ce; }
    .outlook-folder-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
    .outlook-folder { min-width: 150px; flex: 0 0 auto; }
    .outlook-list-pane { min-height: 520px; border-right: 0; border-bottom: 1px solid #d2d0ce; }
    .outlook-message-list { max-height: 420px; }
    .outlook-reading-pane { min-height: 520px; }
}

.mobile-back-to-list {
    display: none;
}

@media (max-width: 760px) {
    .container:has(.outlook-shell) {
        height: auto;
        min-height: calc(100vh - 56px);
    }
    .outlook-shell {
        display: block;
        height: auto;
        min-height: calc(100vh - 56px);
        overflow: visible;
    }
    .outlook-folder-pane {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 8px;
        max-height: 42vh;
        overflow-y: auto;
        border-right: 0;
        border-bottom: 1px solid #d2d0ce;
        box-shadow: 0 2px 8px rgba(0,0,0,.06);
    }
    .outlook-compose-button {
        min-height: 38px;
        margin-bottom: 8px;
    }
    .outlook-section-title {
        padding: 4px 8px;
    }
    .outlook-section-title.lower,
    .outlook-side-link {
        display: none;
    }
    .outlook-folder-list {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .outlook-folder {
        min-width: 138px;
        flex: 0 0 auto;
        grid-template-columns: 22px minmax(0, 1fr) auto;
    }
    .outlook-folder.active {
        box-shadow: inset 0 -3px 0 #0078d4;
    }
    .outlook-list-pane {
        display: grid;
        min-height: auto;
        height: auto;
        border-right: 0;
        border-bottom: 0;
        overflow: visible;
    }
    .outlook-list-header {
        min-height: auto;
        padding: 10px 12px;
    }
    .outlook-list-header h1 {
        font-size: 1.08rem;
    }

    .outlook-count-actions {
        gap: 6px;
    }
    .outlook-refresh-button {
        padding: 5px 8px;
        font-size: .78rem;
    }
    .outlook-folder-path,
    .outlook-search-note {
        display: none;
    }
    .outlook-commandbar {
        position: sticky;
        top: 0;
        z-index: 15;
        min-height: 42px;
        padding: 5px 7px;
        -webkit-overflow-scrolling: touch;
    }
    .outlook-command {
        min-height: 32px;
        padding: 6px 10px;
    }
    .outlook-message-list {
        max-height: none;
        overflow-y: visible;
    }
    .outlook-message-row {
        min-height: 68px;
        padding-right: 8px;
    }
    .outlook-reading-pane {
        min-height: calc(100vh - 56px);
        overflow: visible;
        border-top: 1px solid #d2d0ce;
    }
    .outlook-shell:not(.mobile-detail-open) .outlook-reading-pane {
        display: none;
    }
    .outlook-shell.mobile-detail-open .outlook-list-pane {
        display: none;
    }
    .mobile-back-to-list {
        display: block;
        position: sticky;
        top: 0;
        z-index: 18;
        padding: 10px 12px;
        border-bottom: 1px solid #d2d0ce;
        background: #f3f2f1;
        color: #0078d4;
        text-decoration: none;
        font-weight: 700;
    }
    .outlook-pane-titlebar {
        min-height: auto;
        padding: 12px;
        flex-direction: column;
    }
    .outlook-pane-titlebar h2 {
        font-size: 1.08rem;
        overflow-wrap: anywhere;
    }
    .outlook-preview-actions {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }
    .outlook-preview-meta {
        grid-template-columns: 56px minmax(0, 1fr);
        padding: 10px 12px;
        font-size: .9rem;
    }
    .outlook-preview-body {
        padding: 4px 12px 24px;
        overflow-wrap: anywhere;
    }
    .outlook-attachments {
        margin: 12px 12px 0;
    }
    .outlook-compose-form {
        padding: 12px;
    }
    .outlook-compose-form textarea {
        min-height: 38vh;
    }
    .outlook-compose-actions {
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid #edebe9;
        padding: 8px 0;
    }
    .context-menu {
        max-width: calc(100vw - 16px);
    }
}

@media (min-width: 761px) and (max-width: 1100px) {
    .outlook-shell {
        grid-template-columns: 210px minmax(300px, 380px) minmax(360px, 1fr);
    }
    .outlook-folder-pane {
        padding: 10px 8px;
    }
}

/* 作成画面：下書き・破棄確認・ポップアウト・署名 */
.outlook-popout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid #d2d0ce;
    border-radius: 999px;
    background: #fff;
    color: #323130;
    text-decoration: none;
    font-size: .86rem;
    font-weight: 700;
}
.outlook-popout:hover { background: #f3f2f1; }
.compose-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(32,31,30,.35);
}
.compose-modal[hidden] { display: none; }
.compose-modal-card {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid #d2d0ce;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0,0,0,.24);
    padding: 20px;
}
.compose-modal-card h3 { margin: 0 0 8px; }
.compose-modal-card p { margin: 0 0 18px; color: #605e5c; }
.compose-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.settings-card {
    max-width: 760px;
    margin: 28px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}
.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}
.check-label input { width: auto; }
.popout-compose-page {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 12px;
}
.popout-compose-card {
    border: 1px solid #d2d0ce;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0,0,0,.08);
}
.compact-result { text-align: center; max-width: 460px; }

/* メイン上部バー：左にタイトル、右端にログアウト */
.main-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.top-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.top-search-input {
    width: 100%;
    min-height: 36px;
    border-radius: 999px;
    padding: 8px 14px;
    background: #f3f2f1;
    border: 1px solid #d2d0ce;
}
.top-search-input:focus {
    outline: 2px solid rgba(0,120,212,.25);
    background: #fff;
}
.top-search-button {
    min-height: 36px;
    border: 1px solid #d2d0ce;
    border-radius: 999px;
    padding: 0 14px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}
.top-search-button:hover { background: #f3f2f1; }
.logout-only-nav { justify-content: flex-end; margin-left: auto; }

/* ポップアウト作成画面：親画面の上部バーを出さない */
.popout-body {
    background: #fff;
    min-height: 100vh;
}
.popout-compose-page.no-topbar {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
.popout-compose-form {
    min-height: 100vh;
    padding: 12px 14px 16px;
}
.popout-compose-actions-top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -12px -14px 10px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #edebe9;
}
.popout-spacer { flex: 1 1 auto; }
@media (max-width: 760px) {
    .main-topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    .logout-only-nav { justify-content: flex-end; margin-left: auto; }
    .popout-compose-actions-top {
        align-items: stretch;
        flex-wrap: wrap;
    }
    .popout-spacer { display: none; }
}

/* フォルダ表示設定 */
.folder-settings-form { display: grid; gap: 12px; }
.folder-settings-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.folder-settings-table th:first-child,
.folder-settings-table td:first-child { width: 110px; white-space: nowrap; }
.folder-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    cursor: pointer;
}
.folder-toggle-label input { width: auto; }
.folder-disabled-row { opacity: .55; background: #f9fafb; }
.folder-disabled-row code { color: #667085; }


/* スマホ/タブレットでも上部バーは左タイトル・右ログアウトで固定 */
.topbar.main-topbar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: nowrap; }
.main-topbar .brand { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-topbar .logout-only-nav { flex: 0 0 auto; width: auto; margin-left: auto; justify-content: flex-end; }
.main-topbar .logout-form button { white-space: nowrap; }
@media (max-width: 720px) {
    .topbar.main-topbar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: nowrap; padding: 10px 12px; }
    .main-topbar .logout-only-nav { width: auto; margin-left: auto; }
}

/* 2026-05-20: 画面全体スクロール抑止＋スマホ上部バー固定 */
:root {
    --app-topbar-height: 56px;
}

body:has(.topbar) {
    padding-top: var(--app-topbar-height);
}

.topbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: var(--app-topbar-height);
    z-index: 5000;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    padding: 0 16px;
}

.topbar .brand {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar .nav {
    width: auto !important;
    margin-left: auto;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.topbar .logout-form,
.topbar .logout-form button {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (min-width: 761px) {
    html,
    body:has(.outlook-shell) {
        height: 100%;
    }

    body:has(.outlook-shell) {
        overflow: hidden;
    }

    .container:has(.outlook-shell) {
        width: 100%;
        max-width: none;
        height: calc(100dvh - var(--app-topbar-height));
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }

    .outlook-shell {
        height: calc(100dvh - var(--app-topbar-height));
        min-height: 0;
        overflow: hidden;
    }

    .outlook-folder-pane,
    .outlook-message-list,
    .outlook-reading-pane {
        overscroll-behavior: contain;
    }
}

@media (max-width: 760px) {
    body:has(.topbar) {
        padding-top: var(--app-topbar-height);
    }

    .topbar {
        height: var(--app-topbar-height);
        padding: 0 10px;
    }

    .topbar .brand {
        font-size: .98rem;
    }

    .topbar .nav a,
    .topbar .logout-form button {
        padding: 7px 10px;
        font-size: .9rem;
    }

    .container:has(.outlook-shell),
    .outlook-shell {
        min-height: calc(100dvh - var(--app-topbar-height));
    }

    .outlook-folder-pane,
    .outlook-commandbar,
    .mobile-back-to-list {
        top: var(--app-topbar-height);
    }
}

/* 各種設定まとめ画面 */
.unified-settings {
    max-width: 1180px;
    margin: 0 auto;
}
.settings-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.settings-section h2 {
    margin: 0 0 6px;
    font-size: 1.2rem;
}
.folder-disabled-row {
    color: #98a2b3;
    background: #f8fafc;
}
.folder-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.folder-settings-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 12px 0;
}
.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.check-label input[type="checkbox"] {
    width: auto;
}


/* HTMLメールの外部画像表示確認 */
.remote-image-notice {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #d7e3f4;
  background: #f3f8ff;
  color: #1f3d63;
  border-radius: 8px;
  font-size: 0.92rem;
}

.link-button {
  border: 0;
  background: transparent;
  color: #0b5cad;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.link-button:hover {
  color: #083f78;
}

.outlook-preview-body img[data-image-blocked="true"],
.body img[data-image-blocked="true"] {
  display: none !important;
}

.outlook-preview-body img,
.body img {
  max-width: 100%;
  height: auto;
}

/* Modern Outlook-like refresh + IMAP folder sync helpers */
.outlook-shell {
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
}
.outlook-folder-pane {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(148,163,184,.25);
}
.outlook-folder {
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.outlook-folder:hover {
    transform: translateX(2px);
}
.outlook-folder.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: 2px;
    background: #dbeafe !important;
    color: #1e40af;
}
.outlook-message-row {
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.outlook-message-row:hover {
    box-shadow: inset 3px 0 0 var(--primary);
}
.outlook-message-row.dragging {
    opacity: .55;
    transform: scale(.99);
}
.folder-create-card {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid rgba(148,163,184,.28);
    border-radius: 16px;
    background: #f8fafc;
    display: grid;
    gap: 8px;
}
.folder-create-title {
    font-size: .82rem;
    font-weight: 800;
    color: #475467;
}
.folder-create-card input {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 10px;
}
.folder-create-card button {
    border: 0;
    border-radius: 10px;
    min-height: 36px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.folder-create-card p {
    margin: 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.45;
}
.move-select-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
    font-size: .86rem;
}
.move-select-label select {
    width: auto;
    min-width: 120px;
    height: 34px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: white;
}
.outlook-list-pane,
.outlook-reading-pane {
    background: rgba(255,255,255,.96);
}
.outlook-commandbar {
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
}
.outlook-command,
.outlook-send,
.outlook-compose-button {
    box-shadow: 0 1px 2px rgba(15,23,42,.08);
}

@media (max-width: 760px) {
    .folder-create-card { margin-bottom: 12px; }
    .move-select-label { width: 100%; }
    .move-select-label select { flex: 1; min-width: 0; }
}

/* Folder tree / Outlook-like folder context actions */
.outlook-folder {
  position: relative;
}
.outlook-folder-tree-space {
  display: inline-block;
  width: calc(var(--folder-depth, 0) * 18px);
  flex: 0 0 calc(var(--folder-depth, 0) * 18px);
}
.outlook-folder[style*="--folder-depth:1"] .outlook-folder-name,
.outlook-folder[style*="--folder-depth:2"] .outlook-folder-name,
.outlook-folder[style*="--folder-depth:3"] .outlook-folder-name {
  font-size: 0.94em;
}
.outlook-folder[style*="--folder-depth:1"] .outlook-folder-icon,
.outlook-folder[style*="--folder-depth:2"] .outlook-folder-icon,
.outlook-folder[style*="--folder-depth:3"] .outlook-folder-icon {
  opacity: .8;
}
.folder-context-menu {
  min-width: 190px;
}
.folder-create-modal-card {
  max-width: 420px;
}
.folder-create-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin: 8px 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}
.folder-create-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

/* Folder tree compact fix + remove old move-select UI spacing */
.outlook-shell {
    grid-template-columns: 235px minmax(320px, 430px) minmax(420px, 1fr);
}
.outlook-folder-pane {
    width: 235px;
}
.outlook-folder {
    display: grid;
    grid-template-columns: auto 22px minmax(0, 1fr) auto;
    gap: 4px;
    padding: 5px 8px;
    min-height: 32px;
}
.outlook-folder-tree-space {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: calc(var(--folder-depth, 0) * 16px);
    min-width: calc(var(--folder-depth, 0) * 16px);
    flex: 0 0 auto;
    color: #8a8886;
    font-size: .82rem;
    line-height: 1;
}
.outlook-folder-name {
    min-width: 0;
}
.outlook-folder-count {
    justify-self: end;
}
.move-select-label,
#moveDestinationSelect {
    display: none !important;
}

@media (min-width: 761px) and (max-width: 1100px) {
    .outlook-shell {
        grid-template-columns: 210px minmax(300px, 380px) minmax(360px, 1fr);
    }
    .outlook-folder-pane {
        width: 210px;
    }
}

@media (max-width: 1000px) {
    .outlook-folder-pane {
        width: auto;
    }
}

@media (max-width: 760px) {
    .outlook-folder {
        grid-template-columns: auto 22px minmax(0, 1fr) auto;
    }
    .outlook-folder-tree-space {
        width: calc(var(--folder-depth, 0) * 14px);
        min-width: calc(var(--folder-depth, 0) * 14px);
    }
}

/* Folder drag & drop */
.outlook-folder.folder-dragging {
    opacity: .55;
    transform: scale(.99);
}
.outlook-folder.drag-over::after {
    content: "ここへ移動";
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .72rem;
    font-weight: 800;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 2px 7px;
}


/* Message list sorting */
.outlook-sortbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    padding: 5px 10px;
    border-bottom: 1px solid #edebe9;
    background: rgba(250,250,250,.96);
}
.outlook-sort-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    min-width: 0;
}
.outlook-sort-form label,
.outlook-sort-status {
    color: #605e5c;
    font-size: .82rem;
    white-space: nowrap;
}
.outlook-sort-form select {
    height: 30px;
    min-width: 92px;
    padding: 3px 24px 3px 8px;
    border: 1px solid #d2d0ce;
    border-radius: 8px;
    background: #fff;
    color: #323130;
}
.outlook-sort-direction {
    width: 32px;
    height: 30px;
    border: 1px solid #d2d0ce;
    border-radius: 8px;
    background: #fff;
    color: #0078d4;
    font-weight: 800;
    cursor: pointer;
}
.outlook-sort-direction:hover,
.outlook-sort-form select:hover {
    background: #f3f2f1;
}
@media (max-width: 760px) {
    .outlook-sortbar { align-items: stretch; flex-direction: column; }
    .outlook-sort-form { width: 100%; }
    .outlook-sort-form select { flex: 1; min-width: 0; }
}

/* 無操作ログアウト警告 */
.idle-warning-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .35);
    padding: 18px;
}
.idle-warning-modal[hidden] { display: none !important; }
.idle-warning-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .25);
    padding: 22px;
    color: #1f2937;
}
.idle-warning-card h3 {
    margin: 0 0 10px;
    font-size: 20px;
}
.idle-warning-card p {
    margin: 0 0 18px;
    line-height: 1.7;
}
.idle-warning-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
@media (max-width: 640px) {
    .idle-warning-card { padding: 18px; }
    .idle-warning-actions { justify-content: stretch; }
    .idle-warning-actions button { flex: 1 1 auto; }
}


/* 2026-05-21: 上部バー右側に「⚙ 設定」とログアウトを横並び配置 */
.main-topbar .topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
}
.top-settings-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #d2d0ce;
    border-radius: 999px;
    background: #fff;
    color: #323130;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}
.top-settings-link:hover {
    background: #f3f2f1;
}
@media (max-width: 720px) {
    .main-topbar .topbar-actions {
        gap: 6px;
    }
    .top-settings-link,
    .main-topbar .logout-form button {
        min-height: 34px;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 13px;
    }
}


/* メール本文ポップアウト */
.message-popout-body {
    margin: 0;
    background: #f5f7fb;
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.message-popout-card {
    min-height: 100vh;
    background: #fff;
    padding: 22px 26px 30px;
}
.message-popout-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.message-popout-header h1 {
    margin: 0;
    font-size: 1.35rem;
}
.message-popout-date {
    margin-top: 6px;
    color: var(--muted);
    font-size: .92rem;
}
.message-popout-close {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.message-popout-close:hover { background: #f3f4f6; }
.message-popout-meta {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 16px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.message-popout-meta dt {
    color: var(--muted);
    font-weight: 700;
}
.message-popout-meta dd {
    margin: 0;
    overflow-wrap: anywhere;
}
.message-popout-attachments { margin-top: 12px; }
.message-popout-content {
    margin-top: 18px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.message-popout-content img { max-width: 100%; height: auto; }

@media (max-width: 720px) {
    .message-popout-card { padding: 16px 14px 24px; }
    .message-popout-header { align-items: stretch; flex-direction: column; }
    .message-popout-close { align-self: flex-end; }
    .message-popout-meta { grid-template-columns: 1fr; }
}

/* Popout message toolbar */
.message-popout-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 0 12px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.message-popout-toolbar .inline-form {
    display: inline-flex;
    margin: 0;
}

.message-popout-toolbar .outlook-command {
    text-decoration: none;
}


/* Mail action buttons */
.mail-action-button {
    gap: 6px;
}

.mail-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #eff6fc;
    color: #0078d4;
    font-weight: 700;
    font-size: 13px;
    line-height: 1;
}

.outlook-command.primary .mail-action-icon {
    background: #0078d4;
    color: #fff;
}

/* 2026-05-22: タブレット/Android Chrome「PC版サイト」時の自動フィット調整
   761px以上はスマホ用1カラムへ落とさず、幅に合わせたOutlook風3カラムで表示する。 */
@media (min-width: 761px) and (max-width: 1180px) {
    html,
    body:has(.outlook-shell) {
        height: 100%;
    }

    body:has(.outlook-shell) {
        overflow: hidden;
    }

    .container:has(.outlook-shell) {
        width: 100% !important;
        max-width: none !important;
        height: calc(100dvh - var(--app-topbar-height)) !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .outlook-shell {
        display: grid !important;
        grid-template-columns:
            clamp(170px, 22vw, 225px)
            minmax(280px, 40vw)
            minmax(280px, 1fr) !important;
        height: calc(100dvh - var(--app-topbar-height)) !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .outlook-folder-pane {
        position: relative !important;
        top: auto !important;
        width: auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        border-right: 1px solid #d2d0ce !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
    }

    .outlook-folder-list {
        display: grid !important;
        gap: 1px !important;
        overflow-x: visible !important;
        padding-bottom: 0 !important;
    }

    .outlook-folder {
        min-width: 0 !important;
        width: 100% !important;
        flex: initial !important;
    }

    .outlook-folder.active {
        box-shadow: inset 3px 0 0 #0078d4 !important;
    }

    .outlook-list-pane {
        display: grid !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: hidden !important;
        border-right: 1px solid #d2d0ce !important;
        border-bottom: 0 !important;
    }

    .outlook-message-list {
        max-height: none !important;
        overflow-y: auto !important;
    }

    .outlook-reading-pane {
        display: block !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        border-top: 0 !important;
    }

    .outlook-shell.mobile-detail-open .outlook-list-pane,
    .outlook-shell:not(.mobile-detail-open) .outlook-reading-pane {
        display: grid !important;
    }

    .mobile-back-to-list {
        display: none !important;
    }

    .outlook-commandbar {
        position: relative !important;
        top: auto !important;
        z-index: auto !important;
    }

    .outlook-list-header {
        min-height: 58px;
        padding: 10px 12px 8px;
    }

    .outlook-list-header h1 {
        font-size: 1.12rem;
    }

    .outlook-message-row {
        min-height: 66px;
    }

    .outlook-pane-titlebar {
        min-height: 54px;
        padding: 12px 14px;
    }

    .outlook-pane-titlebar h2 {
        font-size: 1.12rem;
    }
}

/* タブレットのログイン画面も、PC版サイト時に右へ寄らず画面中央へ収める */
@media (min-width: 761px) and (max-width: 1180px) {
    .login-container {
        width: 100% !important;
        max-width: none !important;
        min-height: calc(100dvh - 24px);
        display: grid;
        place-items: center;
        padding: 24px !important;
    }

    .login-card {
        width: min(460px, calc(100vw - 48px));
        max-width: 460px;
        margin: 0 auto !important;
    }
}

/* Brand icon */
.topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0f6cbd, #2563eb);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(15, 108, 189, .22);
}
.brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .brand-icon { width: 24px; height: 24px; border-radius: 7px; font-size: 14px; }
    .topbar .brand { gap: 6px; }
}

/* Modern Gmail-like compose layout */
.modern-compose-pane {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: #fff;
}
.modern-compose-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 100%;
    padding: 0;
    background: #fff;
}
.compose-top-actions {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
}
.compose-title-group { min-width: 160px; flex: 1 1 auto; }
.compose-title { font-weight: 800; color: #111827; font-size: 1rem; }
.compose-subtitle { color: #6b7280; font-size: .78rem; margin-top: 2px; }
.compose-action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.outlook-command.as-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-height: 34px;
    box-sizing: border-box;
}
.gmail-compose-fields {
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}
.gmail-field-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-bottom: 1px solid #f0f2f5;
    column-gap: 10px;
}
.gmail-field-row:last-child { border-bottom: 0; }
.gmail-field-row label {
    margin: 0;
    color: #5f6368;
    font-size: .88rem;
    font-weight: 700;
}
.gmail-field-row input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 8px 2px !important;
    outline: none;
    background: transparent;
    font-size: .95rem;
}
.gmail-field-row input:focus { box-shadow: none; }
.recipient-toggle-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.recipient-toggle-links button {
    border: 0;
    background: transparent;
    color: #2563eb;
    padding: 4px 2px;
    font-weight: 700;
    cursor: pointer;
}
.recipient-toggle-links button:hover { text-decoration: underline; }
.optional-recipient.is-hidden { display: none; }
.optional-recipient { grid-template-columns: 64px minmax(0, 1fr); }
.subject-row { grid-template-columns: 64px minmax(0, 1fr); }
.compose-body-editor {
    flex: 1 1 auto;
    min-height: 300px;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 16px 18px !important;
    resize: vertical;
    outline: none;
    font-size: .96rem;
    line-height: 1.65;
    background: #fff;
}
.compose-attachment-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 14px;
    border-top: 1px solid #f0f2f5;
    background: #fafafa;
}
.compose-attachment-row label {
    margin: 0;
    color: #5f6368;
    font-weight: 700;
    font-size: .86rem;
}
.popout-compose-page.no-topbar .modern-compose-form { min-height: 100vh; }
.popout-compose-actions-top {
    margin: 0;
    padding: 10px 14px;
}
@media (max-width: 760px) {
    .compose-top-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }
    .compose-action-buttons { justify-content: flex-start; }
    .compose-title-group { min-width: 0; }
    .gmail-field-row {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        padding: 0 10px;
    }
    .optional-recipient,
    .subject-row { grid-template-columns: 52px minmax(0, 1fr); }
    .compose-body-editor { min-height: 260px; padding: 14px 12px !important; }
    .compose-attachment-row { align-items: flex-start; flex-direction: column; gap: 6px; }
}

/* 2026-05-22: 全体デザイン刷新 + 作成画面添付ボタンを件名横へ移動 */
:root {
    --bg: #f6f8fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e6eaf0;
    --primary: #0f6cbd;
    --primary-dark: #0b5cab;
    --soft-blue: #eef6ff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 10px 28px rgba(15, 23, 42, .08);
}

body {
    background: linear-gradient(135deg, #f7faff 0%, #eef4fb 50%, #f8fafc 100%);
    color: var(--text);
}

.topbar {
    background: rgba(255, 255, 255, .88) !important;
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, .9) !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .06);
}

.brand-icon {
    border-radius: 10px;
    background: linear-gradient(135deg, #0f6cbd 0%, #2563eb 55%, #7c3aed 100%);
}

.top-settings-link,
.topbar .logout-form button,
.nav a,
.logout-form button {
    border-color: rgba(203, 213, 225, .9) !important;
    background: rgba(255,255,255,.88) !important;
    box-shadow: var(--shadow-sm);
    transition: background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.top-settings-link:hover,
.topbar .logout-form button:hover,
.nav a:hover,
.logout-form button:hover {
    background: #f8fbff !important;
    border-color: rgba(15, 108, 189, .35) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
}

.outlook-shell {
    background: #f6f8fb !important;
    border-top: 0;
}
.outlook-folder-pane,
.outlook-list-pane,
.outlook-reading-pane {
    background: rgba(255, 255, 255, .94) !important;
    border-color: rgba(226, 232, 240, .95) !important;
}
.outlook-folder-pane {
    box-shadow: inset -1px 0 0 rgba(226, 232, 240, .7);
}
.outlook-list-header,
.outlook-commandbar,
.outlook-sortbar,
.outlook-search-note,
.outlook-pane-titlebar {
    background: rgba(255, 255, 255, .92) !important;
    backdrop-filter: blur(12px);
    border-color: rgba(226, 232, 240, .95) !important;
}
.outlook-list-header h1,
.outlook-pane-titlebar h2 {
    letter-spacing: .01em;
}
.outlook-compose-button {
    min-height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f6cbd, #2563eb) !important;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .22);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.outlook-compose-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 14px 28px rgba(37, 99, 235, .26);
}
.outlook-folder {
    border-radius: 12px;
    min-height: 36px;
    transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.outlook-folder:hover {
    background: #f3f7fc !important;
    transform: translateX(2px);
}
.outlook-folder.active {
    background: #eaf4ff !important;
    box-shadow: inset 3px 0 0 var(--primary), 0 1px 0 rgba(15, 23, 42, .03) !important;
    color: #0f4c81;
}
.outlook-message-row {
    border-color: #edf2f7 !important;
    transition: background .14s ease, box-shadow .14s ease, transform .14s ease;
}
.outlook-message-row:hover {
    background: #f8fbff !important;
    box-shadow: inset 3px 0 0 rgba(15, 108, 189, .45);
}
.outlook-message-row.selected {
    background: #eaf4ff !important;
    box-shadow: inset 3px 0 0 var(--primary) !important;
}
.outlook-command,
.outlook-refresh-button,
.outlook-sort-direction,
.outlook-sort-form select {
    border-radius: 12px !important;
    border-color: #d9e2ec !important;
    background: #fff !important;
    box-shadow: var(--shadow-sm);
    transition: background .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.outlook-command:hover,
.outlook-refresh-button:hover,
.outlook-sort-direction:hover,
.outlook-sort-form select:hover {
    background: #f8fbff !important;
    border-color: rgba(15, 108, 189, .35) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, .07);
}
.outlook-command.primary,
.outlook-send {
    border-radius: 14px !important;
    background: linear-gradient(135deg, #0f6cbd, #2563eb) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, .22) !important;
}
.outlook-send:hover,
.outlook-command.primary:hover {
    background: linear-gradient(135deg, #0b5cab, #1d4ed8) !important;
}
.outlook-message-preview,
.preview-card,
.message-card,
.login-card,
.settings-card {
    border-color: rgba(226, 232, 240, .95) !important;
    box-shadow: var(--shadow-md);
}
.outlook-preview-meta,
.message-popout-meta,
.gmail-compose-fields,
.gmail-field-row,
.outlook-preview-actions,
.message-popout-toolbar {
    border-color: #edf2f7 !important;
}
.context-menu,
.compose-modal-card,
.idle-warning-card {
    border: 1px solid rgba(226, 232, 240, .95) !important;
    border-radius: 18px !important;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .18) !important;
}

/* 作成画面 */
.modern-compose-pane,
.outlook-compose-pane,
.popout-compose-form {
    background: #fff;
}
.compose-top-actions {
    background: rgba(255, 255, 255, .96) !important;
    border-bottom: 1px solid #edf2f7 !important;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.compose-title { font-size: 1.05rem; }
.compose-subtitle { color: #7b8494; }
.gmail-compose-fields {
    background: #fff;
}
.gmail-field-row {
    min-height: 40px;
    border-bottom: 1px solid #f0f3f7 !important;
}
.gmail-field-row input {
    color: #111827;
}
.subject-row.has-attachment-button {
    grid-template-columns: 64px minmax(0, 1fr) auto;
}
.compose-attach-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid #d9e2ec;
    border-radius: 999px;
    background: #f8fbff;
    color: #0f4c81;
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background .14s ease, border-color .14s ease, transform .14s ease;
}
.compose-attach-button:hover {
    background: #eaf4ff;
    border-color: rgba(15,108,189,.35);
    transform: translateY(-1px);
}
.compose-file-input { display: none !important; }
.compose-attachment-summary {
    min-height: 28px;
    padding: 6px 14px 7px 78px;
    color: #7b8494;
    font-size: .82rem;
    background: #fbfcfe;
    border-bottom: 1px solid #f0f3f7;
    overflow-wrap: anywhere;
}
.compose-attachment-summary.has-files {
    color: #0f4c81;
    font-weight: 700;
}
.compose-attachment-row {
    display: none !important;
}
.compose-body-editor {
    min-height: 340px;
    background: #fff !important;
}
.popout-compose-actions-top {
    box-shadow: 0 2px 12px rgba(15,23,42,.06);
}

@media (max-width: 760px) {
    .subject-row.has-attachment-button {
        grid-template-columns: 52px minmax(0, 1fr);
        row-gap: 6px;
        padding-top: 6px;
        padding-bottom: 6px;
    }
    .subject-row.has-attachment-button .compose-attach-button {
        grid-column: 2;
        width: fit-content;
    }
    .compose-attachment-summary {
        padding-left: 62px;
    }
    .compose-action-buttons {
        gap: 6px;
    }
    .outlook-command,
    .outlook-send {
        min-height: 34px;
    }
}


/* 印刷時はメール本文だけを出力する */
#print-only-message {
    display: none;
}

@media print {
    @page {
        margin: 12mm;
    }

    html,
    body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: #fff !important;
        color: #000 !important;
    }

    body > *:not(#print-only-message) {
        display: none !important;
    }

    #print-only-message {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    #print-only-message *,
    #print-only-message {
        visibility: visible !important;
        overflow: visible !important;
        box-shadow: none !important;
    }

    #print-only-message .outlook-message-preview,
    #print-only-message .message-popout-card,
    #print-only-message .message-card {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #000 !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    #print-only-message .outlook-pane-titlebar,
    #print-only-message .message-popout-header {
        display: block !important;
        min-height: 0 !important;
        padding: 0 0 10px 0 !important;
        margin: 0 0 10px 0 !important;
        border-bottom: 1px solid #bbb !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    #print-only-message h1,
    #print-only-message h2 {
        margin: 0 0 6px 0 !important;
        font-size: 16pt !important;
        line-height: 1.35 !important;
        color: #000 !important;
    }

    #print-only-message .outlook-message-date,
    #print-only-message .message-popout-date {
        color: #333 !important;
        font-size: 9.5pt !important;
    }

    #print-only-message .outlook-preview-meta,
    #print-only-message .message-popout-meta,
    #print-only-message .meta {
        display: grid !important;
        grid-template-columns: 48px 1fr !important;
        gap: 3px 8px !important;
        margin: 0 0 10px 0 !important;
        padding: 0 0 10px 0 !important;
        border-bottom: 1px solid #ddd !important;
        font-size: 9.5pt !important;
        color: #000 !important;
    }

    #print-only-message .outlook-preview-meta dt,
    #print-only-message .message-popout-meta dt,
    #print-only-message .meta dt {
        color: #333 !important;
        font-weight: 700 !important;
    }

    #print-only-message .outlook-preview-meta dd,
    #print-only-message .message-popout-meta dd,
    #print-only-message .meta dd {
        margin: 0 !important;
        overflow-wrap: anywhere !important;
    }

    #print-only-message .attachments,
    #print-only-message .outlook-attachments,
    #print-only-message .message-popout-attachments {
        margin: 0 0 10px 0 !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid #ddd !important;
        background: #fff !important;
    }

    #print-only-message .outlook-preview-body,
    #print-only-message .message-popout-content,
    #print-only-message .body {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
        color: #000 !important;
        font-size: 10.5pt !important;
        line-height: 1.55 !important;
    }

    #print-only-message img,
    #print-only-message table {
        max-width: 100% !important;
        height: auto !important;
    }

    #print-only-message pre {
        white-space: pre-wrap !important;
        word-break: break-word !important;
    }

    #print-only-message a::after {
        content: "" !important;
    }
}

/* 添付ファイルの合計サイズエラー表示 */
.compose-attachment-summary.is-error {
    color: #b91c1c;
    background: #fff1f2;
    border-bottom-color: #fecdd3;
    font-weight: 700;
}

/* 添付ファイルまわり改善 */
.compose-attachment-summary.has-files {
    display: block;
    padding: 8px 10px;
    border: 1px solid rgba(37, 99, 235, .18);
    background: rgba(37, 99, 235, .04);
    border-radius: 10px;
    font-size: 13px;
}
.attachment-summary-title {
    color: #334155;
    font-weight: 600;
    margin-bottom: 6px;
}
.attachment-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #1e293b;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    cursor: default;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.attachment-chip:hover {
    background: #f8fafc;
    border-color: #bfd0e6;
}
.attachment-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}
.attachment-chip-size {
    color: #64748b;
    font-size: 11px;
}
.compose-drop-active {
    outline: 2px dashed #2563eb !important;
    outline-offset: -8px;
    background: rgba(37, 99, 235, .05) !important;
}
@media (max-width: 640px) {
    .attachment-chip-name { max-width: 150px; }
    .attachment-chip-list { gap: 5px; }
}

/* 作成中添付ファイルの右クリックメニュー */
.attachment-context-menu {
    position: fixed;
    z-index: 100000;
    min-width: 180px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #d8e1ef;
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
    display: none;
}
.attachment-context-menu.is-visible { display: block; }
.attachment-context-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: #1e293b;
    text-align: left;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.attachment-context-menu button:hover { background: #eef4ff; }
.attachment-context-menu button[data-attachment-menu-remove]:hover {
    background: #fff1f2;
    color: #b91c1c;
}

/* HTMLメール本文のスマホ/タブレット幅フィット */
.outlook-preview-body,
.message-popout-content {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.html-mail-fit-inner {
  display: block;
  max-width: none;
  transform-origin: top left;
}

.html-mail-fit-inner table,
.html-mail-fit-inner img,
.html-mail-fit-inner div,
.html-mail-fit-inner center {
  box-sizing: border-box;
}

.html-mail-fit-inner img {
  height: auto;
}

@media print {
  .html-mail-fit-inner {
    transform: none !important;
    width: auto !important;
  }
  .outlook-preview-body,
  .message-popout-content {
    height: auto !important;
    overflow: visible !important;
  }
}

/* テキスト形式メール：本文そのものの改行をそのまま表示する。
   <br>変換は使わず、pre要素 + pre-wrapでOutlook/メモ帳に近い改行表示にする。 */
.plain-text-body {
  display: block;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: inherit !important;
  font-size: inherit;
  line-height: 1.42;
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: transparent;
  border: 0;
}


.linebreak-debug {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}
.linebreak-debug summary {
  cursor: pointer;
  font-weight: 700;
}
.linebreak-debug pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.35;
}
@media print {
  .linebreak-debug { display: none !important; }
}
