* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f6f7f9;
    color: #222;
    line-height: 1.7;
}

body > h1,
body > h2,
body > p,
body > form,
body > table,
body > .nav,
body > .box,
body > .draft,
body > .menu-card,
body > a {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

h1 {
    margin-top: 32px;
    margin-bottom: 20px;
    font-size: 28px;
    letter-spacing: 0.02em;
}

h2 {
    margin-top: 8px;
    margin-bottom: 16px;
    font-size: 20px;
    color: #333;
}

p {
    margin-top: 8px;
    margin-bottom: 8px;
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.nav a,
button,
input[type='submit'] {
    display: inline-block;
    border: none;
    background: #111827;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.nav a:hover,
button:hover,
input[type='submit']:hover {
    opacity: 0.86;
}

table {
    width: calc(100% - 24px);
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

th,
td {
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    padding: 12px;
    vertical-align: top;
    font-size: 14px;
}

th:last-child,
td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

th {
    background: #f1f5f9;
    color: #111827;
    font-weight: 700;
    white-space: nowrap;
}

td {
    background: #fff;
}

tr:hover td {
    background: #fafafa;
}

.action {
    width: 150px;
}

.action a {
    display: block;
    padding: 8px 10px;
    background: #0066cc;
    color: #fff;
    text-decoration: none;
    border-radius: 7px;
    white-space: nowrap;
    margin-bottom: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.action a:last-child {
    margin-bottom: 0;
}

.action a:hover {
    opacity: 0.88;
}

form {
    background: #fff;
    padding: 24px;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    font-weight: 700;
    color: #333;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.box,
.draft,
.note {
    background: #fff;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.box,
.draft {
    white-space: pre-wrap;
}

.meta {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}

body > a {
    display: inline-block;
    margin-top: 16px;
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
}

body > a:hover {
    text-decoration: underline;
}

/* 機能メニュー専用 */
.menu-card {
    max-width: 1180px;
    margin: 0 auto 20px;
    background: #fff;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    white-space: normal !important;
}

.menu-card,
.menu-card * {
    white-space: normal !important;
}

.menu-card h2 {
    margin: 0 0 14px;
    padding: 0;
    font-size: 20px;
    line-height: 1.4;
    color: #333;
}

.menu-section {
    margin: 0 0 14px;
    padding: 0;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section h3 {
    margin: 0 0 6px;
    padding: 0;
    font-size: 15px;
    line-height: 1.4;
    color: #111827;
}

.menu-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.menu-links a {
    display: inline-block;
    margin: 0;
    background: #111827;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
}

.menu-links a:hover {
    opacity: 0.86;
}

/* 旧 menu-box が残っている場合の保険 */
.box.menu-box {
    white-space: normal !important;
}

.box.menu-box,
.box.menu-box * {
    white-space: normal !important;
}

.box.menu-box h2 {
    margin: 0 0 14px;
    padding: 0;
}

.box.menu-box .menu-section {
    margin: 0 0 14px;
    padding: 0;
}

.box.menu-box .menu-section h3 {
    margin: 0 0 6px;
    padding: 0;
    font-size: 15px;
    line-height: 1.4;
}

.box.menu-box .nav {
    margin: 0;
    gap: 8px;
}

.box.menu-box .nav a {
    margin: 0;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
}

/* ローディング表示 */
.loading-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.88);
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loading-box {
    background: #ffffff;
    border: 1px solid #dddddd;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    max-width: 320px;
}

.loading-box p {
    margin: 0;
    font-size: 15px;
    line-height: 1.8;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 4px solid #dddddd;
    border-top: 4px solid #333333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.box,
.draft {
    white-space: pre-wrap;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 0 12px;
    }

    h1 {
        font-size: 24px;
    }

    table {
        display: block;
        overflow-x: auto;
        width: 100%;
    }

    th,
    td {
        font-size: 13px;
        padding: 10px;
    }

    form {
        padding: 18px;
    }

    .menu-links a {
        width: 100%;
        text-align: center;
    }

    .box.menu-box .nav a {
        width: 100%;
        text-align: center;
    }
}