/* ===================================================
   VESSEL APP UI — matches landing page design tokens
   =================================================== */

/* === LAYOUT === */
.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--navy);
}

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: rgba(255,255,255,0.03);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 40px 48px;
  max-width: 1200px;
}

/* === SIDEBAR === */
.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--sand);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.sidebar-tag {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--fg);
}
.sidebar-link.active {
  background: rgba(200,150,62,0.12);
  color: var(--gold);
}
.badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.sidebar-footer {
  padding: 16px 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(200,150,62,0.2);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
}
.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
}
.sidebar-user-email {
  font-size: 0.7rem;
  color: var(--fg-muted);
}
.sidebar-logout {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: var(--fg); }

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}
.page-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 6px;
  font-weight: 500;
}
.page-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  color: var(--sand);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-date {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 8px;
}
.page-badge {
  background: var(--gold);
  color: var(--navy);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  vertical-align: middle;
}

/* === STATS GRID === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stats-grid-sm {
  grid-template-columns: repeat(5, 1fr);
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  transition: background 0.2s, border-color 0.2s;
}
.stat-card.stat-link {
  text-decoration: none;
  display: block;
  cursor: pointer;
}
.stat-card.stat-link:hover, .stat-card.stat-link.active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}
.stat-card-warn {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.05);
}
.stat-card-gold {
  border-color: rgba(200,150,62,0.3);
  background: rgba(200,150,62,0.05);
}
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--sand);
  line-height: 1;
}
.stat-sub {
  font-size: 0.72rem;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* === PANELS === */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--sand);
  letter-spacing: -0.01em;
}
.panel-link {
  font-size: 0.8rem;
  color: var(--gold);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.panel-link:hover { opacity: 1; }
.panel-body { padding: 20px 24px; }

/* === DASHBOARD GRID === */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.panel-wide { grid-column: span 2; }

/* === TASK LIST (dashboard) === */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border-left: 3px solid transparent;
}
.task-item-critical { border-left-color: #ef4444; }
.task-item-high { border-left-color: var(--gold); }
.task-item-medium { border-left-color: rgba(255,255,255,0.15); }
.task-item-low { border-left-color: transparent; }
.task-info { flex: 1; }
.task-title { font-size: 0.875rem; color: var(--fg); font-weight: 400; }
.task-meta { display: flex; gap: 6px; margin-top: 4px; }
.task-due { font-size: 0.72rem; color: var(--fg-muted); white-space: nowrap; }
.task-due.overdue { color: #ef4444; font-weight: 500; }

/* === CREW LIST (dashboard) === */
.crew-list { display: flex; flex-direction: column; gap: 8px; }
.crew-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.crew-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(200,150,62,0.15);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.crew-avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.crew-info { flex: 1; }
.crew-name { font-size: 0.875rem; color: var(--fg); font-weight: 400; }
.crew-role { font-size: 0.72rem; color: var(--fg-muted); }
.crew-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.crew-status-active { background: var(--check); }
.crew-status-inactive { background: rgba(255,255,255,0.2); }

/* === NOTIFICATIONS === */
.notif-list { display: flex; flex-direction: column; gap: 0; }
.notif-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.notif-item:last-child { border-bottom: none; }
.notif-read { opacity: 0.5; }
.notif-title { font-size: 0.875rem; color: var(--fg); }
.notif-message { font-size: 0.78rem; color: var(--fg-muted); margin-top: 2px; }
.notif-time { font-size: 0.72rem; color: rgba(245,237,228,0.3); white-space: nowrap; }

/* Full notifications page */
.notif-full-list { display: flex; flex-direction: column; }
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: rgba(255,255,255,0.02); }
.notif-unread { background: rgba(200,150,62,0.04); }
.notif-dot-col { width: 20px; padding-top: 4px; flex-shrink: 0; }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.notif-content { flex: 1; }
.notif-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }

/* === TAGS === */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.07);
  color: var(--fg-muted);
}
.tag-engine { background: rgba(239,68,68,0.1); color: #f87171; }
.tag-hull { background: rgba(59,130,246,0.1); color: #93c5fd; }
.tag-electrical { background: rgba(234,179,8,0.1); color: #fde047; }
.tag-safety { background: rgba(239,68,68,0.12); color: #f87171; }
.tag-navigation { background: rgba(99,102,241,0.1); color: #a5b4fc; }
.tag-interior { background: rgba(16,185,129,0.1); color: #6ee7b7; }
.tag-rigging { background: rgba(200,150,62,0.1); color: var(--gold); }
.tag-general { background: rgba(255,255,255,0.07); color: var(--fg-muted); }
.tag-role { background: rgba(200,150,62,0.1); color: var(--gold); }
.tag-priority-critical { background: rgba(239,68,68,0.15); color: #f87171; }
.tag-priority-high { background: rgba(200,150,62,0.15); color: var(--gold); }
.tag-priority-medium { background: rgba(255,255,255,0.08); color: var(--fg-muted); }
.tag-priority-low { background: rgba(255,255,255,0.05); color: rgba(245,237,228,0.35); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--gold);
  color: var(--navy);
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-ghost-danger {
  background: none;
  border: none;
  color: rgba(248,113,113,0.6);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  padding: 2px 4px;
  transition: color 0.15s;
}
.btn-ghost-danger:hover { color: #f87171; }
.btn-xs { font-size: 0.7rem; padding: 1px 6px; }

/* === FORMS === */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-label {
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.form-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.form-input::placeholder { color: rgba(245,237,228,0.25); }
.form-input:focus { outline: none; border-color: rgba(200,150,62,0.5); }
.form-input option { background: #0B1929; }
.form-textarea { resize: vertical; min-height: 80px; }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}
.alert-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
}

/* === MODALS === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #0f2033;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--sand);
}
.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--fg); }
.modal-form { padding: 20px 24px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 8px;
}

/* === AUTH PAGES === */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.auth-header { margin-bottom: 28px; }
.auth-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 8px;
  font-weight: 500;
}
.auth-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--sand);
  letter-spacing: -0.02em;
}
.auth-sub {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin-top: 6px;
}
.auth-form { display: flex; flex-direction: column; }
.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.auth-link { color: var(--gold); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* === TABLES === */
.crew-table-wrapper { overflow-x: auto; }
.crew-table, .task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.crew-table th, .task-table th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  font-weight: 500;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.crew-table td, .task-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--fg);
  vertical-align: middle;
}
.crew-row-inline { display: flex; align-items: center; gap: 8px; }
.crew-status-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.crew-status-active { background: rgba(122,196,122,0.12); color: var(--check); }
.crew-status-inactive { background: rgba(255,255,255,0.07); color: var(--fg-muted); }
.row-overdue { background: rgba(239,68,68,0.04); }

/* === TASK TABLE SPECIFICS === */
.task-title-cell { color: var(--fg); }
.task-title-cell.task-done { text-decoration: line-through; opacity: 0.5; }
.task-desc { font-size: 0.75rem; color: var(--fg-muted); margin-top: 2px; }
.check-toggle {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--check);
  font-size: 0.7rem;
  font-weight: 700;
  transition: border-color 0.15s, background 0.15s;
}
.check-toggle:hover { border-color: var(--gold); }
.check-toggle.checked { background: rgba(122,196,122,0.15); border-color: var(--check); }
.overdue-text { color: #f87171; }
.overdue-badge {
  font-size: 0.65rem;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--fg);
  font-size: 0.78rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}
.status-select option { background: #0B1929; }

/* === WEEK GRID (CREW SHIFTS) === */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  overflow-x: auto;
}
.day-col { min-width: 0; }
.day-header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.day-shifts { display: flex; flex-direction: column; gap: 6px; }
.day-empty { font-size: 0.75rem; color: rgba(245,237,228,0.2); text-align: center; padding: 8px 0; }
.shift-card {
  background: rgba(200,150,62,0.08);
  border: 1px solid rgba(200,150,62,0.15);
  border-radius: 6px;
  padding: 8px 10px;
}
.shift-name { font-size: 0.8rem; color: var(--sand); font-weight: 500; }
.shift-role { font-size: 0.68rem; color: var(--fg-muted); }
.shift-time { font-size: 0.68rem; color: var(--gold); margin-top: 3px; font-weight: 500; }
.shift-notes { font-size: 0.65rem; color: var(--fg-muted); margin-top: 3px; font-style: italic; }

/* === EMPTY STATE === */
.empty-state {
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-align: center;
  padding: 24px 0;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 24px 20px; }
  .stats-grid, .stats-grid-sm { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: span 1; }
  .week-grid { grid-template-columns: repeat(3, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
