* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", Tahoma, Arial, sans-serif;
  background: #f0f4f9;
  color: #1f2937;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
}

.branding {
  background: #4488dd url("/static/illustration.jpg") center/cover no-repeat;
}

.panel {
  background: #fff;
  padding: 40px 52px;
  overflow: auto;
}

.logo {
  max-width: 240px;
  margin-bottom: 24px;
}

h1, h2 {
  margin: 0 0 16px;
  font-weight: 500;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 20px;
  margin-top: 28px;
}

.hint {
  margin-bottom: 16px;
  color: #4b5563;
}

.panel-full {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 32px;
  background: #fff;
  min-height: 100vh;
}

.navbar {
  background: #1f2937;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  border-radius: 0 0 8px 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.navbar-brand {
  color: #fff;
  padding: 14px 18px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-right: 4px;
}

.navbar-link {
  color: #d1d5db;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  transition: all .15s;
}

.navbar-link:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
  text-decoration: none;
}

.navbar-link.active {
  color: #fff;
  border-bottom-color: #3b82f6;
}

.navbar-spacer {
  flex: 1;
}

.navbar-user {
  color: #9ca3af;
  font-size: 13px;
  padding: 14px 8px;
}

.navbar-logout {
  color: #f87171;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 14px;
  transition: all .15s;
}

.navbar-logout:hover {
  color: #fff;
  background: rgba(239,68,68,.15);
  text-decoration: none;
}

label {
  display: block;
  margin-bottom: 12px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color .2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2672ec;
  box-shadow: 0 0 0 3px rgba(38,114,236,.15);
}

textarea {
  resize: vertical;
}

button, .btn {
  border: 0;
  background: #2672ec;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background .2s;
}

button:hover, .btn:hover {
  background: #1a5cdb;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

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

.card-header h2 {
  margin: 0;
}

.table-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f3f4f6;
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #4b5563;
}

td {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
}

tr:hover td {
  background: #f9fafb;
}

.badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.error {
  color: #b91c1c;
  background: #fef2f2;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.ok {
  color: #15803d;
  background: #f0fdf4;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 160px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #1e3a5f;
  line-height: 1.2;
}

.stat-value small {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
}

.stat-label {
  font-size: 13px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 4px;
}

.filter-bar {
  background: #f9fafb;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.filter-bar form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-bar label {
  margin: 0;
  font-weight: 500;
}

.filter-bar input,
.filter-bar select {
  width: 200px;
}

.filter-row {
  margin-top: 0;
}

.filter-row form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-row label {
  margin-bottom: 0;
}

.filter-row input,
.filter-row select {
  width: 180px;
}

.form-card {
  background: #f9fafb;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.form-card form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-card label {
  margin: 0;
}

.form-card input {
  width: 180px;
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  background: #f9fafb;
  border-radius: 8px;
  text-decoration: none;
  color: #1f2937;
  transition: all .2s;
  border: 1px solid transparent;
}

.shortcut:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-2px);
  text-decoration: none;
}

.shortcut .icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.shortcut .name {
  font-size: 13px;
  font-weight: 500;
}

.add-form {
  display: none;
  margin-bottom: 16px;
}

.add-form-inner {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.add-form-inner label {
  margin: 0;
}

.add-form-inner input,
.add-form-inner select,
.add-form-inner textarea {
  width: 180px;
}

.add-form-vertical {
  flex-direction: column;
  align-items: stretch;
}

.add-form-vertical input,
.add-form-vertical textarea {
  width: 100%;
}

.add-form-buttons {
  display: flex;
  gap: 8px;
}

.btn-add {
  background: #2672ec;
  font-size: 13px;
  padding: 8px 16px;
}

.btn-add:hover {
  background: #1a5cdb;
}

.btn-edit {
  background: #f59e0b;
  padding: 6px 14px;
  font-size: 13px;
}

.btn-edit:hover {
  background: #d97706;
}

.edit-btn {
  background: #f59e0b;
  padding: 6px 14px;
  font-size: 13px;
}

.edit-btn:hover {
  background: #d97706;
}

.btn-delete, .delete-btn {
  background: #b91c1c;
  padding: 6px 14px;
  font-size: 13px;
}

.btn-delete:hover {
  background: #991b1b;
}

.btn-cancel {
  background: #6b7280;
}

.btn-cancel:hover {
  background: #4b5563;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-approve {
  background: #15803d;
}

.btn-approve:hover {
  background: #166534;
}

.btn-reject {
  background: #b91c1c;
}

.btn-reject:hover {
  background: #991b1b;
}

form.inline-form {
  display: inline;
}

form.inline-form button {
  padding: 6px 14px;
  font-size: 13px;
}

.actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.empty-row, .empty {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
}

.status-approved {
  color: #15803d;
  font-weight: 500;
}

.status-rejected {
  color: #b91c1c;
  font-weight: 500;
}

.status-pending {
  color: #b45309;
  font-weight: 500;
}

.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-present {
  background: #ecfdf5;
  color: #065f46;
}

.status-absent {
  background: #fef2f2;
  color: #991b1b;
}

.status-late {
  background: #fffbeb;
  color: #92400e;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}

.tab:hover {
  color: #1f2937;
  text-decoration: none;
}

.tab.active {
  color: #2672ec;
  border-bottom-color: #2672ec;
}

.tab-content {
  margin-top: 20px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.course-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  transition: box-shadow .2s;
}

.course-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.course-code {
  font-size: 12px;
  font-weight: 600;
  color: #2672ec;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.course-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.course-meta {
  font-size: 13px;
  color: #6b7280;
}

.course-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.course-actions form {
  display: inline;
}

.add-course-form {
  background: #f9fafb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.add-course-form h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.add-course-form .form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.add-course-form .form-row label {
  margin: 0;
  flex: 1;
  min-width: 150px;
}

.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cal-nav h2 {
  margin: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e5e7eb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.cal-header-item {
  background: #f3f4f6;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #4b5563;
}

.cal-header-item.sat, .cal-header-item.sun {
  background: #f9fafb;
  color: #9ca3af;
}

.calendar-day {
  background: #fff;
  min-height: 80px;
  padding: 6px;
  font-size: 13px;
}

.calendar-day.weekend {
  background: #f9fafb;
}

.calendar-day.holiday {
  background: #fef2f2;
}

.calendar-day.today {
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px #2672ec;
}

.calendar-day.empty {
  background: #f9fafb;
}

.day-num {
  font-weight: 600;
  font-size: 14px;
}

.holiday-label {
  display: block;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}

.cal-class {
  font-size: 11px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-wrapper {
  overflow-x: auto;
}

.tt-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
  font-size: 11px;
}

.tt-grid th {
  background: #f3f4f6;
  padding: 8px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tt-grid td {
  border: 1px solid #e5e7eb;
  padding: 4px;
  vertical-align: top;
  min-width: 140px;
  height: 60px;
}

.tt-time {
  font-weight: 600;
  color: #4b5563;
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
  padding-right: 8px;
}

.tt-entry {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 3px;
  padding: 2px 4px;
  margin-bottom: 2px;
  font-size: 10px;
  line-height: 1.3;
}

.tt-code {
  font-weight: 600;
  color: #1d4ed8;
}

.tt-type {
  color: #6b7280;
}

.tt-room {
  color: #4b5563;
}

.tt-lecturer {
  color: #6b7280;
  font-size: 9px;
}

.tt-weeks {
  color: #9ca3af;
  font-size: 9px;
}

.profile-form {
  max-width: 500px;
}

.profile-form label {
  display: block;
  margin-bottom: 16px;
  font-weight: 500;
}

.profile-form input,
.profile-form textarea {
  width: 100%;
  margin-top: 4px;
}

.profile-form textarea {
  min-height: 80px;
  resize: vertical;
}

.profile-form .static-field {
  padding: 10px 0;
  color: #1f2937;
  display: block;
}

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

.modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.modal-content h3 {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 500;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-buttons button {
  flex: 1;
}

.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  margin-bottom: 12px;
}
