* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}

/* === Login === */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 40px;
    width: 400px;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    color: #1a73e8;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.form-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.field-error { border-color: #d32f2f !important; box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.15) !important; }
.entry-error { border-color: #d32f2f !important; }

.login-error {
    color: #d32f2f;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 12px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.login-btn:hover { background: #1557b0; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Header === */
.app-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-header .app-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a73e8;
}

.app-header .user-info {
    font-size: 13px;
    color: #666;
}

.logout-btn {
    padding: 6px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
}

.logout-btn:hover { background: #f5f5f5; }

/* === Main Layout === */
.container {
    display: flex;
    gap: 24px;
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 20px;
    align-items: flex-start;
}

/* === Left Panel === */
.left-panel {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.card-title {
    font-size: 13px;
    color: #1a73e8;
    font-weight: 600;
    margin-bottom: 12px;
}

.name-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calendar-header button {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-header button:hover { background: #f5f5f5; }

.calendar-header .month-label {
    font-weight: 600;
    font-size: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}

.calendar-grid .day-header {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 6px 0;
}

.calendar-grid .day-header:first-child { color: #d32f2f; }
.calendar-grid .day-header:last-child { color: #1565c0; }

.calendar-grid .day-cell {
    padding: 8px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.calendar-grid .day-cell:hover { background: #e3f2fd; }
.calendar-grid .day-cell.empty { cursor: default; }
.calendar-grid .day-cell.empty:hover { background: transparent; }
.calendar-grid .day-cell.sunday { color: #d32f2f; }
.calendar-grid .day-cell.saturday { color: #1565c0; }
.calendar-grid .day-cell.selected { background: #c8e6c9; font-weight: 700; }
.calendar-grid .day-cell.submitted { background: #bbdefb; font-weight: 600; }
.calendar-grid .day-cell.draft { background: #fff9c4; font-weight: 600; }
.calendar-grid .day-cell.today { border: 2px solid #1a73e8; }

.calendar-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 12px;
    font-size: 12px;
    color: #666;
}

.calendar-legend span::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

.legend-submitted::before { background: #bbdefb; }
.legend-draft::before { background: #fff9c4; }
.legend-selected::before { background: #c8e6c9; border: 1px solid #a5d6a7; }
.legend-empty::before { background: #fff; border: 1px solid #ddd; }

/* Work time setting */
.time-row {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.time-field { flex: 1; }

.time-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.time-field input[type="time"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.date-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* === Right Panel === */
.right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-row {
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.entry-row .field-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.entry-row .field-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.entry-row select,
.entry-row input[type="time"],
.entry-row input[type="number"],
.entry-row input[type="text"] {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}

.entry-row .cat-select { width: 200px; }
.entry-row .time-input { width: 100px; }
.entry-row .min-input { width: 60px; background: #f0f0f0; text-align: center; }
.entry-row .burden-select, .entry-row .spec-select { width: 70px; }
.entry-row .detail-input { width: 200px; flex: 1; min-width: 120px; }

.entry-row .delete-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.entry-row .delete-btn:hover { color: #d32f2f; }

.add-btn {
    width: 100%;
    padding: 12px;
    background: #43a047;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.add-btn:hover { background: #388e3c; }

.warning {
    text-align: center;
    color: #e65100;
    background: #fff3e0;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    display: none;
}

.warning.show { display: block; }

.bottom-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.total-label {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    min-width: 120px;
}

.save-btn, .submit-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.save-btn {
    background: #fff;
    border: 2px solid #ddd;
    color: #333;
}

.save-btn:hover { background: #f5f5f5; border-color: #bbb; }

.submit-btn {
    background: #66bb6a;
    color: #fff;
}

.submit-btn:hover { background: #43a047; }

.save-btn:disabled, .submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Header nav === */
.header-nav {
    display: flex;
    gap: 4px;
}

.header-nav a {
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.header-nav a:hover { background: #f0f0f0; }
.header-nav a.active { background: #e8f0fe; color: #1a73e8; font-weight: 600; }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    text-decoration: none;
}

.header-btn:hover { background: #f5f5f5; }

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
}

.modal-close:hover { color: #333; }

.modal-error {
    color: #d32f2f;
    font-size: 13px;
    min-height: 20px;
    margin-bottom: 8px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn-primary {
    flex: 1;
    padding: 10px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-actions .btn-primary:hover { background: #1557b0; }

.modal-actions .btn-cancel {
    flex: 1;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #555;
}

.modal-actions .btn-cancel:hover { background: #f5f5f5; }

.modal-actions .btn-danger {
    flex: 1;
    padding: 10px;
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.modal-actions .btn-danger:hover { background: #b71c1c; }

/* === Admin page === */
.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}

.admin-tabs .tab {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
}

.admin-tabs .tab:hover { color: #333; }
.admin-tabs .tab.active { color: #1a73e8; border-bottom-color: #1a73e8; font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.toolbar .btn-add {
    padding: 8px 20px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.toolbar .btn-add:hover { background: #1557b0; }

.toolbar .school-filter {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    min-width: 200px;
}

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover { background: #f8f9fa; }

.data-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.data-table .actions button {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    color: #555;
}

.data-table .actions button:hover { background: #f0f0f0; }
.data-table .actions .btn-del { color: #d32f2f; border-color: #ffcdd2; }
.data-table .actions .btn-del:hover { background: #ffebee; }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge.admin { background: #e8eaf6; color: #283593; }
.role-badge.school_admin { background: #e0f2f1; color: #00695c; }
.role-badge.user { background: #f5f5f5; color: #666; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}
