:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: var(--dark);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: var(--white);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: block;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    font-weight: 600;
    color: var(--secondary);
}

tr:hover {
    background-color: #fcfcfc;
}

/* Form Tables */
.table-responsive table input[type="number"],
.table-responsive table input[type="text"] {
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100%;
}

.table-responsive table th {
    background: #f8f9fa;
    border-bottom: 2px solid #eee;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--accent);
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #2980b9; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219150; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #e67e22; }

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

.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }

.btn-info { background: #34495e; color: white; }
.btn-info:hover { background: #2c3e50; }

/* Status Badges */
.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-unpaid { background: #ffeaa7; color: #d35400; border: 1px solid #fab1a0; }
.badge-paid { background: #55efc4; color: #00b894; border: 1px solid #00b894; }
.badge-success { background: #dff9fb; color: #27ae60; border: 1px solid #27ae60; }
.badge-info { background: #e1f5fe; color: #0288d1; border: 1px solid #0288d1; }
.badge-secondary { background: #f5f5f5; color: #7f8c8d; border: 1px solid #7f8c8d; }
.badge-warning { background: #fff3e0; color: #f39c12; border: 1px solid #f39c12; }
.badge-danger { background: #ffebee; color: #e74c3c; border: 1px solid #e74c3c; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .sidebar h1 {
        margin-bottom: 1rem;
        font-size: 1.2rem;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .nav-links li {
        margin-bottom: 0;
    }

    .nav-links a {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .sidebar .user-info {
        display: none; /* スマホではユーザ情報を一旦隠す（または別の場所に配置） */
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Table Responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border-radius: 8px;
        border: 1px solid #eee;
    }

    table {
        min-width: 600px; /* テーブルが潰れないように最小幅を確保 */
    }
}

/* User Addition Grid */
.user-add-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr 1fr auto; 
    gap: 1rem; 
    align-items: end;
}

@media (max-width: 768px) {
    .user-add-grid {
        grid-template-columns: 1fr;
    }
}

/* Common Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}


