/* --- カラー変数定義 --- */
:root {
    --primary-color: #6fb98f; /* メインの薄緑 */
    --primary-dark: #5a9a75;
    --bg-light: #f4f7f6;
    --sidebar-bg: #2f3e35;
    --text-main: #333;
    --text-white: #fff;
    --border-color: #e0e6e3;
    --error-color: #e74c3c;
}

/* --- 全体基本設定 --- */
* {
    box-sizing: border-box;
}
body {
    font-family: 'Helvetica Neue', Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    margin: 0;
}

.wrapper {
    display: flex; min-height: 100vh;
}

/* --- サイドバー --- */
#sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--text-white);
    transition: all 0.3s;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0,0,0,0.1);
    text-align: center;
}

.menu-group p {
    padding: 20px 20px 5px;
    font-size: 0.75rem;
    color: #88a090;
    letter-spacing: 1px;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar ul li a {
    padding: 12px 20px;
    display: block;
    color: #cbd5d0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

#sidebar ul li a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

#sidebar ul li a:hover {
    background: var(--primary-color);
    color: white;
}

.sub-menu {
    background: rgba(0,0,0,0.2);
}
.sub-menu li a {
    padding-left: 50px !important;
    font-size: 0.8rem !important;
}

/* --- メインコンテンツ領域 --- */
#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-nav {
    height: 60px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
}

.container {
    padding: 30px;
}

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

/* --- カード & コンポーネント --- */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fafcfb;
}

.card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-dark);
}
.card-body {
    padding: 20px;
}

/* --- テーブル --- */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
th,
td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
th {
    background: #f9fbf9;
    font-weight: 600;
    color: #666;
}

/* --- フォーム・入力ツール --- */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(111, 185, 143, 0.2);
}

/* チェックボックス・ラジオボタン装飾 */
input[type="checkbox"] {
    width: 1.2em;  /* 文字より少し大きいくらいが操作しやすい */
    height: 1.2em;
    vertical-align: middle; /* 文字の高さ中央に合わせる */
    cursor: pointer;        /* 重なった時に指マークにする */
}

.input-tool-group {
    padding-top: 5px;
}
.check-container,
.radio-container {
    display: inline-block;
    position: relative;
    padding-left: 28px;
    margin-right: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.check-container input,
.radio-container input {
    position: absolute;
    opacity: 0;
}

.checkmark,
.radiomark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #eee;
    border-radius: 3px;
}

.radio-container .radiomark {
    border-radius: 50%;
}

.check-container input:checked ~ .checkmark,
.radio-container input:checked ~ .radiomark {
    background-color: var(--primary-color);
}

.checkmark:after, .radiomark:after {
    content: ""; position: absolute; display: none;
}

.check-container input:checked ~ .checkmark:after {
    display: block;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.radio-container input:checked ~ .radiomark:after {
    display: block;
    left: 6px;
    top: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

/* --- ボタン & リンク --- */
.btn {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: 0.2s;
    font-size: 0.9rem;
}
a.btn-outline {
    color: var(--text-main);
    text-decoration: none;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
a.btn-primary {
    color: white;
    text-decoration: none;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
}
a.btn-outline {
    color: var(--text-main);
    text-decoration: none;
}
.btn-outline:hover {
    background: #f0f0f0;
}

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

.link-edit {
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 0.85rem;
    margin-right: 15px;
}

.link-edit:hover {
    opacity: 0.7;
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
}
.btn-delete {
    color: var(--error-color);
}

/* --- バッジ & ステータス --- */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}
.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}
.badge-warning {
    background: #fff3e0;
    color: #ef6c00;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}
.card-stat {
    padding: 25px;
    text-align: center;
}
.card-stat span {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 5px;
}
.card-stat strong {
    font-size: 1.6rem;
    color: var(--primary-dark);
}

/* --- スマホ対応 --- */
@media (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }
    #sidebar {
        width: 100%;
    }
    .form-group {
        flex: 100%;
    }
}

p.msg {
    margin: 1em 1em;
}

.edit-error input, 
.edit-error textarea, 
.edit-error select, 
.edit-error label {
    background: #ffcccc;
}
.err-msg {
    color: #ff0000;
    margin: 0.7em 1em;
    font-size: 1em;
}