/* ============================================================
   Command Center — My Tasks (Mobile Context)
   Mobile-first, dark theme, flat cards, system fonts
   ============================================================ */

/* ── Reset & Base ── */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #020408;
  color: #f0f4f8;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: 56px; /* header height */
  padding-bottom: 16px;
}

a {
  color: #c9a962;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
}

/* ── Focus Visible ── */

:focus-visible {
  outline: 2px solid #c9a962;
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

/* ── Scrollbar (dark) ── */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 98, 0.25);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 169, 98, 0.45);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 169, 98, 0.25) transparent;
}


/* ================================================================
   Z-INDEX LAYERS
   header: 100 | modal: 1010 | toast: 1100 | photo-viewer: 1050
   ================================================================ */


/* ── Header ── */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #0d1118;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: #f0f4f8;
  white-space: nowrap;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.admin-entry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #c9a962;
  background: rgba(201, 169, 98, 0.10);
  border: 1px solid rgba(201, 169, 98, 0.2);
  transition: background 0.2s;
  text-decoration: none;
}

.admin-entry-btn:active {
  background: rgba(201, 169, 98, 0.2);
}

.header-username {
  font-size: 13px;
  color: #f0f4f8;
  font-weight: 600;
}

.header-role {
  font-size: 11px;
  color: #a5afbf;
  padding: 1px 6px;
  background: rgba(201, 169, 98, 0.12);
  border-radius: 999px;
}


/* ── Tab Bar ── */

.tab-bar {
  position: sticky;
  top: 56px;
  z-index: 99;
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #0d1118;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  padding: 0 8px;
  gap: 0;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-item {
  position: relative;
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  color: #a5afbf;
  white-space: nowrap;
  transition: color 0.2s;
}

.tab-item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 14px;
  right: 14px;
  height: 2px;
  background: transparent;
  border-radius: 1px;
  transition: background 0.2s;
}

.tab-item.active {
  color: #c9a962;
  font-weight: 600;
}

.tab-item.active::after {
  background: #c9a962;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #f87171;
  border-radius: 999px;
  vertical-align: top;
  line-height: 1;
}


/* ── Main Content ── */

.main-content {
  padding: 12px 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}


/* ── Task Card ── */

.task-card {
  position: relative;
  background: #151b25;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}

.task-card:active {
  border-color: rgba(201, 169, 98, 0.3);
}

.task-card.unread {
  border-left: 3px solid #c9a962;
}

.task-card.overdue {
  border-left: 3px solid #f87171;
  background: rgba(248, 113, 113, 0.05);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.task-card-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #f0f4f8;
  line-height: 1.4;
  word-break: break-all;
}

.task-card-body {
  font-size: 13px;
  color: #a5afbf;
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.task-card-meta-item {
  font-size: 12px;
  color: #a5afbf;
  display: flex;
  align-items: center;
  gap: 3px;
}

.task-card-meta-item .meta-label {
  color: #a5afbf;
  opacity: 0.7;
}

.task-card-meta-item .meta-value {
  color: #a5afbf;
}

.task-card-meta-item.overdue-text .meta-value {
  color: #f87171;
}

.task-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.task-action-hint {
  width: 100%;
  font-size: 11px;
  color: #a5afbf;
  line-height: 1.4;
  margin-bottom: 2px;
  text-align: right;
}


/* ── Priority Pills ── */

.priority-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  flex-shrink: 0;
  line-height: 1.5;
}

.priority-urgent {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.priority-today {
  color: #facc15;
  background: rgba(250, 204, 21, 0.12);
}

.priority-week {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}

.priority-normal {
  color: #a5afbf;
  background: rgba(127, 137, 152, 0.12);
}


/* ── Status Badges ── */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  line-height: 1.5;
}

.status-pass {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}

.status-fail {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.status-warning {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
}

.status-pending {
  color: #facc15;
  background: rgba(250, 204, 21, 0.12);
}


/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: #c9a962;
  color: #020408;
}

.btn-primary:not(:disabled):hover {
  opacity: 0.88;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f0f4f8;
}

.btn-secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.btn-ghost {
  background: transparent;
  color: #a5afbf;
}

.btn-ghost:not(:disabled):hover {
  color: #f0f4f8;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}


/* ── Completion Form ── */

.completion-form {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
  margin-top: 0;
}

.completion-form.open {
  max-height: 600px;
  opacity: 1;
  margin-top: 12px;
}

.completion-form-inner {
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

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

.completion-form-label .required {
  color: #f87171;
  margin-left: 2px;
}

.completion-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: #f0f4f8;
  background: #0d1118;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  resize: vertical;
}

.completion-textarea:focus {
  border-color: #c9a962;
  outline: none;
}

.completion-textarea::placeholder {
  color: rgba(165, 175, 191, 0.5);
}

.completion-form-photos {
  margin-top: 12px;
}

.completion-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}


/* ── Photo Grid ── */

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-grid-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  flex-shrink: 0;
}

.photo-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid-item .photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #f87171;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-grid-item .photo-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.photo-grid-item .photo-progress-bar {
  height: 100%;
  background: #c9a962;
  transition: width 0.2s;
  border-radius: 1px;
}

.photo-add-btn {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: #a5afbf;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.photo-add-btn:hover {
  border-color: #c9a962;
  color: #c9a962;
}

.photo-add-btn .photo-add-icon {
  font-size: 24px;
  line-height: 1;
  font-weight: 300;
}

.photo-add-btn .photo-add-text {
  font-size: 10px;
  margin-top: 2px;
}


/* ── Photo Viewer Overlay ── */

.photo-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
}

.photo-viewer-overlay.open {
  display: flex;
}

.photo-viewer-img {
  max-width: 92%;
  max-height: 88vh;
  border-radius: 4px;
}

.photo-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.12);
  color: #f0f4f8;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}


/* ── Team Stats Bar (Supervisor) ── */

.team-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.team-stats::-webkit-scrollbar {
  display: none;
}

.team-stat-item {
  flex-shrink: 0;
  background: #151b25;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 100px;
  text-align: center;
}

.team-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #c9a962;
  line-height: 1.2;
}

.team-stat-label {
  font-size: 11px;
  color: #a5afbf;
  margin-top: 2px;
}

.team-dept-section {
  margin-bottom: 16px;
}

.team-dept-title {
  font-size: 13px;
  font-weight: 600;
  color: #a5afbf;
  padding: 8px 0 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.team-employee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.team-employee-name {
  font-size: 14px;
  color: #f0f4f8;
  font-weight: 500;
}

.team-employee-stats {
  display: flex;
  gap: 8px;
}

.team-employee-stat {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}


/* ── Policy Card ── */

.policy-card {
  background: #151b25;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.policy-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #f0f4f8;
  margin-bottom: 6px;
}

.policy-card-meta {
  font-size: 12px;
  color: #a5afbf;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
}

.policy-card-excerpt {
  font-size: 13px;
  color: #a5afbf;
  line-height: 1.5;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.policy-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.policy-card.confirmed {
  opacity: 0.7;
  border-color: rgba(74, 222, 128, 0.3);
}

.policy-read-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #4ade80;
  padding: 2px 8px;
  background: rgba(74, 222, 128, 0.12);
  border-radius: 999px;
}


/* ── Empty State ── */

.empty-state {
  text-align: center;
  padding: 60px 16px 40px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  color: #a5afbf;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
  color: #a5afbf;
}


/* ── Skeleton Loading ── */

.skeleton {
  background: linear-gradient(90deg, #151b25 25%, #1c2433 50%, #151b25 75%);
  background-size: 200% 100%;
  -webkit-animation: skeleton-shimmer 1.5s infinite;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}

@-webkit-keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: #151b25;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w100 { width: 100%; }

.skeleton-pill {
  display: inline-block;
  width: 48px;
  height: 20px;
  border-radius: 999px;
}


/* ── Toast ── */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  background: #151b25;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  font-size: 13px;
  color: #f0f4f8;
  pointer-events: auto;
  -webkit-animation: toast-in 0.3s ease;
  animation: toast-in 0.3s ease;
}

.toast.toast-success {
  border-color: rgba(74, 222, 128, 0.3);
  color: #4ade80;
}

.toast.toast-error {
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

@-webkit-keyframes toast-in {
  from {
    opacity: 0;
    -webkit-transform: translateY(12px);
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ── Reduced Motion ── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    -webkit-animation-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .completion-form {
    transition: none;
  }

  .skeleton {
    -webkit-animation: none;
    animation: none;
  }
}
