/* SBSDispatch — Freight Brokerage (shell aligned with Operations / Admin) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500&display=swap');

:root {
  --gray-base: #e2e3e7;
  --bg: #e0e0e4;
  --main-canvas: #ffffff;
  --surface: #e2e3e7;
  --surface2: #e4e5e9;
  --modal-elevated: #e8e9ed;
  --border: #dedee2;
  --border2: #dcdde0;
  --accent: #f5a623;
  --accent2: #00c9a7;
  --app-primary: #24a0ed;
  --app-primary-hover: #1a8fd0;
  --btn-red: #24a0ed;
  --btn-red-hover: #1a8fd0;
  --nav-chrome-bg: #dedfe2;
  --header-bar-bg: #d8d8db;
  --header-notification-bg: #eef0f5;
  --green: #2ecc71;
  --red: #9a4d52;
  --text: #111111;
  --muted: #5a5d68;
  --muted2: #6d717d;
  --text2: var(--muted);
  --text3: var(--muted2);
  --input-bg: #ffffff;
  --input-text: #111111;
  --font-d: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-b: var(--font-d);
  --font: var(--font-b);
  --mono: var(--font-d);
  --header-h: 56px;
  --nav-w: 220px;
  --scrollbar-thumb: var(--btn-red);
  --scrollbar-track: #f0f2f6;
  --list-zebra-odd: #ffffff;
  --list-zebra-even: #e9ecf2;
  --accent-hover: var(--app-primary-hover);
}

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

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--btn-red-hover);
}

html {
  scrollbar-gutter: stable;
}

body.fr-app {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header (matches dispatcher Operations) ── */
.header {
  background: var(--header-bar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  height: var(--header-h);
  min-height: var(--header-h);
  max-height: var(--header-h);
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: hidden;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.header-brand img {
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-d);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.brand-tag {
  font-family: var(--font-d);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted2);
  border: 1px solid var(--border2);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.header-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  background: var(--header-notification-bg);
  border-radius: 8px;
  padding: 4px 10px;
}
.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted2);
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.3s;
}
.ws-dot.live {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.ws-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
  max-width: min(420px, 55vw);
}
#frLangSelector {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.user-badge {
  background: var(--header-notification-bg);
  border: 1px solid var(--border2);
  padding: 4px 12px 4px 8px;
  border-radius: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(280px, 42vw);
}
.user-badge-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.user-badge-text > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.user-role {
  font-size: 11px;
  color: var(--btn-red);
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--btn-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-d);
  font-weight: 900;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.topbar-btn,
.btn-logout {
  flex-shrink: 0;
  background: var(--btn-red);
  border: 1px solid #1a8fd0;
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-b);
  font-weight: 600;
  transition: all 0.15s;
}
.topbar-btn:hover,
.btn-logout:hover {
  background: var(--btn-red-hover);
  color: #fff;
}

/* ── Shell: nav + main ── */
.fr-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}
.fr-nav {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--nav-chrome-bg);
  border-right: 1px solid var(--border);
  padding: 8px 0;
  overflow-y: auto;
  min-height: 0;
  scrollbar-gutter: stable;
}
.fr-nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
  white-space: nowrap;
  line-height: 1.2;
}
.fr-nav-item:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.05);
}
.fr-nav-item.active {
  color: var(--text);
  border-left-color: var(--btn-red);
  background: rgba(36, 160, 237, 0.12);
  box-shadow: inset 0 0 0 1px rgba(36, 160, 237, 0.2);
}
.fr-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 140px;
  background: var(--main-canvas);
  scrollbar-gutter: stable;
}
.fr-page {
  display: none;
}
.fr-page.active {
  display: block;
}
/* Tall menu pages: scroll within viewport below header */
.fr-page-scroll {
  max-height: calc(100dvh - var(--header-h) - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-gutter: stable;
}
.fr-page-scroll .fr-card + .fr-card {
  margin-top: 14px;
}
#fr-page-management .fr-page-scroll,
#fr-page-management.fr-page-scroll {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
#fr-page-management > #frMgmtUsers,
#fr-page-management > #frMgmtModules {
  margin-top: 14px;
}
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.fr-mgmt-users-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.fr-mgmt-users-head h2 {
  margin-bottom: 4px;
}
.fr-mgmt-grid-wrap {
  overflow-x: auto;
  margin-bottom: 14px;
}
.fr-mgmt-user-grid tbody tr.fr-mgmt-user-row {
  cursor: pointer;
}
.fr-mgmt-check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text);
}
.fr-mgmt-check-row input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--btn-red);
}

/* ── Content blocks ── */
.fr-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.fr-hero h1 {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}
.fr-hero p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text2);
  max-width: 720px;
}
.fr-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.fr-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.fr-kpi-label {
  font-family: var(--font-d);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
  font-weight: 700;
}
.fr-kpi-val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-d);
}
.fr-card {
  background: var(--main-canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.fr-card h2 {
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.fr-muted {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.45;
}
.fr-brand {
  font-family: var(--font-d);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.fr-brand em {
  color: var(--btn-red);
  font-style: normal;
}

/* ── Buttons (SBS brand blue) ── */
.fr-btn {
  font-size: 13px;
  font-family: var(--font-b);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid #1a8fd0;
  background: var(--btn-red);
  cursor: pointer;
  color: #fff;
  transition: all 0.15s;
}
.fr-btn:hover {
  background: var(--btn-red-hover);
  border-color: var(--btn-red-hover);
  color: #fff;
}
.fr-btn-primary {
  background: var(--btn-red);
  border-color: #1a8fd0;
  color: #fff;
}
.fr-btn-primary:hover {
  background: var(--btn-red-hover);
  border-color: var(--btn-red-hover);
  color: #fff;
}
.fr-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.fr-btn-danger {
  background: #fff;
  border-color: #c62828;
  color: #c62828;
}
.fr-btn-danger:hover {
  background: #ffebee;
  border-color: #c62828;
  color: #c62828;
}

.fr-gate {
  max-width: 480px;
  margin: 48px auto;
  text-align: center;
  padding: 28px;
  background: var(--main-canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.fr-gate h1 {
  font-family: var(--font-d);
  font-size: 18px;
  margin-bottom: 10px;
}
.fr-gate p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 16px;
}
.fr-table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
.fr-table th,
.fr-table td {
  width: 1%;
  white-space: nowrap;
  padding: 5px 7px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.fr-table th {
  font-family: var(--font-d);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  font-weight: 700;
  vertical-align: bottom;
  padding-bottom: 4px;
}
.fr-table tbody tr:nth-child(odd) td {
  background: var(--list-zebra-odd);
}
.fr-table tbody tr:nth-child(even) td {
  background: var(--list-zebra-even);
}
.fr-table tbody tr:hover td {
  background: rgba(36, 160, 237, 0.1);
}
.fr-mono {
  font-family: var(--font-d);
  font-size: 12px;
}
.fr-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e8ecf0;
  color: var(--text2);
}
.fr-pill-ok {
  background: #dcfce7;
  color: #166534;
}
.fr-pill-warn {
  background: #fef3c7;
  color: #92400e;
}
.fr-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 16px;
  margin-bottom: 4px;
}
.fr-form-span-2 {
  grid-column: 1 / -1;
}
.fr-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 4px;
}
.fr-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.fr-form-grid input,
.fr-form-grid select,
.fr-form-grid textarea,
.fr-field-block textarea,
.fr-textarea {
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-b);
  background: var(--input-bg);
  color: var(--input-text);
  width: 100%;
}
.fr-form-grid textarea,
.fr-textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}
.fr-field-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.fr-input-narrow {
  max-width: 72px;
}
.fr-form-grid input:focus,
.fr-form-grid select:focus,
.fr-form-grid textarea:focus,
.fr-textarea:focus {
  outline: none;
  border-color: var(--btn-red);
  box-shadow: 0 0 0 2px rgba(36, 160, 237, 0.28);
}
.fr-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.fr-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.fr-detail-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.fr-stop-list {
  margin: 8px 0 0 18px;
  font-size: 13px;
  color: var(--text2);
}
.fr-key {
  display: block;
  word-break: break-all;
  background: var(--header-notification-bg);
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 6px;
}
.fr-ok {
  color: var(--green);
  font-size: 13px;
}
.fr-err {
  color: var(--red);
  font-size: 13px;
}
.fr-card + .fr-card {
  margin-top: 14px;
}
.fr-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.fr-toolbar select {
  padding: 6px 8px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-b);
  background: var(--input-bg);
}
.fr-toast {
  position: fixed;
  bottom: 130px;
  right: 20px;
  max-width: 360px;
  padding: 12px 16px;
  background: #1a1d24;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}
.fr-toast-show {
  opacity: 1;
}
.fr-toast-err {
  background: var(--red);
}
.fr-detail-actions {
  margin: 12px 0;
}

/* ── SBS footer (copyright, legal, social) ── */
.zc-copy-bar a {
  color: var(--btn-red);
  text-decoration: none;
  font-weight: 600;
}
.zc-copy-bar a:hover {
  text-decoration: underline;
}
.zc-copy-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  padding: 6px 12px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  max-height: 28vh;
  overflow-y: auto;
}
body.fr-app .zc-copy-bar .zc-legal-strip {
  display: none !important;
}
.zc-legal-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.zc-legal-strip a {
  color: var(--btn-red);
  text-decoration: none;
}
.zc-legal-strip a:hover {
  text-decoration: underline;
}
.zc-legal-strip span[aria-hidden='true'] {
  color: var(--border);
  user-select: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar {
  padding: 2px 4px 4px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  width: 100%;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-label {
  display: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-links {
  gap: 4px 6px;
  flex-wrap: nowrap;
  font-size: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-links::-webkit-scrollbar {
  display: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-links a {
  color: var(--btn-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0;
  line-height: 0;
  flex-shrink: 0;
  text-decoration: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-links a:hover {
  background: rgba(36, 160, 237, 0.12);
  text-decoration: none;
}
body.fr-app #zc-connect-with-us.zc-connect-with-us--in-bar .zc-connect-links a svg {
  display: block;
}

.fr-suite-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.fr-suite-panel {
  display: none;
}
.fr-suite-panel.active {
  display: block;
}
.fr-suite-tab.active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* ── Section titles & result panels (match Operations) ── */
.fr-card h3,
.fr-section-title {
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text);
}
.fr-result-panel {
  background: var(--header-notification-bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

/* ── Portal & public pages (shipper / carrier / track) ── */
body.fr-portal {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 48px;
}
body.fr-portal .fr-card {
  background: var(--main-canvas);
}
body.fr-portal a.sp-link,
body.fr-portal a.fr-link {
  color: var(--btn-red);
  text-decoration: none;
  font-weight: 600;
}
body.fr-portal a.sp-link:hover,
body.fr-portal a.fr-link:hover {
  text-decoration: underline;
}
.fr-track-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
#frMap {
  height: 360px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  margin: 16px 0;
  background: var(--surface);
}
.fr-track-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.fr-timeline {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.fr-timeline li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text2);
}

/* Standalone labels outside .fr-form-grid (carrier portal) */
.fr-portal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.fr-portal-field input {
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 14px;
  background: var(--input-bg);
  color: var(--input-text);
}
.fr-portal-field input:focus {
  outline: none;
  border-color: var(--btn-red);
  box-shadow: 0 0 0 2px rgba(36, 160, 237, 0.28);
}

/* ── Ghost button + user modal (Admin-aligned) ── */
.fr-btn-ghost {
  background: var(--main-canvas);
  border-color: var(--border2);
  color: var(--text);
}
.fr-btn-ghost:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.fr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(165, 168, 180, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.fr-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.fr-modal {
  background: var(--modal-elevated);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 22px 24px;
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.18s;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.fr-overlay.open .fr-modal {
  transform: none;
}
.fr-modal-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.fr-modal-title {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.fr-modal-title em {
  color: var(--btn-red);
  font-style: italic;
}
.fr-modal-x {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.fr-modal-x:hover {
  color: var(--btn-red);
  border-color: rgba(36, 160, 237, 0.5);
}
.fr-modal-save-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(154, 77, 82, 0.12);
  border: 1px solid rgba(154, 77, 82, 0.35);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.fr-fg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fr-fld {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.fr-fld label {
  font-family: var(--font-d);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
  font-weight: 700;
}
.fr-fld-opt,
.fr-fld-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted2);
  font-size: 10px;
}
.fr-fld input,
.fr-fld select {
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-b);
  background: var(--input-bg);
  color: var(--input-text);
  width: 100%;
}
.fr-fld input:focus,
.fr-fld select:focus {
  outline: none;
  border-color: var(--btn-red);
  box-shadow: 0 0 0 2px rgba(36, 160, 237, 0.28);
}
.fr-fld-full {
  grid-column: 1 / -1;
}
.fr-pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.fr-pwd-wrap input {
  flex: 1;
  padding-right: 36px;
}
.fr-pwd-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 4px;
}
.fr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.fr-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--border2);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.fr-toggle-track.on {
  background: var(--accent2);
}
.fr-toggle-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: left 0.2s;
}
.fr-toggle-track.on .fr-toggle-thumb {
  left: 19px;
}
.fr-toggle-lbl {
  font-size: 12px;
  color: var(--muted);
  min-width: 2em;
}
.fr-modal-user .fr-mu-modal-hd {
  flex-wrap: nowrap;
  gap: 6px 10px;
  align-items: center;
}
.fr-modal-user .fr-mu-modal-hd .fr-modal-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.fr-mu-hd-active {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.fr-mu-hd-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fr-mu-toggle-label {
  font-family: var(--font-d);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted2);
  white-space: nowrap;
}
.fr-modal-user .fr-mu-user-fg {
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 0.95fr);
  gap: 10px;
}
.fr-modal-user .fr-mu-user-fg > .fr-fld-full,
.fr-modal-user .fr-mu-user-fg > .fr-mu-toggle-row-inline {
  grid-column: 1 / -1;
}
.fr-modal-user .fr-mu-row-name-phone:nth-child(1) {
  grid-column: 1;
}
.fr-modal-user .fr-mu-row-name-phone:nth-child(2) {
  grid-column: 2;
}
.fr-modal-user #frMuChangePwdSection,
.fr-modal-user #frMuPwdField {
  grid-column: 1;
}
.fr-modal-user .fr-fld.fr-mu-row-pwd-tz:not(#frMuChangePwdSection):not(#frMuPwdField) {
  grid-column: 2;
}
.fr-mu-toggle-row-inline {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 20px;
  padding: 4px 0;
}
.fr-mu-toggle-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fr-mu-unit-item {
  margin-left: auto;
}
.fr-mu-unit-switch {
  display: inline-flex;
  border: 1px solid var(--border2);
  border-radius: 6px;
  overflow: hidden;
}
.fr-mu-unit-opt {
  padding: 4px 12px;
  font-family: var(--font-d);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--input-bg);
  border: none;
  cursor: pointer;
  color: var(--muted2);
}
.fr-mu-unit-opt.on {
  background: var(--accent2);
  color: #0a1628;
}
.fr-mu-unit-opt:hover:not(.on) {
  background: var(--surface2);
}
.fr-mu-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  :root {
    --header-h: 52px;
    --nav-w: 100%;
  }
  .header {
    padding: 0 10px;
    gap: 8px;
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    max-height: none;
    padding-top: env(safe-area-inset-top, 0);
  }
  .header-brand {
    flex: 1 1 auto;
    min-width: 0;
  }
  .logo-text {
    font-size: 15px;
    letter-spacing: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-tag {
    display: none;
  }
  .header-mid {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
  }
  .header-user {
    gap: 6px;
    max-width: none;
    flex: 0 1 auto;
  }
  .user-badge {
    max-width: min(160px, 38vw);
    padding: 3px 8px 3px 6px;
    font-size: 12px;
  }
  .user-badge-text > span:first-child {
    font-size: 12px;
  }
  .user-role {
    font-size: 10px;
  }
  .btn-logout {
    padding: 5px 8px;
    font-size: 11px;
  }
  .fr-shell {
    flex-direction: column;
    min-height: 0;
  }
  .fr-nav {
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px;
    gap: 4px;
    scrollbar-width: none;
  }
  .fr-nav::-webkit-scrollbar {
    display: none;
  }
  .fr-nav-item {
    flex: 0 0 auto;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.35);
  }
  .fr-nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--btn-red);
    background: rgba(36, 160, 237, 0.14);
  }
  .fr-main {
    min-height: 0;
    overflow: auto;
  }
  .fr-page-scroll {
    padding: 12px;
  }
  .fr-hero {
    padding: 12px 0 10px;
  }
  .fr-hero h1 {
    font-size: 1.35rem;
  }
  .fr-hero p {
    font-size: 13px;
  }
  .fr-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .fr-kpi {
    padding: 10px;
  }
  .fr-kpi-val {
    font-size: 1.25rem;
  }
  .fr-form-grid {
    grid-template-columns: 1fr;
  }
  .fr-card {
    padding: 12px;
  }
  .fr-table-wrap,
  .fr-page-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .fr-table {
    min-width: 520px;
  }
  .fr-detail-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .fr-form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .fr-form-actions .btn,
  .fr-form-actions button {
    width: 100%;
  }
  .fr-kanban-col {
    min-width: min(240px, 78vw);
    flex: 0 0 min(240px, 78vw);
  }
}

@media (max-width: 480px) {
  .header-user .user-badge {
    display: none;
  }
  .fr-kpi-row {
    grid-template-columns: 1fr;
  }
  .logo-text {
    font-size: 14px;
  }
}
