* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --secondary: #64748b;
  --success: #10b981; --danger: #ef4444; --warning: #f59e0b;
  --bg: #f1f5f9; --card: #ffffff; --text: #1e293b; --text-light: #64748b; --border: #e2e8f0;
}
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); color: white; padding: 20px 0; position: fixed; height: 100vh; overflow-y: auto; }
.sidebar-header { padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 20px; }
.sidebar-header h1 { font-size: 1.25rem; font-weight: 700; }
.sidebar-header p { font-size: 0.875rem; opacity: 0.8; margin-top: 5px; }
.nav-menu { list-style: none; }
.nav-item { padding: 12px 20px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: all 0.2s; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.1); }
.nav-item.active { background: rgba(255,255,255,0.15); border-left-color: white; }
.nav-item i { width: 20px; text-align: center; }
.main-content { flex: 1; margin-left: 260px; padding: 20px 25px; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 15px; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--text-light); margin-top: 5px; }
.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 20px; margin-bottom: 15px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 1.1rem; font-weight: 600; }
.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.875rem; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); }
th, td { padding: 10px 12px; text-align: center; border: 1px solid var(--border); vertical-align: middle; }
th { background: var(--bg); font-weight: 600; font-size: 0.85rem; color: var(--text-light); }
tr:hover { background: #f8fafc; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.875rem; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 16px; width: 90%; max-width: 700px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.filter-bar { display: flex; gap: 15px; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar .form-group { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: 12px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 15px; }
.stat-card .icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stat-card .icon.blue { background: #dbeafe; color: #2563eb; }
.stat-card .icon.green { background: #d1fae5; color: #10b981; }
.stat-card .icon.yellow { background: #fef3c7; color: #f59e0b; }
.stat-card .icon.purple { background: #ede9fe; color: #8b5cf6; }
.stat-card .stat-info { display: flex; flex-direction: column; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-card .label { color: var(--text-light); font-size: 0.8rem; }
.loading { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.8); justify-content: center; align-items: center; z-index: 9999; }
.loading.active { display: flex; }
.spinner { width: 50px; height: 50px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.toast { background: var(--text); color: white; padding: 14px 20px; border-radius: 8px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.sub-tabs { display: flex; gap: 5px; margin-bottom: 20px; background: var(--card); padding: 8px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); flex-wrap: wrap; }
.sub-tab { padding: 10px 20px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--text-light); display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.sub-tab:hover { background: var(--bg); color: var(--text); }
.sub-tab.active { background: var(--primary); color: white; }
.settings-tab-content { display: none; }
.settings-tab-content.active { display: block; }
.settings-tab-content .card { max-width: 600px; }
.settings-list { list-style: none; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.settings-item:last-child { border-bottom: none; }
.settings-item .info h4 { font-weight: 500; margin-bottom: 4px; }
.settings-item .info p { font-size: 0.85rem; color: var(--text-light); }
.settings-item .value { display: flex; align-items: center; gap: 10px; }
.settings-item input { width: 100px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; text-align: right; }
.master-list { display: flex; flex-direction: column; gap: 10px; }
.master-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; background: var(--bg); border-radius: 8px; }
.master-item .info { flex: 1; }
.master-item .name { font-weight: 600; margin-bottom: 2px; }
.master-item .desc { font-size: 0.8rem; color: var(--text-light); }
.master-item .actions { display: flex; gap: 5px; }
.master-item .status { margin-right: 10px; }
.status-badge { padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; }
.status-badge.active { background: #d1fae5; color: #059669; }
.status-badge.inactive { background: #fee2e2; color: #dc2626; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: 0.3s; }
.toggle-slider:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
.day-toggle { display: inline-block; padding: 8px 16px; border: 2px solid var(--border); border-radius: 20px; cursor: pointer; font-weight: 500; transition: all 0.2s; user-select: none; }
.day-toggle:hover { border-color: var(--primary); }
.day-toggle.active { background: var(--primary); border-color: var(--primary); color: white; }
.statement-preview { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-top: 20px; }
.att-calendar { margin-top: 15px; }
.att-calendar table { width: 100%; border-collapse: collapse; }
.att-calendar th, .att-calendar td { border: 1px solid var(--border); padding: 8px; text-align: center; vertical-align: top; min-width: 80px; }
.att-calendar th { background: var(--bg); font-weight: 600; }
.att-calendar td { height: 70px; cursor: pointer; transition: background 0.2s; }
.att-calendar td:hover { background: #f0f4f8; }
.att-calendar td.non-work { background: #f8f8f8; cursor: default; }
.att-calendar td.non-work:hover { background: #f8f8f8; }
.att-calendar .day-num { font-size: 0.85rem; color: var(--text-light); margin-bottom: 4px; }
.att-calendar .day-status { font-size: 0.75rem; padding: 3px 6px; border-radius: 4px; display: inline-block; }
.att-calendar .status-출근 { background: #d1fae5; color: #059669; }
.att-calendar .status-결근 { background: #fee2e2; color: #dc2626; }
.att-calendar .status-대근 { background: #fef3c7; color: #b45309; }
.att-calendar .status-방학 { background: #e0e7ff; color: #4338ca; }
.att-calendar .status-재량휴일 { background: #f3e8ff; color: #7c3aed; }
.att-calendar .status-해당없음 { background: #f1f5f9; color: #64748b; }
.att-calendar .sunday { color: #dc2626; }
.att-calendar .saturday { color: #2563eb; }
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; transition: left 0.3s; z-index: 100; }
  .sidebar.open { left: 0; }
  .main-content { margin-left: 0; }
  .mobile-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: var(--primary); color: white; margin: -20px -25px 15px; }
  .menu-toggle { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card .icon { width: 36px; height: 36px; font-size: 0.9rem; }
  .stat-card .value { font-size: 1.2rem; }
  .stat-card .label { font-size: 0.7rem; }
}
@media (min-width: 769px) { .mobile-header { display: none; } }
