:root {
    --primary-color: #92bc74;
    --primary-hover: #7fa663;
    --sub-header: #EADDFF;
    --bg-light: #fcfcfc;
    --text-dark: #333;
    --danger: #e06a6a;
    --white: #fff;
    --border: #d9d9d9;
    --muted: #666;
    --success: #3d8b57;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
}

button, input, select, textarea {
    font: inherit;
}

.container {
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.global-menu {
    background-color: var(--white);
    border-bottom: 2px solid var(--primary-color);
    padding: 10px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.menu-container {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
}

.menu-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.menu-links a {
    text-decoration: none;
    color: #555;
    padding: 7px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.menu-links a.active,
.menu-links a:hover {
    background: var(--primary-color);
    color: var(--white);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 0 10px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 0 18px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    background: var(--white);
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    min-height: 42px;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.btn {
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-secondary {
    background: #eef1ee;
    color: var(--text-dark);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.tab {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-dark);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
}

.tab.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 12px 0 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 1.4rem;
    font-weight: 700;
}

.scroll-container {
    width: 100%;
    max-height: calc(100vh - 300px);
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
}

.fixed-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    table-layout: auto;
}

.fixed-table th,
.fixed-table td {
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 8px 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: middle;
}

.fixed-table thead th {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 20;
}

.fixed-table th.company-column,
.fixed-table td.company-column {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
}

.fixed-table td.deleted-flag {
    color: var(--danger);
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
}

.fixed-table tbody tr:nth-child(even) td {
    background: #fafcf9;
}

.fixed-table tbody tr.member-row-new td {
    background: #fff9e8 !important;
}

.fixed-table tbody tr.member-row-renewal td {
    background: #eef7ff !important;
}

.fixed-table tbody td.sticky-col-1,
.fixed-table tbody td.sticky-col-2,
.fixed-table tbody td.sticky-col-3,
.fixed-table tbody td.sticky-col-4 {
    background: var(--white);
}

.fixed-table tbody tr.member-row-new td.sticky-col-1,
.fixed-table tbody tr.member-row-new td.sticky-col-2,
.fixed-table tbody tr.member-row-new td.sticky-col-3,
.fixed-table tbody tr.member-row-new td.sticky-col-4,
.fixed-table tbody tr.member-row-renewal td.sticky-col-1,
.fixed-table tbody tr.member-row-renewal td.sticky-col-2,
.fixed-table tbody tr.member-row-renewal td.sticky-col-3,
.fixed-table tbody tr.member-row-renewal td.sticky-col-4 {
    background: #fff !important;
}

.fixed-table .sticky-col-1,
.fixed-table .sticky-col-2,
.fixed-table .sticky-col-3,
.fixed-table .sticky-col-4 {
    position: sticky;
    z-index: 10;
    background: var(--white);
}

.fixed-table .sticky-col-1 {
    left: 0;
    width: 60px;
    min-width: 60px;
}

.fixed-table .sticky-col-2 {
    left: 60px;
    width: 180px;
    min-width: 180px;
}

.fixed-table .sticky-col-3 {
    left: 240px;
    width: 140px;
    min-width: 140px;
}

.fixed-table .sticky-col-4 {
    left: 380px;
    width: 140px;
    min-width: 140px;
}

.fixed-table tbody td.sticky-col-1,
.fixed-table tbody td.sticky-col-2,
.fixed-table tbody td.sticky-col-3,
.fixed-table tbody td.sticky-col-4 {
    background: #fff !important;
    opacity: 1;
    z-index: 40;
}

.fixed-table thead th.sticky-col-1,
.fixed-table thead th.sticky-col-2,
.fixed-table thead th.sticky-col-3,
.fixed-table thead th.sticky-col-4 {
    background: var(--primary-color);
    z-index: 50;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-paid {
    background: #eaf6ee;
    color: var(--success);
}

.status-unpaid {
    background: #fbeaea;
    color: var(--danger);
}

.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: rgba(0,0,0,0.45);
}

.modal-content {
    background: var(--white);
    margin: 4% auto;
    padding: 24px;
    border-radius: 10px;
    width: min(90%, 960px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-dark);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.82rem;
    font-weight: 700;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.notice {
    padding: 12px 14px;
    border-radius: 6px;
    margin: 10px 0 18px;
    border: 1px solid transparent;
}

.notice.error {
    background: #fff0f0;
    border-color: #f4caca;
    color: #9a2d2d;
}

.notice.success {
    background: #ebf8ee;
    border-color: #bde2c5;
    color: #26613d;
}

.login-box {
    max-width: 420px;
    margin: 120px auto 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.manual-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.manual-section {
    margin-bottom: 28px;
}

.manual-section:last-child {
    margin-bottom: 0;
}

.manual-section h2 {
    font-size: 1.2rem;
    margin: 0 0 12px;
    color: var(--text-dark);
}

.manual-list {
    margin: 0 0 0 20px;
    padding: 0;
    line-height: 1.8;
}

.manual-list.simple {
    list-style: disc;
}

.manual-note {
    margin: 12px 0 0;
    background: #f7f8f7;
    border-left: 4px solid var(--primary-color);
    padding: 12px 14px;
    border-radius: 6px;
    color: var(--muted);
}

@media (max-width: 768px) {
    .menu-container,
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-box {
        margin-top: 80px;
    }
}
