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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    padding: 30px;
    max-width: 900px;
    margin: 0 auto 20px;
}

h1 { font-size: 22px; color: #1a1a1a; margin-bottom: 6px; }
h2 { font-size: 16px; color: #1a1a1a; margin: 20px 0 10px; }
.subtitle { color: #666; font-size: 14px; margin-bottom: 24px; }

label { display: block; font-weight: 600; font-size: 14px; color: #333; margin-bottom: 6px; }
input, select { width: 100%; padding: 12px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; margin-bottom: 16px; background: #fafafa; }
input:focus, select:focus { outline: none; border-color: #2c5f8a; background: white; }

.logout-link { float: right; font-size: 13px; color: #999; text-decoration: none; cursor: pointer; }
.logout-link:hover { color: #c0392b; }
.info { font-size: 12px; color: #999; margin-top: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid #e0e0e0; }
.tab { padding: 10px 18px; background: none; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: #666; border-bottom: 2px solid transparent; }
.tab.active { color: #2c5f8a; border-bottom-color: #2c5f8a; }

/* Buttons */
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
button { padding: 12px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: #2c5f8a; color: white; }
.btn-primary:hover { background: #234b6e; }
.btn-secondary { background: #e8e8e8; color: #333; }
.btn-secondary:hover { background: #ddd; }
.btn-success { background: #4caf50; color: white; }
.btn-success:hover { background: #3d9440; }
.btn-auto { background: #8e44ad; color: white; }
.btn-auto:hover { background: #733a8e; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Paint mode buttons */
.mode-btn { padding: 10px 16px; border: 2px solid #ddd; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; background: #fafafa; color: #555; transition: all 0.15s; }
.mode-btn:hover { border-color: #aaa; }
.mode-btn.mode-co.active { background: #fdecea; border-color: #e74c3c; color: #c0392b; }
.mode-btn.mode-so.active { background: #fef6e7; border-color: #f39c12; color: #e67e22; }
.action-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.yesterday-info { background: #eef3f8; border: 1px solid #d0dbe6; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #2c5f8a; margin-bottom: 10px; }

/* Workers */
.worker-card { border: 2px solid #ddd; border-radius: 8px; padding: 10px 12px; background: #fafafa; cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 14px; transition: all 0.15s; }
.worker-card:hover { border-color: #aaa; }
.worker-card.selected { background: #27ae60; color: white; border-color: #27ae60; }
.worker-card.selected:hover { background: #c0392b; border-color: #c0392b; }
.worker-card .count { background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.worker-card.selected .count { background: rgba(255,255,255,0.25); }
.floor-hint { font-size: 10px; font-weight: 500; opacity: 0.8; }

.workers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }

/* Rooms */
.floor-section { margin-bottom: 14px; }
.floor-label { font-weight: 700; font-size: 13px; padding: 5px 10px; background: #eef3f8; border-radius: 6px; color: #2c5f8a; margin-bottom: 6px; }

.room-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 2px solid #f39c12; border-radius: 8px; background: #fef6e7; cursor: pointer; user-select: none; transition: all 0.15s; }
.room-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.room-row.status-co { border-color: #e74c3c; background: #fdecea; }
.room-row.status-empty { border-color: #ddd; background: #f5f5f5; opacity: 0.5; }
.room-row .room-name { font-weight: 700; font-size: 16px; min-width: 30px; }
.room-row .status-label { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; min-width: 70px; text-align: center; }
.status-label.lbl-so { background: #f39c12; color: white; }
.status-label.lbl-co { background: #e74c3c; color: white; }
.status-label.lbl-empty { background: #ddd; color: #888; }

.room-row select.name-select { padding: 4px 6px; font-size: 11px; font-weight: 600; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); background: transparent; color: #555; margin: 0; width: auto; max-width: 80px; cursor: pointer; }
.room-row select.name-select:focus { outline: none; border-color: #2c5f8a; }
.room-row select.name2-select { max-width: 70px; font-size: 10px; padding: 3px 4px; color: #888; }

.note-badge { font-size: 9px; background: #2c5f8a; color: white; padding: 1px 5px; border-radius: 3px; margin-left: 4px; cursor: help; }

/* Modal */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; justify-content: center; align-items: center; }
.modal-bg.open { display: flex; }
.modal { background: white; border-radius: 12px; padding: 24px; width: 90%; max-width: 400px; box-shadow: 0 8px 30px rgba(0,0,0,0.2); }
.modal { position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 22px; color: #999; cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: #333; }
.modal h3 { font-size: 16px; margin-bottom: 12px; padding-right: 28px; }
.modal select, .modal textarea { width: 100%; margin-bottom: 12px; }
.modal textarea { padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical; min-height: 80px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: #eef3f8; border-radius: 8px; padding: 14px; text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: #2c5f8a; }
.stat-card .lbl { font-size: 12px; color: #666; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #e0e0e0; font-size: 13px; }
th { background: #f5f5f5; font-weight: 600; }

/* Toast */
#toastContainer { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: 90%; max-width: 420px; }
.toast { padding: 12px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; color: white; box-shadow: 0 4px 16px rgba(0,0,0,0.15); pointer-events: auto; animation: toastIn 0.25s ease-out, toastOut 0.3s ease-in 3.7s forwards; }
.toast-error { background: #e74c3c; }
.toast-warn { background: #f39c12; }
.toast-info { background: #2c5f8a; }
.toast-success { background: #27ae60; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* Mobile */
@media (max-width: 600px) {
    .container { padding: 16px; }
    .floor-cols { grid-template-columns: 1fr !important; }
    .workers-grid { grid-template-columns: repeat(3, 1fr); }
    .room-row .room-name { font-size: 14px; min-width: 24px; }
    .room-row .status-label { font-size: 10px; padding: 2px 6px; min-width: 58px; }
    .room-row select.name-select { font-size: 11px; padding: 3px 4px; max-width: 70px; }
    .buttons { flex-wrap: wrap; }
    .buttons button { flex: none; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
