:root {
    --wm-bg: #071013;
    --wm-panel: #101b20;
    --wm-panel-soft: #15262d;
    --wm-line: rgba(143, 182, 195, 0.22);
    --wm-text: #eef7f8;
    --wm-muted: #8fa8af;
    --wm-accent: #00d9e8;
    --wm-accent-strong: #35f4ff;
    --wm-danger: #ff5c76;
    --wm-success: #58df9b;
    --wm-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(0, 217, 232, 0.08), transparent 36%),
        linear-gradient(180deg, #071013 0%, #0b1115 100%);
    color: var(--wm-text);
    font-family: "Noto Sans JP", "Inter", sans-serif;
    line-height: 1.7;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

.wm-shell {
    min-height: 100vh;
}

.wm-header {
    min-height: 84px;
    padding: 18px clamp(18px, 3vw, 42px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--wm-line);
    background: rgba(7, 16, 19, 0.86);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.wm-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.wm-brand img {
    width: clamp(132px, 16vw, 206px);
    height: auto;
}

.wm-brand span {
    padding-left: 14px;
    border-left: 1px solid var(--wm-line);
}

.wm-header-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.wm-site-menu-button,
.wm-site-navigation {
    display: none;
}

.wm-lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(0, 240, 255, 0.48);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(4, 12, 18, 0.92));
    box-shadow:
        0 0 0 1px rgba(0, 240, 255, 0.12) inset,
        0 16px 40px rgba(0, 0, 0, 0.28),
        0 0 28px rgba(0, 240, 255, 0.14);
}

.wm-lang-switcher a {
    min-width: 40px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--wm-muted);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.wm-lang-switcher a:hover,
.wm-lang-switcher a.active {
    background: #00f0ff;
    color: #001014;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.34);
    transform: translateY(-1px);
}

.wm-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.wm-top-actions a,
.wm-top-actions button {
    min-height: 38px;
    border: 1px solid var(--wm-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--wm-text);
    text-decoration: none;
    padding: 7px 14px;
    cursor: pointer;
}

.wm-top-actions form {
    margin: 0;
}

.wm-user {
    color: var(--wm-muted);
    font-size: 0.88rem;
}

.wm-main {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px) 0;
}

.wm-login {
    min-height: calc(100vh - 180px);
    display: grid;
    place-items: center;
}

.wm-login-card {
    width: min(940px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: clamp(22px, 4vw, 42px);
    align-items: stretch;
}

.wm-login-copy,
.wm-login-form,
.wm-panel {
    border: 1px solid var(--wm-line);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(16, 27, 32, 0.96), rgba(9, 18, 22, 0.98));
    box-shadow: var(--wm-shadow);
}

.wm-login-copy {
    padding: clamp(28px, 5vw, 54px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wm-kicker {
    color: var(--wm-accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.wm-login-copy h1,
.wm-toolbar h1,
.wm-panel h1 {
    margin: 8px 0 0;
    line-height: 1.28;
    letter-spacing: 0;
}

.wm-login-copy h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

.wm-login-copy p {
    margin: 20px 0 0;
    color: var(--wm-muted);
}

.wm-login-form,
.wm-compose-form {
    padding: clamp(24px, 4vw, 38px);
}

.wm-login-form h2 {
    margin: 0 0 18px;
}

.wm-login-form label,
.wm-compose-form label {
    display: block;
    margin: 18px 0 8px;
    color: var(--wm-muted);
    font-weight: 700;
}

.wm-login-form input,
.wm-compose-form input,
.wm-compose-form textarea {
    width: 100%;
    border: 1px solid rgba(143, 182, 195, 0.34);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--wm-text);
    padding: 13px 14px;
    outline: none;
}

.wm-login-form input:focus,
.wm-compose-form input:focus,
.wm-compose-form textarea:focus {
    border-color: rgba(0, 217, 232, 0.78);
    box-shadow: 0 0 0 3px rgba(0, 217, 232, 0.12);
}

.wm-login-form button,
.wm-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--wm-accent), #1885c9);
    color: #00161a;
    padding: 10px 18px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.wm-login-form button {
    width: 100%;
    margin-top: 24px;
}

.wm-button-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--wm-text);
    border: 1px solid var(--wm-line);
}

.wm-button-danger {
    background: rgba(255, 92, 118, 0.12);
    color: #ffd9df;
    border: 1px solid rgba(255, 92, 118, 0.42);
}

.wm-form-note {
    margin: 14px 0 0;
    color: var(--wm-muted);
    font-size: 0.86rem;
}

.wm-error,
.wm-error-list,
.wm-flash {
    border-radius: 7px;
    padding: 12px 14px;
}

.wm-error,
.wm-error-list,
.wm-flash-error {
    background: rgba(255, 92, 118, 0.12);
    color: #ffd9df;
    border: 1px solid rgba(255, 92, 118, 0.28);
}

.wm-flash-success {
    background: rgba(88, 223, 155, 0.12);
    color: #c8ffe3;
    border: 1px solid rgba(88, 223, 155, 0.28);
}

.wm-flash {
    margin-bottom: 18px;
}

.wm-app-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.wm-side-nav {
    position: sticky;
    top: 108px;
    display: grid;
    gap: 10px;
}

.wm-side-nav a {
    display: block;
    border: 1px solid var(--wm-line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--wm-muted);
    text-decoration: none;
    padding: 13px 16px;
    font-weight: 700;
}

.wm-side-nav a.active,
.wm-side-nav a:hover {
    color: #fff;
    border-color: rgba(0, 217, 232, 0.6);
    background: rgba(0, 217, 232, 0.1);
}

.wm-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.wm-toolbar h1 {
    font-size: clamp(1.55rem, 2.6vw, 2.35rem);
}

.wm-toolbar-actions,
.wm-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wm-panel {
    padding: clamp(18px, 3vw, 28px);
}

.wm-bulk-form {
    margin: 0;
}

.wm-list-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.wm-select-all,
.wm-message-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--wm-muted);
    font-weight: 700;
}

.wm-select-all input,
.wm-message-select input {
    width: 18px;
    height: 18px;
    accent-color: var(--wm-accent);
}

.wm-message-select {
    justify-content: center;
}

.wm-message-list {
    display: grid;
    gap: 8px;
}

.wm-message-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(143, 182, 195, 0.14);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--wm-text);
}

.wm-message-link {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    color: var(--wm-text);
    text-decoration: none;
}

.wm-message-row.unread {
    border-color: rgba(0, 217, 232, 0.34);
    background: rgba(0, 217, 232, 0.075);
}

.wm-message-main {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.wm-message-main strong,
.wm-message-main small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wm-message-main small,
.wm-message-meta,
.wm-empty {
    color: var(--wm-muted);
}

.wm-message-meta {
    display: grid;
    gap: 2px;
    text-align: right;
    font-size: 0.84rem;
}

.wm-pagination {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.wm-pagination a {
    color: var(--wm-accent-strong);
    text-decoration: none;
}

.wm-back-link {
    color: var(--wm-accent-strong);
    text-decoration: none;
    font-weight: 700;
}

.wm-message-detail {
    display: grid;
    gap: 22px;
}

.wm-message-headers {
    display: grid;
    gap: 10px;
    margin: 0;
}

.wm-message-headers div {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 16px;
}

.wm-message-headers dt {
    color: var(--wm-muted);
    font-weight: 800;
}

.wm-message-headers dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.wm-attachments {
    border-top: 1px solid var(--wm-line);
    border-bottom: 1px solid var(--wm-line);
    padding: 18px 0;
}

.wm-attachments h2 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.wm-attachment-list {
    display: grid;
    gap: 8px;
}

.wm-attachment-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(143, 182, 195, 0.18);
    border-radius: 7px;
    padding: 11px 13px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
}

.wm-attachment-list span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wm-attachment-list small {
    color: var(--wm-muted);
}

.wm-attachment-list b {
    color: var(--wm-accent-strong);
    font-size: 0.86rem;
}

.wm-message-body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #edf8f9;
    font: inherit;
}

.wm-compose-form {
    display: grid;
}

.wm-compose-form textarea {
    resize: vertical;
    min-height: 240px;
}

@media (max-width: 900px) {
    .wm-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .wm-top-actions {
        justify-content: flex-start;
    }

    .wm-header-tools {
        width: 100%;
        justify-content: flex-start;
    }

    .wm-login-card,
    .wm-app-layout {
        grid-template-columns: 1fr;
    }

    .wm-side-nav {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .wm-main {
        width: min(100% - 24px, 1180px);
        padding-top: 22px;
    }

    .wm-brand {
        width: 100%;
        justify-content: space-between;
    }

    .wm-brand span {
        font-size: 0.95rem;
    }

    .wm-lang-switcher,
    .wm-top-actions {
        width: 100%;
    }

    .wm-top-actions a,
    .wm-top-actions button {
        min-height: 36px;
        padding: 7px 12px;
    }

    .wm-lang-switcher a {
        min-width: 40px;
        height: 33px;
        padding: 0 11px;
        font-size: 0.78rem;
    }

    .wm-toolbar {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .wm-toolbar {
        display: grid;
    }

    .wm-toolbar-actions,
    .wm-form-actions {
        display: grid;
    }

    .wm-message-meta {
        text-align: left;
        display: flex;
        justify-content: space-between;
    }

    .wm-message-link {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .wm-message-headers div,
    .wm-attachment-list a {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 136px;
    }

    body.wm-mobile-nav-open {
        overflow: hidden;
    }

    .wm-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        min-height: 116px;
        height: 116px;
        padding: 14px 16px;
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        background: rgba(3, 10, 14, 0.95);
        border-bottom-color: rgba(0, 240, 255, 0.18);
        box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
        z-index: 2200;
    }

    .wm-brand {
        width: auto;
        min-width: 0;
        justify-content: flex-start;
        gap: 8px;
        position: relative;
        z-index: 2202;
    }

    .wm-brand img {
        width: 132px;
    }

    .wm-brand span {
        display: none;
    }

    .wm-site-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 9px;
        min-width: 96px;
        height: 44px;
        padding: 0 13px;
        border: 1px solid rgba(0, 240, 255, 0.36);
        border-radius: 999px;
        background: rgba(0, 240, 255, 0.08);
        color: #fff;
        cursor: pointer;
        position: fixed;
        top: 14px;
        right: 16px;
        z-index: 2203;
    }

    .wm-site-menu-button strong {
        margin-left: 28px;
        font-size: 0.78rem;
        letter-spacing: 0.04em;
    }

    .wm-site-menu-button > span {
        position: absolute;
        left: 13px;
        width: 21px;
        height: 2px;
        margin: 0;
        background: #fff;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .wm-site-menu-button > span:nth-child(1) { top: 13px; }
    .wm-site-menu-button > span:nth-child(2) { top: 20px; }
    .wm-site-menu-button > span:nth-child(3) { top: 27px; }
    .wm-site-menu-button.active > span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .wm-site-menu-button.active > span:nth-child(2) { opacity: 0; }
    .wm-site-menu-button.active > span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .wm-site-navigation {
        display: block;
        position: fixed;
        inset: 0;
        height: 100vh;
        height: 100dvh;
        padding: 132px 20px 94px;
        overflow-y: auto;
        background:
            radial-gradient(circle at 88% 8%, rgba(0, 240, 255, 0.12), transparent 34%),
            rgba(3, 9, 13, 0.985);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-100%);
        transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease, visibility 0s linear 0.42s;
        z-index: 2201;
    }

    .wm-site-navigation.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        transition-delay: 0s;
    }

    .wm-site-navigation ul {
        width: min(100%, 520px);
        margin: 0 auto;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        list-style: none;
    }

    .wm-site-navigation a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 13px 16px;
        border-left: 2px solid transparent;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.045);
        color: #b8c4c9;
        font-weight: 700;
        text-decoration: none;
    }

    .wm-site-navigation a.active,
    .wm-site-navigation a:hover {
        border-left-color: var(--wm-accent);
        background: rgba(255, 255, 255, 0.09);
        color: #fff;
    }

    .wm-header-tools {
        display: block;
        width: auto;
    }

    .wm-lang-switcher {
        position: fixed;
        top: 68px;
        right: 16px;
        width: auto;
        padding: 3px;
        gap: 2px;
        z-index: 2202;
    }

    .wm-lang-switcher a {
        min-width: 38px;
        height: 32px;
        padding: 0 9px;
        font-size: 0.74rem;
    }

    .wm-top-actions {
        display: none;
    }

    body.wm-mobile-nav-open .wm-top-actions {
        display: flex;
        position: fixed;
        left: 20px;
        right: 20px;
        bottom: 18px;
        justify-content: center;
        padding-top: 12px;
        border-top: 1px solid var(--wm-line);
        z-index: 2202;
    }

    .wm-main {
        width: min(100% - 24px, 1180px);
        padding-top: 144px;
    }
}

@media (max-width: 768px) and (orientation: landscape) and (min-width: 560px) {
    html {
        scroll-padding-top: 88px;
    }

    .wm-header {
        height: 76px;
        min-height: 76px;
        align-items: center;
        padding: 10px 18px;
    }

    .wm-site-menu-button {
        top: 16px;
        right: 18px;
    }

    .wm-brand img {
        width: 150px;
    }

    .wm-lang-switcher {
        top: 18px;
        right: 132px;
    }

    .wm-site-navigation {
        padding: 92px 22px 78px;
    }

    .wm-site-navigation ul {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px 10px;
        width: min(100%, 720px);
    }

    .wm-site-navigation a {
        min-height: 44px;
        padding: 11px 14px;
        font-size: 0.86rem;
    }

    .wm-main {
        padding-top: 100px;
    }
}

@media (max-width: 390px) {
    .wm-login-copy,
    .wm-login-form,
    .wm-panel {
        padding: 18px;
    }

    .wm-side-nav {
        grid-template-columns: 1fr;
    }
}
