/* ═══════════════════════════════════════════
   SEAFORTH CONNECT — PORTAL STYLES
   Extends the seaforthenvironmental.com design
   tokens; dark ops theme per /dashboard.
   ═══════════════════════════════════════════ */

/* Design Tokens (identical to css/styles.css on the main site) */
:root {
  --deep-navy: #0a1628;
  --ocean-dark: #0d2137;
  --ocean-mid: #143654;
  --teal-accent: #00d4aa;
  --teal-glow: #00ffcc;
  --gold-accent: #d4a843;
  --gold-bright: #f5c542;
  --amber-warning: #f5a623;
  --coral-alert: #ff6b6b;
  --ice-white: #e8f0f6;
  --mist-gray: #94a3b8;
  --foam-white: #f0f5fa;
  --brand-blue: #2a6cb6;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-100: #f1f5f9;

  --panel-bg: rgba(13, 33, 55, 0.75);
  --panel-border: rgba(0, 212, 170, 0.15);
  --input-bg: rgba(10, 22, 40, 0.6);
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Source Serif 4', 'Georgia', serif;
  background: var(--deep-navy);
  color: var(--ice-white);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  min-width: 320px;
}

/* Ambient ocean background, same treatment as the public dashboard */
.ocean-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(20, 54, 84, 0.4) 0%, transparent 50%),
    linear-gradient(180deg, var(--deep-navy) 0%, var(--ocean-dark) 50%, var(--deep-navy) 100%);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: 'Archivo Black', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.15;
  color: var(--foam-white);
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.05em;
}

.muted { color: var(--mist-gray); }

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 640px) {
  .container { padding: 0 1rem; }
}

/* ═══════ HEADER / NAV ═══════ */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(135deg, rgba(10, 22, 40, 0.97), rgba(13, 33, 55, 0.94));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212, 168, 67, 0.25);
}

.portal-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 2rem;
  width: 100%;
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.portal-logo img {
  width: 64px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 1px 6px rgba(212, 168, 67, 0.4));
}

.portal-logo-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--foam-white);
  line-height: 1.1;
}

.portal-logo-sub {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-accent);
  margin-top: 0.15rem;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.portal-nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist-gray);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  transition: color 0.25s, background 0.25s;
}

.portal-nav a:hover {
  color: var(--teal-accent);
  background: rgba(0, 212, 170, 0.08);
}

.portal-nav a.active {
  color: var(--teal-accent);
  background: rgba(0, 212, 170, 0.12);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--mist-gray);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--foam-white);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ═══════ MAIN / PANELS ═══════ */
main.portal-main {
  padding: 2rem 0 4rem;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.panel-title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(212, 168, 67, 0.2);
}

.panel-title .accent { color: var(--teal-accent); }

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ═══════ FORMS ═══════ */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-accent);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  color: var(--ice-white);
  background: var(--input-bg);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

select option { background: var(--ocean-dark); }

.form-hint {
  font-size: 0.8rem;
  color: var(--mist-gray);
  margin-top: 0.35rem;
}

/* ═══════ BUTTONS (same recipe as main site) ═══════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.85rem 2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.25s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal-accent), #00b894);
  color: var(--deep-navy);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(0, 212, 170, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--foam-white);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--teal-accent);
  color: var(--teal-accent);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  color: var(--coral-alert);
  border: 1px solid rgba(255, 107, 107, 0.35);
}
.btn-danger:hover { background: rgba(255, 107, 107, 0.2); }

.btn-block { width: 100%; }

/* ═══════ TABLES ═══════ */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-accent);
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(212, 168, 67, 0.25);
  white-space: nowrap;
}

table.data td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--ice-white);
}

table.data tr:hover td { background: rgba(0, 212, 170, 0.04); }

/* ═══════ BADGES / STATUS ═══════ */
.badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}

.badge-teal  { background: rgba(0, 212, 170, 0.15); color: var(--teal-accent); }
.badge-gold  { background: rgba(212, 168, 67, 0.15); color: var(--gold-bright); }
.badge-gray  { background: rgba(148, 163, 184, 0.15); color: var(--mist-gray); }
.badge-coral { background: rgba(255, 107, 107, 0.15); color: var(--coral-alert); }

/* ═══════ FLASH MESSAGES ═══════ */
.flash {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  padding: 0.85rem 1.1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border: 1px solid;
}
.flash-success { background: rgba(0, 212, 170, 0.1); border-color: rgba(0, 212, 170, 0.35); color: var(--teal-accent); }
.flash-error   { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.35); color: var(--coral-alert); }
.flash-warning { background: rgba(245, 166, 35, 0.1); border-color: rgba(245, 166, 35, 0.35); color: var(--amber-warning); }
.flash-info    { background: rgba(42, 108, 182, 0.15); border-color: rgba(42, 108, 182, 0.4); color: var(--ice-white); }

/* ═══════ LOGIN PAGE ═══════ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-logo img { width: 140px; }

.login-title {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.login-sub {
  display: block;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-accent);
  margin-bottom: 2rem;
}

/* ═══════ DASHBOARD BITS ═══════ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1.25rem;
}

.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mist-gray);
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.6rem;
  color: var(--teal-accent);
}

.stat-value.gold { color: var(--gold-bright); }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 860px) {
  .nav-toggle { display: block; }

  .portal-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--ocean-dark);
    border-bottom: 1px solid rgba(212, 168, 67, 0.25);
    padding: 0.5rem 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  }

  .portal-nav.open { display: flex; }

  /* The full menu is taller than a phone screen — cap the drawer at the
     viewport (dvh accounts for mobile browser chrome) and scroll inside
     it, so LOG OUT is always reachable. */
  .portal-nav {
    max-height: calc(100vh - 70px);
    max-height: calc(100dvh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .portal-nav a { padding: 0.9rem 1.5rem; font-size: 0.8rem; }

  .nav-user > span,
  .nav-user .nav-name-link { display: none; } /* name hides (drawer has MY PROFILE); chat icon stays */
  .nav-user { padding-right: 0.9rem; }  /* chat icon off the screen edge */

  .panel { padding: 1.25rem; }

  /* Big touch targets for crew in the field */
  .btn { padding: 1rem 2rem; }
}

/* ═══════ CALENDAR (banner layout) ═══════ */
.cal-grid7 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0 4px;
}

.cal-head { margin-bottom: 4px; }

.cal-dow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-accent);
  text-align: center;
  padding: 0.4rem 0;
}

/* A week (or day-view window) is one grid: backgrounds span all rows,
   day numbers sit in row 1, job banners occupy lane rows below. */
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px 4px;
  margin-bottom: 4px;
  padding-bottom: 4px;
}

.cal-bg {
  background: rgba(10, 22, 40, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 6px;
  z-index: 0;
}

.cal-dim { opacity: 0.45; }

.cal-today {
  border-color: var(--teal-accent);
  box-shadow: inset 0 0 0 1px rgba(0, 212, 170, 0.4);
}

.cal-daynum {
  z-index: 1;
  justify-self: start;
  align-self: start;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--mist-gray);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  margin: 3px;
}

.cal-daynum:hover { background: rgba(0, 212, 170, 0.15); color: var(--teal-accent); }
.cal-daynum.is-today { color: var(--teal-accent); font-weight: 600; }

.cal-colhead {
  z-index: 1;
  align-self: center;
  padding: 0 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist-gray);
}

.cal-colhead.is-today { color: var(--teal-accent); font-weight: 600; }

/* The continuous multi-day bar (month view) */
.cal-banner {
  z-index: 1;
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  color: #0a1628;
  padding: 0.22rem 0.5rem;
  margin: 0 3px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cal-banner:hover { transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45); }

/* Squared edges where a job continues into the previous/next week */
.cal-banner.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-banner.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }

/* Day-view banner cards: full type-color, Google-style, dark text */
.cal-bannercard {
  z-index: 1;
  display: block;
  color: #0a1628;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin: 3px 6px;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.cal-bannercard strong { color: #0a1628; }

.cal-bannercard:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); }

/* Day-view hour strip: bars positioned by ETA/ETD on a 24h-per-day axis */
.cal-hourbar {
  position: absolute;
  z-index: 2;
  display: block;
  color: #0a1628;
  font-weight: 700;
  font-size: 0.68rem;
  font-family: 'IBM Plex Mono', monospace;
  border-radius: 6px;
  padding: 0 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cal-hourbar:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); z-index: 4; }

/* Continuation arrows: the job extends beyond the visible window */
.cal-bannercard { position: relative; }
.cal-bannercard.cont-r { padding-right: 2rem; }
.cal-bannercard.cont-l { padding-left: 2rem; }

.cont-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.8;
  pointer-events: none;
}

.cont-arrow-r { right: 0.6rem; }
.cont-arrow-l { left: 0.6rem; }
.cal-bannercard.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bannercard.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }

@media (max-width: 860px) {
  .cal-week { gap: 2px; }
  .cal-banner { font-size: 0.5rem; padding: 0.14rem 0.3rem; margin: 0 1px; }
  .cal-daynum { font-size: 0.62rem; padding: 0.1rem 0.3rem; margin: 2px; }
  .cal-colhead { font-size: 0.58rem; padding: 0 0.3rem; }
  .cal-bannercard { padding: 0.45rem 0.55rem; margin: 2px 3px; }
}

/* Longer brand title fits comfortably at all widths */
.portal-logo-title { font-size: 1rem; }
@media (max-width: 480px) {
  .portal-logo-title { font-size: 0.8rem; }
  .portal-logo img { width: 52px; height: 36px; }
}

/* Calendar banners: white text on all layer colors */
.cal-banner,
.cal-banner:visited,
a.cal-bannercard,
a.cal-bannercard:visited,
span.cal-bannercard,
.cal-bannercard strong,
.cal-bannercard {
  color: #fff !important;
}
.cal-bannercard .mono,
.cal-bannercard .form-hint {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* Calendar banners: larger text */
.cal-banner {
  font-size: 0.85rem;
  line-height: 1.5;
}
.cal-bannercard {
  font-size: 0.95rem;
}
.cal-bannercard .mono,
.cal-bannercard .form-hint {
  font-size: 0.8rem;
}

/* ================= Mobile pass: calendar & time clock ================= */
.panel:has(.cal-week) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cal-grid7, .cal-week {
  min-width: 580px;
}

@media (max-width: 640px) {
  .data-table th:nth-child(6), .data-table td:nth-child(6),
  .data-table th:nth-child(7), .data-table td:nth-child(7) {
    display: none;
  }
  .btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .cal-banner { font-size: 0.75rem; }
  .form-input[type="date"], .form-input[type="time"] {
    min-width: 8.5rem;
  }
}

/* ============ Date & time inputs: dark, bigger, consistent ============ */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
  color-scheme: dark;                 /* dark native picker popup too */
  background: rgba(255, 255, 255, 0.06);
  color: var(--ice-white, #e8eef4);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  min-height: 44px;                   /* thumb-friendly on phones */
}
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
  outline: 2px solid rgba(45, 212, 191, 0.6);
  outline-offset: 1px;
}
input::-webkit-calendar-picker-indicator {
  filter: brightness(2.5);
  opacity: 0.95;
  cursor: pointer;
}
/* Width-capped panels center on large screens instead of hugging the left */
.panel[style*="max-width"] {
  margin-left: auto;
  margin-right: auto;
}
/* ═══════ TEAM CHAT — header icon + badge ═══════ */
.nav-chat {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist-gray);
  padding: 0.45rem;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.25s, background 0.25s;
}
.nav-chat:hover {
  color: var(--teal-accent);
  background: rgba(0, 212, 170, 0.08);
}
.nav-chat-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e2504c;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(10, 22, 40, 0.97);
}
.nav-chat-badge[hidden] { display: none; }

/* Keep the icon visible on phones even though .nav-user hides —
 * it sits between the hamburger and the (hidden) name. */
@media (max-width: 768px) {
  .nav-chat {
    padding: 0.55rem;                    /* bigger touch target */
    margin-right: 0.9rem;                /* breathing room off the edge */
  }
  .nav-chat svg { width: 24px; height: 24px; }
}

/* Narrow phones: the header row was WIDER than the screen — the logo
   block plus gaps overflowed and the chat icon was clipped at the
   right edge (which looked like "flush", immune to any margin).
   Shrink the brand and tighten spacing so the row actually fits. */
@media (max-width: 520px) {
  .portal-header-inner { padding: 0.6rem 1rem; gap: 0.5rem; }
  .portal-logo { gap: 0.5rem; }
  .portal-logo img { height: 34px; }
  .portal-logo-title { font-size: 0.85rem; }
  .portal-logo-sub { display: none; }
}

/* Banner text: white across ALL calendar views. LOADING-status banners
   are the one exception — black text on the gold, every view. */
a.cal-banner, span.cal-banner, .cal-banner,
a.cal-bannercard, span.cal-bannercard, .cal-bannercard, .cal-bannercard strong,
a.cal-hourbar, span.cal-hourbar, .cal-hourbar {
  color: #fff !important;
}
a.cal-banner.cal-black-text, a.cal-banner.cal-black-text:visited, a.cal-banner.cal-black-text:hover,
a.cal-bannercard.cal-black-text, a.cal-bannercard.cal-black-text:visited, a.cal-bannercard.cal-black-text:hover,
a.cal-hourbar.cal-black-text, a.cal-hourbar.cal-black-text:visited, a.cal-hourbar.cal-black-text:hover,
span.cal-black-text, .cal-black-text, .cal-black-text strong {
  color: #0a1628 !important;
}

/* ═══════ CALENDAR — phone fit (no sideways scrolling) ═══════
   Below 700px the grids release their 580px minimum and compress to
   the viewport: 7 month columns or up to 5 timed day-columns share the
   screen, Google-Calendar style. Chips truncate; tap-through for the
   full text. Desktop layout is untouched. */
@media (max-width: 700px) {
  .cal-grid7, .cal-week {
    min-width: 0;
  }
  .cal-banner, .cal-bannercard {
    font-size: 0.48rem;
    padding: 0.1rem 0.2rem;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cal-hourbar {
    font-size: 0.45rem;
    padding: 0.08rem 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .cal-daynum { font-size: 0.6rem; }
  .cal-dow { font-size: 0.5rem; letter-spacing: 0.05em; }
  .cal-colhead { font-size: 0.55rem; }
}

/* ═══════ PPA RADAR — phone cards ═══════
   Below 700px the traffic tables become stacked cards: vessel leading,
   labelled facts beneath. Nothing hidden, nothing to scroll sideways;
   the generic 640px column-hiding rule is overridden for these tables. */
@media (max-width: 700px) {
  .ppa-traffic thead { display: none; }
  .ppa-traffic, .ppa-traffic tbody { display: block; width: 100%; }
  .ppa-traffic tr {
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.6rem;
    background: rgba(255, 255, 255, 0.02);
  }
  .ppa-traffic td {
    display: block;
    border: none !important;
    padding: 0.12rem 0;
    font-size: 0.82rem;
  }
  .ppa-traffic td:nth-child(6), .ppa-traffic th:nth-child(6),
  .ppa-traffic td:nth-child(7), .ppa-traffic th:nth-child(7) {
    display: block;   /* undo the generic mobile column-hiding */
  }
  .ppa-traffic td[data-label]::before {
    content: attr(data-label) ' — ';
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-accent);
  }
  .ppa-traffic td:nth-child(2) {   /* vessel leads the card */
    font-size: 0.95rem;
    padding-bottom: 0.25rem;
  }
}

/* ═══════ CREW TIMESHEET — phone fit ═══════
   Below 700px the table stops being a table: each day is a stacked
   card — date line, work-type line, labeled mini-columns (Start /
   End / Hrs / Day / Week), then the action chips on their own row.
   The page header stacks too (Timesheet / ‹ range › / + Add a shift).
   The !importants beat the generic ≤640px nth-child column hiding. */
@media (max-width: 700px) {
  .ts-headleft { flex-basis: 100%; }
  .ts-headleft h1 { flex-basis: 100%; }
  .ts-totals { gap: 0.4rem 1.2rem !important; font-size: 0.85rem !important; }
  .ts-scroll { overflow-x: visible !important; }
  table.ts-table { display: block; min-width: 0 !important; width: 100% !important; }
  .ts-table thead { display: none; }
  .ts-table tbody { display: block; }
  .ts-table tbody tr { display: flex; flex-wrap: wrap; align-items: center;
      column-gap: 0.8rem; padding: 0.45rem 0.15rem;
      border-bottom: 1px solid rgba(148, 163, 184, 0.14); }
  .ts-table td { display: block !important; border: none !important;
      padding: 0.05rem 0; width: auto !important; font-size: 0.78rem; }
  .ts-table td.ts-blank, .ts-table td.ts-hidep { display: none !important; }
  .ts-table tr.ts-week { padding: 0.1rem 0; border-bottom: none; }
  .ts-table tr.ts-week td { flex: 1 1 100%; }
  .ts-table td.ts-date { flex: 1 1 100%; padding-bottom: 0.05rem; }
  .ts-table td.ts-job { flex: 1 1 100%; }
  .ts-table td[data-l]::before { content: attr(data-l); display: block;
      font-size: 0.54rem; letter-spacing: 0.07em; text-transform: uppercase;
      color: var(--mist-gray, #9ab); }
  .ts-table td.ts-actions { flex: 1 1 100%; display: flex !important;
      flex-wrap: wrap; gap: 0.35rem; align-items: center; padding-top: 0.25rem; }
  .ts-table .lb-chip { white-space: normal !important; line-height: 1.25; }
}

/* ═══════ DIRECTORY — phone fit ═══════
   Email columns hide on phones (tap-to-call is the mobile use case;
   emails live on desktop). Remaining columns share the screen. */
@media (max-width: 700px) {
  .dir-email, .dir-notes { display: none; }   /* tap-to-call is the mobile use case */
  table.data { min-width: 0 !important; }
  /* table.data th/td needed: plain .data th loses to the base rules */
  table.data th, table.data td { font-size: 0.75rem; padding: 0.4rem 0.35rem; }
  table.data a[href^="tel:"] { white-space: nowrap; }  /* numbers never break mid-dial */
}

/* ═══════ MY PROFILE nav ═══════
   Desktop: the username top-right is the profile link.
   Mobile: a MY PROFILE drawer item (the name is hidden there). */
.nav-name-link {
  color: inherit;
  text-decoration: none;
}
.nav-name-link:hover span { color: var(--teal-accent); }
.nav-mobile-only { display: none; }
@media (max-width: 860px) {
  .portal-nav a.nav-mobile-only { display: block; }
}
