/* Global look & feel inspired by the drills simplicity */
:root {
  --bg: #050816;
  --panel: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #5ce1e6;
  --accent-2: #7c3aed;
}

body {
  background: linear-gradient(135deg, #050816 0%, #0b1432 55%, #050816 100%);
  color: var(--text);
}

.card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.table th, .table td {
  font-size: 14px;
}

/* Smart table fitting: use the available width, wrap long content, and scroll only when needed */
.table-fit-wrap,
.overflow-x-auto {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-fit-wrap > table,
.overflow-x-auto > table,
table {
  width: 100%;
  max-width: 100%;
}

table:not(.rest-sheet-table) {
  table-layout: fixed;
}

table:not(.rest-sheet-table) th,
table:not(.rest-sheet-table) td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.table-dense-fit th,
.table-dense-fit td {
  font-size: 12px;
  padding: 0.55rem 0.5rem;
}

.rest-sheet-table {
  width: max-content;
  min-width: 100%;
}

.btn {
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  color: #0b1023;
  font-weight: 700;
}

.btn-primary:hover {
  filter: brightness(0.95);
}

/* Make all checkboxes black */
input[type="checkbox"] {
  accent-color: #000 !important;
}
.checkbox {
  --chkbg: #000;
  --chkfg: #fff;
  border-color: #000 !important;
}
.checkbox:checked,
.checkbox[checked] {
  background-color: #000 !important;
  border-color: #000 !important;
}
input[type="radio"],
.radio {
  accent-color: #000 !important;
  --chkbg: #000;
  --chkfg: #fff;
  border-color: #000 !important;
}
.radio:checked,
.radio[checked] {
  background-color: #000 !important;
  border-color: #000 !important;
}

/* Drill pages: blue checkboxes */
.drills-scope input[type="checkbox"] {
  accent-color: #1d4ed8 !important;
}
.drills-scope .checkbox {
  --chkbg: #1d4ed8;
  --chkfg: #fff;
  border-color: #1d4ed8 !important;
}
.drills-scope .checkbox:checked,
.drills-scope .checkbox[checked] {
  background-color: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
}
.drills-scope input[type="radio"],
.drills-scope .radio {
  accent-color: #1d4ed8 !important;
  --chkbg: #1d4ed8;
  --chkfg: #fff;
  border-color: #1d4ed8 !important;
}
.drills-scope .radio:checked,
.drills-scope .radio[checked] {
  background-color: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
}

/* Crew document status highlights */
.docs-flag-row {
  background-color: #8b8000;
}
.docs-flag-row:hover {
  background-color: #7a7000;
}
.docs-flag-card {
  background-image: linear-gradient(135deg, #8b8000, #9a8f00);
  border-color: #6c6200;
}
.docs-flag-card:hover {
  border-color: #5c5400;
}
.docs-flag-badge {
  background-color: #8b8000;
  border-color: #6c6200;
  color: #fff;
}

/* Ensure form fields use dark text on light backgrounds (readable across crew pages) */
input,
select,
textarea,
.input,
.select,
.textarea {
  color: #111827 !important;
  background: #f9fafb !important;
  border-color: #d1d5db !important;
}

.input, .file-input, .textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--stroke);
  color: #fff;
  border-radius: 10px;
}

.input:focus, .textarea:focus, .file-input:focus {
  border-color: rgba(92,225,230,0.6);
  box-shadow: 0 0 0 3px rgba(92,225,230,0.25);
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  margin-bottom: 12px;
}

.page-subtitle {
  color: var(--muted);
  margin-bottom: 18px;
}

/* Buttons inside tables/cards stay aligned */
.table .btn,
.card .btn {
  margin: 0;
}

/* Flash messages */
.flash-success { background: rgba(34,197,94,0.12); color: #bbf7d0; border: 1px solid rgba(34,197,94,0.4); }
.flash-error { background: rgba(239,68,68,0.12); color: #fecaca; border: 1px solid rgba(239,68,68,0.4); }

/* Mobile-friendly tweaks */
@media (max-width: 768px) {
  .page-shell {
    padding: 16px;
  }
  .table th, .table td {
    font-size: 12px;
    padding: 8px 6px;
  }
  table:not(.rest-sheet-table) {
    table-layout: auto;
  }
  .card {
    border-radius: 12px;
  }
}
