:root {
  --brand-blue: #1f5bb5;
  --brand-blue-dark: #163f83;
  --brand-blue-soft: #eaf2ff;
  --brand-ink: #12213f;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f4f7fb;
  color: var(--brand-ink);
}

.navbar {
  background: linear-gradient(135deg, #ffffff 0%, #edf4ff 100%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d9e5f7;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-logo {
  width: 150px;
  height: auto;
  display: block;
}
.navbar h1 { font-size: 18px; font-weight: 700; color: var(--brand-blue-dark); }
.navbar .moka-status {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logout-btn {
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--brand-blue-dark);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(18,33,63,0.08);
}
.login-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef5ff 0%, #f8fbff 100%);
}
body.auth-locked .login-screen { display: flex; }
body.auth-locked .navbar,
body.auth-locked .container { display: none; }
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(18,33,63,0.12);
}
.login-card .brand-logo {
  width: 170px;
  margin-bottom: 22px;
}
.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-blue-dark);
  margin-bottom: 8px;
}
.login-subtitle {
  font-size: 14px;
  color: #65738a;
  line-height: 1.6;
  margin-bottom: 22px;
}
.login-error {
  display: none;
  margin-top: 12px;
  color: #c62828;
  font-size: 13px;
  line-height: 1.5;
}
.login-error.active { display: block; }

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  overflow-x: auto;
}
.tab {
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  border: none;
  background: transparent;
  white-space: nowrap;
}
.tab.active {
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  color: #fff;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
}
.form-label .required { color: #f44336; }
.form-input, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.form-input:focus, .form-select:focus { border-color: var(--brand-blue); }

.position-picker {
  position: relative;
}
.position-picker-trigger {
  width: 100%;
  min-height: 52px;
  padding: 10px 44px 10px 12px;
  border: 1.5px solid #d7deea;
  border-radius: 12px;
  background: #fff;
  color: var(--brand-ink);
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.position-picker-trigger:after {
  content: '⌄';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-blue);
  font-size: 20px;
}
.position-picker-trigger.active {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(31,91,181,0.1);
}
.position-placeholder {
  color: #8a95a8;
}
.position-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.position-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.position-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d7deea;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(18,33,63,0.14);
  z-index: 50;
  padding: 6px;
}
.position-dropdown.active { display: block; }
.position-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  color: var(--brand-ink);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.position-option:hover, .position-option.selected {
  background: var(--brand-blue-soft);
}
.position-check {
  width: 18px;
  height: 18px;
  border: 1.5px solid #b6c3d8;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  color: #fff;
  font-size: 12px;
}
.position-option.selected .position-check {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.interviewer-row {
  display: flex;
  gap: 10px;
}
.interviewer-row .form-select { flex: 1; }
.btn-import {
  padding: 12px 16px;
  background: #e8f5e9;
  color: #2e7d32;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn-import:disabled { opacity: 0.5; cursor: not-allowed; }

.slots-editor { display: flex; flex-direction: column; gap: 10px; }
.slot-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.slot-input-row input[type="datetime-local"] {
  flex: 1;
  padding: 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.slot-input-row input:focus { border-color: var(--brand-blue); }
.slot-remove {
  background: #ffebee;
  color: #c62828;
  border: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
}
.btn-add-slot {
  width: 100%;
  padding: 10px;
  background: #f0f0ff;
  color: var(--brand-blue);
  border: 1.5px dashed var(--brand-blue);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  padding: 8px 16px;
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.invite-list { display: flex; flex-direction: column; gap: 12px; }
.invite-item {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.invite-main { flex: 1; }
.invite-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}
.invite-meta {
  font-size: 12px;
  color: #888;
}
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}
.status-pending { background: #fff3e0; color: #e65100; }
.status-selected { background: #e3f2fd; color: #1565c0; }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-expired { background: #f5f5f5; color: #999; }
.status-cancelled { background: #ffebee; color: #c62828; }
.status-alternative { background: #fff3e0; color: #e65100; }
.alert-badge {
  background: #ffebee;
  color: #c62828;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
}
.invite-actions { display: flex; gap: 8px; }

.calendar-group {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.calendar-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.calendar-event {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}
.calendar-event:last-child { border-bottom: none; }
.calendar-time {
  width: 150px;
  color: var(--brand-blue);
  font-weight: 600;
  font-size: 14px;
}
.calendar-time .date { color: #999; font-size: 12px; font-weight: 400; margin-top: 2px; }
.calendar-info { flex: 1; }
.calendar-info .candidate { font-weight: 600; }
.calendar-info .job { font-size: 13px; color: #666; margin-top: 4px; }

.calendar-range {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.calendar-range input {
  padding: 8px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
}
.month-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); border:1px solid #e5e7eb; background:#e5e7eb; gap:1px; }
.month-weekday { background:#f8f9fb; padding:10px 4px; text-align:center; font-size:12px; font-weight:700; }
.month-day { background:#fff; min-height:110px; padding:8px; overflow:hidden; }
.month-day.muted { background:#fafafa; color:#bbb; }
.month-number { font-size:12px; font-weight:700; margin-bottom:6px; }
.month-event { background:#eef4ff; border-left:3px solid var(--brand-blue); padding:6px; margin-bottom:5px; font-size:11px; line-height:1.35; overflow:hidden; border-radius:6px; }
.month-event.offline { background:#fff7ed; border-left-color:#d97706; }
.month-event-actions { display:flex; gap:4px; margin-top:6px; flex-wrap:wrap; }
.month-event-actions button { border:none; border-radius:6px; padding:4px 6px; font-size:10px; color:#163f83; background:#fff; cursor:pointer; box-shadow:0 1px 2px rgba(18,33,63,0.08); }
.month-event-actions button.danger { color:#c62828; }
.request-item { border:1px solid #ececf1; border-radius:8px; padding:14px; margin-bottom:10px; }
.request-actions { display:flex; gap:8px; margin-top:10px; }
@media print {
  body * { visibility:hidden; }
  #calendarBoard, #calendarBoard * { visibility:visible; }
  #calendarBoard { position:absolute; inset:0; width:100%; }
  .navbar,.tabs,.calendar-range { display:none!important; }
}

.position-item, .interviewer-item, .hr-contact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f5f5f5;
}
.position-item:last-child, .interviewer-item:last-child, .hr-contact-item:last-child { border-bottom: none; }
.written-test-item {
  border: 1px solid #edf1f7;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}
.written-test-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.written-slot-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.written-slot-row input[type="datetime-local"] {
  flex: 1;
  padding: 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.position-name { font-size: 15px; }
.interviewer-name { font-weight: 600; }
.interviewer-link {
  font-size: 12px;
  color: var(--brand-blue);
  word-break: break-all;
  margin-top: 4px;
}
.meta-line {
  font-size: 12px;
  color: #667085;
  margin-top: 3px;
  line-height: 1.45;
}
.inline-edit {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.mini-input {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid #dbe2ee;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.sync-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sync-result {
  display: none;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  background: #f4f8ff;
  border: 1px solid #d8e6ff;
  color: #335;
}
.sync-result.active { display: block; }
.missing-mobile-summary {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: #fff8e8;
  border: 1px solid #f7dca5;
  color: #5f4307;
  font-size: 13px;
  line-height: 1.55;
}
.simple-table-wrap { overflow-x: auto; margin-top: 12px; }
.simple-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}
.simple-table th,
.simple-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f7;
  vertical-align: top;
}
.simple-table th {
  color: #344054;
  background: #f8fafc;
  font-weight: 700;
}
.simple-table td {
  color: #667085;
}

.link-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.link-input {
  flex: 1;
  padding: 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
}
.copy-btn {
  padding: 10px 16px;
  background: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.modal-header .modal-title { margin-bottom: 0; }
.modal-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #eef3fb;
  color: #5c6b82;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: #dfe9f8;
  color: var(--brand-blue-dark);
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

@media (max-width: 600px) {
  .interviewer-row { flex-direction: column; }
  .btn-import { width: 100%; }
  .invite-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .invite-actions { width: 100%; justify-content: flex-end; }
  .calendar-event { flex-direction: column; gap: 6px; }
  .calendar-time { width: auto; }
  .tabs { padding: 4px 8px; }
  .tab { padding: 10px 14px; font-size: 13px; }
  .navbar { padding: 12px 16px; }
  .brand-logo { width: 120px; }
  .navbar h1 { font-size: 15px; }
  .inline-edit { grid-template-columns: 1fr; }
  .written-slot-row { flex-direction: column; align-items: stretch; }
}
