/* Royal Fleet shell identity. Physical shell placement stays stable across languages. */
:root {
  --royal-gold: #C69E48;
  --royal-gold-ink: #C69E48;
  --royal-gold-soft: rgba(198, 158, 72, .13);
  --royal-gold-border: rgba(198, 158, 72, .46);
}

html[data-theme="dark"] {
  --bg: #11150f;
  --bg-soft: #171a12;
  --panel: #1d2118;
  --panel-2: #25291e;
  --panel-3: #2c3023;
  --border: #494936;
  --border-strong: #6e6748;
  --text: #f7f3e9;
  --text-soft: #e6deca;
  --text-dim: #bbb39f;
  --accent: var(--royal-gold);
  --accent-soft: var(--royal-gold-soft);
  --accent-border: var(--royal-gold-border);
  --ok: #49d892;
  --warn: #f0bd56;
  --err: #ff8e8e;
  --info: #84bcec;
}

html[data-theme="light"] {
  --royal-gold-ink: #705116;
  --bg: #f7f4ed;
  --bg-soft: #eee9dc;
  --panel: #fffdf8;
  --panel-2: #f6f1e6;
  --panel-3: #ece4d2;
  --border: #d8cdb5;
  --border-strong: #b6a57f;
  --text: #29251c;
  --text-soft: #464035;
  --text-dim: #6d6557;
  --accent: var(--royal-gold);
  --accent-soft: rgba(198, 158, 72, .16);
  --accent-border: rgba(126, 91, 22, .48);
  --ok: #087649;
  --warn: #865a12;
  --err: #a63232;
  --info: #236ea0;
}

.topbar {
  direction: ltr;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border-bottom-color: var(--accent-border);
}

.topbar-start {
  order: 2;
  direction: ltr;
  min-width: 0;
}

.topbar-end {
  order: 1;
  direction: ltr;
  min-width: 0;
}

.brand {
  direction: ltr;
  min-width: 0;
}

.brand-fleet-logo-frame {
  position: relative;
  display: block;
  width: 138px;
  height: 46px;
  flex: 0 0 138px;
  overflow: hidden;
}

.brand-fleet-logo {
  position: absolute;
  display: block;
  width: 182px;
  max-width: none;
  height: auto;
}

html[data-ui-language="en"] .brand-fleet-logo {
  left: -22px;
  top: -33px;
}

html[data-ui-language="ar"] .brand-fleet-logo {
  left: -18px;
  top: -30px;
}

.brand-copy {
  direction: ltr;
  text-align: left;
}

.brand-copy .logo {
  color: var(--text);
}

.brand-copy small,
.top-user-copy,
.ui-display-controls {
  direction: var(--ui-text-direction, ltr);
}

html[lang="ar"] {
  --ui-text-direction: rtl;
}

html[lang="en"] {
  --ui-text-direction: ltr;
}

.app-shell {
  direction: ltr;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  direction: ltr;
  border-left: 1px solid var(--border);
  border-right: 0;
}

.sidebar-profile-copy,
.sidebar-search input,
.sidebar-section-label,
.sidebar-nav .nav-copy,
.sidebar-system-status > div {
  direction: var(--ui-text-direction, ltr);
  text-align: start;
}

.main-content {
  grid-column: 1;
  grid-row: 1;
  direction: var(--ui-text-direction, ltr);
}

.royal-auth-page .main-content {
  direction: var(--ui-text-direction, ltr);
}

.ui-display-controls button:hover,
.ui-display-controls button:focus-visible,
.top-logout-btn:hover,
.sidebar-nav a.active {
  border-color: var(--accent-border);
}

.ui-display-controls button:focus-visible,
.top-logout-btn:focus-visible,
.mobile-menu-btn:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--royal-gold);
  outline-offset: 3px;
}

.sidebar-nav a.active .nav-icon {
  background: var(--royal-gold-soft);
  color: var(--royal-gold-ink);
}

html[data-theme="light"] .sidebar-profile-avatar,
html[data-theme="light"] .ui-eyebrow,
html[data-theme="light"] .sector-planner .sector-route {
  color: var(--royal-gold-ink) !important;
}

.utility-check [data-state="ok"],
.sector-planner .sector-saved {
  color: var(--ok);
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar,
  html[dir="ltr"] .sidebar,
  html[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    transform: translateX(105%);
  }

  body.sidebar-open .sidebar,
  html[dir="ltr"] body.sidebar-open .sidebar,
  html[dir="rtl"] body.sidebar-open .sidebar {
    transform: translateX(0);
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
  }

  .topbar-start,
  .topbar-end {
    gap: 7px;
  }

  .top-user-copy {
    display: none;
  }

  .brand-copy small {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 5px;
  }

  .brand-fleet-logo-frame {
    width: 74px;
    height: 44px;
    flex-basis: 74px;
  }

  .brand-copy {
    display: none;
  }

  .ui-display-controls {
    gap: 5px;
  }

  .ui-display-controls button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
    white-space: nowrap;
  }

  [data-ui-language-toggle]::before,
  [data-ui-theme]::before {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
  }

  html[lang="en"] [data-ui-language-toggle]::before {
    content: "ع";
    font-size: 17px;
  }

  html[lang="ar"] [data-ui-language-toggle]::before {
    content: "EN";
  }

  [data-ui-theme][data-current-theme="dark"]::before {
    content: "☀";
    font-size: 17px;
  }

  [data-ui-theme][data-current-theme="light"]::before {
    content: "☾";
    font-size: 19px;
  }

  .top-user {
    display: none;
  }

  .top-logout-btn {
    max-width: 54px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .topbar {
    padding-inline: 7px;
  }

  .mobile-menu-btn,
  .ui-display-controls button {
    width: 34px;
    min-width: 34px;
  }

  .top-logout-btn {
    max-width: 46px;
    padding-inline: 6px;
  }
}

@media print {
  .topbar {
    direction: ltr;
  }
}
