/* src/public/css/portal.css */
:root {
  --ocean: #0A4B6E;
  --ocean-mid: #0E6A9A;
  --ocean-light: #1A8FCA;
  --teal: #00B4A6;
  --sand: #F5EFE0;
  --bg: #F0F4F8;
  --bg-card: #FFFFFF;
  --text-dark: #0D1B2A;
  --text-mid: #3A5068;
  --text-light: #7A95A8;
  --border: #DDE6EE;
  --success: #059669;
  --success-bg: #D1FAE5;
  --warning: #D97706;
  --warning-bg: #FEF3C7;
  --error: #DC2626;
  --error-bg: #FEE2E2;
  --sidebar-w: 240px;
}

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

body {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ──────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--ocean);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-icon { font-size: 22px; }
.brand-abbr { font-size: 17px; font-weight: 700; color: white; line-height: 1; }
.brand-sub  { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 12px 18px 4px;
  font-family: 'JetBrains Mono', monospace;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: white; background: rgba(255,255,255,0.1); border-left-color: var(--teal); }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
}
.user-name  { font-size: 12px; font-weight: 600; color: white; }
.user-role  { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: capitalize; }
.logout-btn { font-size: 11px; color: rgba(255,255,255,0.4); text-decoration: none; }
.logout-btn:hover { color: rgba(255,255,255,0.8); }

/* ─── Main Content ───────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--text-light); }
.breadcrumb a { color: var(--ocean-light); text-decoration: none; }
.crumb-sep { color: var(--text-light); }

/* ─── Alerts ──────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
}
.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning  { background: var(--warning-bg); color: #92400e; border: 1px solid #fcd34d; }
.alert-error    { background: var(--error-bg);   color: #991b1b; border: 1px solid #fca5a5; }

/* ─── Buttons ────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--ocean); color: white; }
.btn-primary:hover { background: var(--ocean-mid); }
.btn-secondary { background: #EFF6FF; color: var(--ocean); border: 1px solid var(--border); }
.btn-secondary:hover { background: #DBEAFE; }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1px solid var(--border); }
.btn-ghost:hover { background: #F8FAFC; }
.btn-danger { background: var(--error-bg); color: var(--error); border: 1px solid #fca5a5; }
.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid #6ee7b7; }
.btn-xs  { padding: 4px 10px; font-size: 11px; }
.btn-sm  { padding: 7px 14px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Stats Row ──────────────────────── */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card {
  flex: 1; background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px;
  border-top: 3px solid var(--ocean-light);
}
.stat-card.stat-green  { border-top-color: var(--success); }
.stat-card.stat-yellow { border-top-color: var(--warning); }
.stat-card.stat-red    { border-top-color: var(--error); }
.stat-num   { font-size: 28px; font-weight: 700; color: var(--text-dark); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-light); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.07em; }

/* ─── Filter Bar ─────────────────────── */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.filter-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-search { width: 240px; }

/* ─── Table ─────────────────────────── */
.table-card { background: white; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #F8FAFC; padding: 11px 16px;
  text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-light); border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 16px; border-bottom: 1px solid #F0F4F8;
  font-size: 13px; vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFCFF; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ocean); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.cell-name { font-weight: 600; font-size: 13px; }
.cell-sub  { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.empty-state { text-align: center; color: var(--text-light); padding: 32px; font-size: 13px; }
.action-group { display: flex; gap: 6px; }

/* ─── Badges ─────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: var(--success-bg); color: #065f46; }
.badge-red    { background: var(--error-bg);   color: #991b1b; }
.badge-yellow { background: var(--warning-bg); color: #92400e; }

.role-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: rgba(14,106,154,0.1); color: var(--ocean-mid);
}
.role-badge.role-supervisor  { background: rgba(0,180,166,0.1); color: #007A72; }
.role-badge.role-readonly    { background: #F0F4F8; color: var(--text-light); }

/* ─── Pagination ─────────────────────── */
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 20px; justify-content: flex-end; }
.page-info  { font-size: 12px; color: var(--text-light); }

/* ─── Forms ──────────────────────────── */
.form-page { max-width: 720px; margin: 0 auto; }
.form-card { background: white; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.form-card-header {
  background: var(--ocean); color: white;
  padding: 24px 28px;
  display: flex; align-items: center; gap: 16px;
}
.form-card-icon { font-size: 32px; }
.form-card-header h2 { font-size: 18px; font-weight: 700; }
.form-card-header p  { font-size: 12px; opacity: 0.6; margin-top: 3px; }
.user-form { padding: 28px; }
.form-section { margin-bottom: 28px; }
.form-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-light);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-family: 'JetBrains Mono', monospace;
}
.form-row { margin-bottom: 14px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0; }
.form-row.two-col .form-group { margin-bottom: 14px; }
.form-group { margin-bottom: 14px; }
.form-group.has-error .form-input,
.form-group.has-error .form-select { border-color: var(--error); }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.required { color: var(--error); }
.optional  { color: var(--text-light); font-weight: 400; }
.form-input, .form-select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: 'Sora', sans-serif; font-size: 13px; color: var(--text-dark);
  background: white; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--ocean-light);
  box-shadow: 0 0 0 3px rgba(26,143,202,0.1);
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A95A8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.field-error { font-size: 11px; color: var(--error); margin-top: 3px; }
.field-hint  { font-size: 11px; color: var(--text-light); margin-top: 3px; }

.preview-box {
  background: #F0F9FF; border: 1px solid #BAE6FD;
  border-radius: 10px; padding: 14px 18px; margin: 20px 0;
}
.preview-box-title { font-size: 11px; font-weight: 700; color: var(--ocean-mid); margin-bottom: 8px; }
.preview-sms { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-mid); line-height: 1.7; white-space: pre-line; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }

/* ─── Detail Layout ────────────────── */
.detail-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.detail-sidebar { display: flex; flex-direction: column; gap: 16px; }

.user-profile-card {
  background: white; border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; text-align: center;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--ocean); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; margin: 0 auto 12px;
}
.profile-name     { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.profile-username { font-size: 12px; color: var(--text-light); margin-bottom: 10px; }
.profile-meta     { text-align: left; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.meta-row         { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 7px; }
.meta-label       { color: var(--text-light); font-weight: 500; flex-shrink: 0; }
.profile-status   { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.must-change-pwd  { font-size: 11px; color: var(--warning); margin-top: 6px; }

.sms-card {
  background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.sms-card.sms-sent    { border-color: #6ee7b7; }
.sms-card.sms-not-sent { border-color: #fca5a5; }
.sms-card-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-light); margin-bottom: 10px; }
.sms-msg-id { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-light); margin-top: 5px; }

.actions-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }

.section-card { background: white; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.section-card-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-light); padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}
.audit-list { padding: 8px 0; }
.audit-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #F8FAFC; }
.audit-item:last-child { border-bottom: none; }
.audit-icon { font-size: 14px; margin-top: 1px; }
.audit-action { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.audit-meta   { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.audit-notes  { font-size: 11px; color: var(--text-mid); margin-top: 4px; font-style: italic; }

/* ─── Monospace ID tags ─────────────────────── */
code.mono-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; background: #EFF6FF; color: #0E6A9A;
  padding: 2px 7px; border-radius: 5px;
  border: 1px solid #BFDBFE; white-space: nowrap;
}
code.mono-sm { font-size: 10px; padding: 1px 5px; }

/* ─── Zone Badges ────────────────────────────── */
.zone-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 600;
  background: #EFF6FF; color: #0E6A9A; border: 1px solid #BFDBFE;
}
.zone-badge.zone-marine_ioc        { background: #F0F9FF; color: #0369A1; border-color: #BAE6FD; }
.zone-badge.zone-inland_victoria   { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.zone-badge.zone-inland_tanganyika { background: #FFF7ED; color: #9A3412; border-color: #FED7AA; }
.zone-badge.zone-inland_nyasa      { background: #FDF4FF; color: #7E22CE; border-color: #E9D5FF; }

/* ─── Type badge ─────────────────────────────── */
.type-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: #F0F4F8; color: #3A5068; text-transform: capitalize;
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — added components
   ═══════════════════════════════════════════════════════════════ */

/* ── Stat card variants with left accent bar ──────────────────── */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.15s;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }
.stat-card--ocean { border-left-color: var(--ocean); }
.stat-card--teal  { border-left-color: var(--teal); }
.stat-card--slate { border-left-color: #64748B; }
.stat-card--muted { border-left-color: #94A3B8; }
.stat-card__icon  { font-size: 32px; flex-shrink: 0; }
.stat-card__value { font-size: 28px; font-weight: 800; color: var(--text-dark); line-height: 1; }
.stat-card__label { font-size: 12px; color: var(--text-light); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-card__sub   { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.stat-card__trend { font-size: 11px; color: var(--text-light); }
.stat-card__trend--up { color: var(--success); font-weight: 600; }

/* ── Two-column grid for panels ──────────────────────────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .two-col-grid { grid-template-columns: 1fr; } }

/* ── Panel ───────────────────────────────────────────────────── */
.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel__title    { font-size: 14px; font-weight: 700; color: var(--text-dark); margin: 0; }
.panel__subtitle { font-size: 11px; color: var(--text-light); }
.panel__action   { font-size: 12px; color: var(--ocean-mid); text-decoration: none; font-weight: 600; }
.panel__action:hover { text-decoration: underline; }
.panel__body     { padding: 20px; }
.panel__body--flush   { padding: 0; }
.panel__body--centered { display: flex; justify-content: center; }

/* ── Bar row (fisher type breakdown) ─────────────────────────── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.bar-row__label {
  width: 130px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-mid);
  text-transform: capitalize;
  font-weight: 500;
}
.bar-row__track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.bar-row__fill {
  height: 100%;
  background: linear-gradient(to right, var(--ocean), var(--teal));
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.6s ease;
}
.bar-row__count {
  width: 32px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Action badges (audit log event types) ───────────────────── */
.action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.action-badge--fisher  { background: #EFF6FF; color: #1D4ED8; }
.action-badge--vessel  { background: #F0FDF4; color: #166534; }
.action-badge--gear    { background: #FFF7ED; color: #9A3412; }
.action-badge--user    { background: #FDF4FF; color: #7E22CE; }

/* ── Inline ID code (dashboard table) ───────────────────────── */
code.id-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #EFF6FF;
  color: #0E6A9A;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #BFDBFE;
}

/* ── Compliance status badges ────────────────────────────────── */
.compliance-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.compliance-badge--passed   { background: #DCFCE7; color: #166534; }
.compliance-badge--flagged  { background: #FEF9C3; color: #854D0E; }
.compliance-badge--rejected { background: #FEE2E2; color: #991B1B; }

/* Hull marking badge */
.hull-badge--confirmed { color: var(--success); font-size: 11px; font-weight: 600; }
.hull-badge--pending   { color: var(--warning); font-size: 11px; font-weight: 600; }

/* ── Vessel/Gear detail cards ─────────────────────────────────── */
.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.spec-item { background: #F8FAFC; border-radius: 8px; padding: 10px 14px; }
.spec-item__label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.spec-item__value { font-size: 14px; font-weight: 700; color: var(--text-dark); margin-top: 3px; }

/* Compliance result row */
.compliance-result {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  align-items: flex-start;
}
.compliance-result:last-child { border-bottom: none; }
.compliance-result__icon { flex-shrink: 0; margin-top: 1px; }
.compliance-result__pass   { color: var(--success); }
.compliance-result__flag   { color: var(--warning); }
.compliance-result__reject { color: var(--error); }
.compliance-result__msg    { color: var(--text-mid); line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════════
   COMING SOON PAGE
   ═══════════════════════════════════════════════════════════════ */

.coming-soon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 40px 20px;
}

.coming-soon-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 52px 48px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}

.coming-soon-icon  { font-size: 56px; margin-bottom: 16px; }
.coming-soon-title { font-size: 26px; font-weight: 800; color: var(--text-dark); margin: 0 0 10px; }
.coming-soon-sub   { font-size: 14px; color: var(--text-light); line-height: 1.6; margin: 0 0 28px; }

.countdown-label   { font-size: 11px; font-weight: 700; text-transform: uppercase;
                     letter-spacing: 0.1em; color: var(--text-light); margin-bottom: 14px; }

.countdown {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.countdown-unit       { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.countdown-num        { font-size: 36px; font-weight: 800; color: var(--ocean);
                        font-family: 'JetBrains Mono', monospace; line-height: 1.1; }
.countdown-unit-label { font-size: 10px; color: var(--text-light); text-transform: uppercase;
                        letter-spacing: 0.08em; margin-top: 4px; font-weight: 600; }
.countdown-sep        { font-size: 28px; font-weight: 700; color: var(--border);
                        margin-bottom: 16px; }
.countdown-target     { font-size: 12px; color: var(--text-light); }
