* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
    background: #f4f6f8;
    color: #222;
}
a { color: #1a5fb4; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background: #1a5fb4;
    color: #fff;
    padding: 10px 16px;
}
.topbar-title { font-weight: bold; display: flex; align-items: center; gap: 8px; }
.topbar-logo { max-height: 32px; object-fit: contain; }
.topbar-company { font-weight: normal; opacity: 0.85; font-size: 13px; }
.topbar-nav a { color: #fff; margin-left: 16px; }
.topbar-user { margin-left: 16px; opacity: 0.9; }

.demo-banner {
    background: #f39c12;
    color: #222;
    text-align: center;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
}
.demo-banner a { color: #1a3a6b; text-decoration: underline; margin-left: 6px; }

.content { padding: 16px; max-width: 1100px; margin: 0 auto; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card h2 {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.3;
}

.settings-section-title {
    font-size: 13px;
    font-weight: bold;
    color: #1a5fb4;
    letter-spacing: 0.05em;
    margin: 24px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #1a5fb4;
}
.settings-section-title:first-of-type { margin-top: 0; }

.btn {
    display: inline-block;
    background: #1a5fb4;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #144a8f; }
.btn.secondary { background: #888; }
.btn.danger { background: #c0392b; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; font-size: 14px; color: #555; }
.form-row input, .form-row select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}
.form-inline .form-row { margin-bottom: 0; flex: 1; min-width: 140px; }
.form-inline .form-row-color { flex: 0 0 auto; min-width: 60px; }
.form-inline .form-row-color input { padding: 2px; height: 38px; }
.form-inline .btn { height: 38px; }

input[type="color"] {
    padding: 2px !important;
    height: 32px;
    width: 48px !important;
    cursor: pointer;
}

.error { color: #c0392b; margin-bottom: 12px; }
.notice { color: #1a5fb4; margin-bottom: 12px; }

/* 予約グリッド */
.day-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.day-nav .day-label { font-weight: bold; font-size: 16px; }
.day-nav input[type="date"] { padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px; margin-left: auto; }

.view-tabs { display: flex; gap: 4px; }
.tab-btn {
    padding: 6px 16px;
    border-radius: 4px;
    background: #eef2f6;
    color: #555;
    font-size: 14px;
}
.tab-btn:hover { text-decoration: none; background: #e0e6ed; }
.tab-btn.active { background: #1a5fb4; color: #fff; }

/* 月カレンダー */
.month-calendar { border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.month-grid-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-grid-header { background: #eef2f6; font-size: 13px; text-align: center; padding: 6px 0; }
.month-grid-header > div { border-right: 1px solid #ddd; }
.month-grid-header > div:last-child { border-right: none; }
.month-cell {
    display: block;
    min-height: 84px;
    padding: 4px;
    border-top: 1px solid #eee;
    border-right: 1px solid #eee;
    color: #222;
    font-size: 12px;
    overflow: hidden;
}
.month-cell:hover { background: #f5f8fb; text-decoration: none; }
.month-grid-row .month-cell:last-child { border-right: none; }
.month-cell.muted { color: #bbb; background: #fafafa; }
.month-cell.today { background: #fff8e1; }
.month-cell-date { font-weight: bold; margin-bottom: 4px; }
.month-cell-entry {
    padding: 1px 0 1px 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    font-size: 12px;
    background: #fff;
    user-select: none;
}
table.grid th, table.grid td {
    border: 1px solid #ddd;
    text-align: center;
    height: 22px;
}
table.grid th { background: #eef2f6; font-weight: normal; }
table.grid th:first-child,
table.grid td.resource-name {
    width: 120px;
    text-align: left;
    padding-left: 6px;
    background: #f8f9fa;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
table.grid td.slot { cursor: pointer; }
table.grid td.slot.selected { background: #ffe66d !important; }
table.grid td.slot.booked {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    cursor: not-allowed;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
table.grid td.slot.booked.mine {
    cursor: pointer;
    box-shadow: inset 0 0 0 2px #222;
}
table.grid td.slot.readonly { cursor: default; background: #fafafa; }
table.grid td.slot.editable { cursor: pointer; }

.chip-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip-label { font-size: 13px; color: #666; margin-right: 4px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f2f5;
    border-radius: 14px;
    padding: 4px 10px 4px 6px;
    font-size: 13px;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chip.kitaku { background: #fbe4e2; }
.chip-label.kitaku { color: #c0392b; }

.legend { display: flex; gap: 16px; margin: 8px 0 16px; font-size: 13px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 14px; height: 14px; display: inline-block; border: 1px solid #ccc; }
.legend i.employee-color { border-radius: 50%; border: 1px solid rgba(0,0,0,0.2); }

/* いまドコ */
.presence-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.presence-card { background: #fff; border-radius: 8px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.presence-card .name { font-weight: bold; margin-bottom: 6px; }
.presence-card.kitaku { background: #fdf1f0; }

.card-header-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.card-header-row h2 { margin: 0; }

.attendance-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.attendance-name { font-weight: bold; }
.attendance-label { font-size: 13px; color: #2ecc71; min-width: 2.5em; }
.attendance-label.kitaku { color: #c0392b; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #c0392b;
    border-radius: 24px;
    transition: background 0.15s;
}
.switch-track::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: #2ecc71; }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { border-bottom: 1px solid #eee; padding: 8px; text-align: left; font-size: 14px; }

.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.login-box h1 { font-size: 18px; text-align: center; margin-bottom: 20px; }

/* モーダル */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.modal-box h3 { margin: 0 0 8px; font-size: 16px; }
.modal-time-range { font-size: 14px; color: #555; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions #modal-delete { margin-right: auto; }
