/* Elegance CRM 1 — bright, mobile-first visual system */
:root,
[data-theme="light"] {
  --primary: #e86f19;
  --primary-light: #f7934d;
  --primary-dark: #bd4e08;
  --primary-soft: #fff1e7;
  --bg: #f7f7f5;
  --bg-card: #ffffff;
  --bg-surface: #f4f2ee;
  --bg-hover: #eeece7;
  --text: #17202a;
  --text-secondary: #5e6874;
  --text-muted: #9299a2;
  --border: rgba(23, 32, 42, 0.085);
  --border-light: rgba(23, 32, 42, 0.13);
  --success: #1d9a6c;
  --danger: #df4b50;
  --warning: #d99120;
  --info: #3978c5;
  --shadow-xs: 0 1px 2px rgba(23, 32, 42, 0.04);
  --shadow-sm: 0 6px 20px rgba(23, 32, 42, 0.055);
  --shadow-md: 0 18px 48px rgba(23, 32, 42, 0.09);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

html,
body {
  font-family: "DM Sans", "Tajawal", sans-serif;
  background:
    radial-gradient(circle at 92% 4%, rgba(232, 111, 25, 0.06), transparent 24rem),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background-image: radial-gradient(rgba(23, 32, 42, 0.035) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent 42%);
}

.font-display,
.page-title,
.page-heading,
.page-heading--compact,
.stat-value {
  font-family: "Manrope", "Tajawal", sans-serif;
  letter-spacing: -0.035em;
}

#appMain {
  background: transparent;
}

/* Login */
.login-page {
  display: grid;
  grid-template-columns: minmax(420px, 1.12fr) minmax(420px, 0.88fr);
  gap: 0;
  padding: 18px;
  background: #f7f7f5;
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(38px, 6vw, 86px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 82% 15%, rgba(255, 210, 165, 0.36), transparent 28%),
    radial-gradient(circle at 10% 95%, rgba(255, 255, 255, 0.13), transparent 32%),
    linear-gradient(145deg, #ff9b52 0%, #e56712 48%, #b64709 100%);
  border-radius: 30px;
  box-shadow: 0 28px 70px rgba(168, 66, 5, 0.22);
}

.login-story::before,
.login-story::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.login-story::before {
  right: -12vw;
  bottom: -15vw;
  width: 38vw;
  height: 38vw;
}

.login-story::after {
  right: -5vw;
  bottom: -8vw;
  width: 24vw;
  height: 24vw;
}

.login-story__mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-family: "Playfair Display", serif;
  font-size: 28px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  backdrop-filter: blur(12px);
}

.login-story__copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.login-story__eyebrow {
  display: block;
  margin-bottom: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  opacity: 0.78;
}

.login-story h2 {
  max-width: 600px;
  font-family: "Manrope", sans-serif;
  font-size: clamp(42px, 5.5vw, 76px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.login-story p {
  max-width: 500px;
  margin-top: 24px;
  font-size: 16px;
  line-height: 1.7;
  opacity: 0.78;
}

.login-story__status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.login-story__status-dot {
  width: 8px;
  height: 8px;
  background: #c8ffde;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.1);
}

.login-panel {
  align-self: center;
  width: min(440px, calc(100% - 52px));
  margin: auto;
  padding: 44px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.login-brand {
  margin-bottom: 34px;
  text-align: left;
}

.login-brand .logo-shell--lg {
  margin: 0 0 22px;
  background: var(--primary-soft);
}

.login-title {
  font-family: "Manrope", sans-serif;
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.login-subtitle {
  margin-top: 7px;
  line-height: 1.5;
}

.field-label {
  margin-bottom: 7px;
  color: #38424d;
  font-size: 12px;
  font-weight: 700;
}

.login-panel .input {
  min-height: 50px;
  padding-inline: 15px;
  background: #fbfaf8;
  border-color: rgba(23, 32, 42, 0.1);
  border-radius: 13px;
}

.login-panel .btn-primary {
  min-height: 52px;
  margin-top: 4px;
  border-radius: 13px;
  box-shadow: 0 12px 26px rgba(232, 111, 25, 0.25);
}

/* Navigation shell */
.sidebar {
  width: 272px;
  min-width: 272px;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid rgba(23, 32, 42, 0.07);
  box-shadow: 10px 0 35px rgba(23, 32, 42, 0.025);
  backdrop-filter: blur(18px);
}

.sidebar-brand {
  min-height: 82px;
  gap: 13px;
  padding: 18px 20px;
  border-bottom: 0;
}

.sidebar-brand .logo-shell--sm {
  width: 42px;
  height: 42px;
  background: linear-gradient(145deg, #fff4ea, #ffe4d1);
  border: 1px solid rgba(232, 111, 25, 0.12);
  border-radius: 14px;
}

.shell-title {
  font-family: "Manrope", "Tajawal", sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.shell-subtitle {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 4px 12px 18px;
}

.sidebar-section-label {
  padding: 18px 12px 7px;
  color: #a0a6ad;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-item {
  position: relative;
  min-height: 42px;
  gap: 11px;
  margin: 2px 0;
  padding: 10px 12px;
  color: #66717d;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-item:hover {
  color: #2f3944;
  background: #f7f5f1;
  transform: translateX(2px);
}

.sidebar-item.active {
  color: #c9520d;
  background: linear-gradient(135deg, #fff3e9, #ffeadb);
  border-color: rgba(232, 111, 25, 0.12);
  box-shadow: 0 6px 16px rgba(232, 111, 25, 0.08);
}

.sidebar-item.active::after {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 5px;
  height: 5px;
  content: "";
  background: var(--primary);
  border-radius: 50%;
  transform: translateY(-50%);
}

.sidebar-footer {
  margin: 8px 12px 12px;
  padding: 11px;
  background: #faf9f7;
  border: 1px solid var(--border);
  border-radius: 15px;
}

.avatar-chip {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, var(--primary), #f6a15f);
  box-shadow: 0 6px 14px rgba(232, 111, 25, 0.2);
}

.sidebar-action {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.sidebar-action:hover {
  color: var(--danger);
  background: rgba(223, 75, 80, 0.08);
}

/* Header */
.topbar {
  min-height: 70px;
  padding: 10px 26px;
  background: rgba(247, 247, 245, 0.86);
  border-bottom: 1px solid rgba(23, 32, 42, 0.055);
  backdrop-filter: blur(18px) saturate(145%);
}

.topbar-toggle,
.topbar-notification {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #5f6974;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
}

.topbar-context {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 3px;
}

.topbar-context__eyebrow {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-context strong {
  overflow: hidden;
  margin-top: 2px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-utility-button {
  height: 40px;
  color: #2767b2;
  background: #eef6ff;
  border-color: #dceaf9;
  border-radius: 12px;
}

.topbar-notification__badge {
  border-color: #f7f7f5;
}

.topbar-status {
  padding-left: 3px;
}

.status-dot {
  box-shadow: 0 0 0 4px rgba(29, 154, 108, 0.1);
}

/* Content and cards */
.main-content {
  min-width: 0;
  background: transparent;
}

.page,
.page-compact {
  padding: clamp(18px, 2.2vw, 32px);
}

.page-title,
.page-heading,
.page-heading--compact {
  color: #17202a;
  font-weight: 800;
}

.page-title {
  margin-bottom: 24px;
  font-size: clamp(22px, 2.2vw, 30px);
}

.page-heading,
.page-heading--compact {
  font-size: clamp(21px, 2vw, 27px);
}

.page-subtitle {
  max-width: 760px;
  color: #7a838d;
  line-height: 1.55;
}

.page-header {
  margin-bottom: 22px;
}

.card,
.statement-card,
.arrival-departure-summary__card,
.company-cost-card,
.operation-costs-section,
.settings-section,
.partner-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 32, 42, 0.075);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card {
  padding: 22px;
}

.dashboard-card {
  min-height: 146px;
  border-radius: 19px;
}

.dashboard-card::after {
  position: absolute;
  right: -28px;
  bottom: -42px;
  width: 110px;
  height: 110px;
  content: "";
  background: radial-gradient(circle, rgba(232, 111, 25, 0.09), transparent 68%);
  border-radius: 50%;
}

.dashboard-card__icon {
  width: 42px;
  height: 42px;
  background: var(--primary-soft) !important;
  border-radius: 13px;
}

.dashboard-card--interactive:hover,
.card:hover {
  border-color: rgba(232, 111, 25, 0.18);
  box-shadow: 0 16px 38px rgba(23, 32, 42, 0.08);
}

.section-title {
  color: #26313c;
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dashboard-stats-grid {
  gap: 16px;
}

.dashboard-panels-grid {
  gap: 16px;
}

.home-hero,
.operation-costs-hero,
.company-costs-hero {
  border-radius: 22px;
}

.home-rank-row--border {
  border-bottom-color: rgba(23, 32, 42, 0.06);
}

/* Controls */
.btn {
  min-height: 41px;
  padding: 9px 15px;
  font-weight: 700;
  border-radius: 11px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(145deg, #f08335, #dc5d0b);
  box-shadow: 0 8px 18px rgba(232, 111, 25, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(145deg, #e97827, #c95109);
  box-shadow: 0 11px 24px rgba(232, 111, 25, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(23, 32, 42, 0.1);
  box-shadow: var(--shadow-xs);
}

.btn-danger {
  background: linear-gradient(145deg, #ec6368, #cf3f45);
}

.input {
  min-height: 41px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(23, 32, 42, 0.1);
  border-radius: 11px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.input:hover {
  border-color: rgba(23, 32, 42, 0.17);
}

.input:focus {
  background: #fff;
  border-color: rgba(232, 111, 25, 0.58);
  box-shadow: 0 0 0 4px rgba(232, 111, 25, 0.1);
}

.search-input {
  min-width: 250px;
  background: rgba(255, 255, 255, 0.86);
}

.search-box > input.search-input {
  padding-inline-start: 36px;
}

.search-box > .search-icon {
  pointer-events: none;
}

.badge,
.status-chip {
  border-radius: 999px;
}

/* Data surfaces */
.table-shell,
div[style*="overflow:auto"]:has(.sheet-table),
div[style*="overflow: auto"]:has(.sheet-table) {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(23, 32, 42, 0.08);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.sheet-table {
  color: #34404b;
}

.sheet-table th {
  height: 42px;
  color: #7b8590;
  font-size: 10px;
  font-weight: 800;
  background: #f8f7f4;
  border-color: rgba(23, 32, 42, 0.065);
}

.sheet-table td {
  height: 42px;
  border-color: rgba(23, 32, 42, 0.06);
}

.sheet-table tbody tr:nth-child(even) td {
  background-color: rgba(248, 247, 244, 0.45);
}

.sheet-table tr:hover td {
  background-color: #fff7f0;
}

#bookingsTable .sheet-table th.col-booking-id,
#bookingsTable .sheet-table td[data-field="bookingId"] {
  box-shadow: 4px 0 12px rgba(23, 32, 42, 0.04);
}

.table-loading-note {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

/* Overlays */
.modal-overlay {
  background: rgba(23, 32, 42, 0.34) !important;
  backdrop-filter: blur(8px);
}

.modal {
  background: #fff;
  border-color: rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  box-shadow: 0 34px 90px rgba(23, 32, 42, 0.22);
}

.notification-dropdown {
  border-color: rgba(23, 32, 42, 0.08);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(23, 32, 42, 0.16);
}

.notification-item {
  background: linear-gradient(135deg, #faf9f7, #fffaf6);
  border-radius: 14px;
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 13px;
  box-shadow: 0 18px 48px rgba(23, 32, 42, 0.18);
}

.mobile-dock {
  display: none;
}

@media (min-width: 761px) {
  .mobile-dock {
    display: none !important;
  }
}

/* Preserve optional dark modes while the bright system remains the default. */
[data-theme="dark"],
[data-theme="ultra"] {
  --primary-soft: rgba(232, 111, 25, 0.13);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 22px 56px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .page-title,
[data-theme="dark"] .page-heading,
[data-theme="dark"] .page-heading--compact,
[data-theme="ultra"] .page-title,
[data-theme="ultra"] .page-heading,
[data-theme="ultra"] .page-heading--compact {
  color: var(--text);
}

[data-theme="dark"] .topbar,
[data-theme="ultra"] .topbar {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

[data-theme="dark"] .topbar-toggle,
[data-theme="dark"] .topbar-notification,
[data-theme="ultra"] .topbar-toggle,
[data-theme="ultra"] .topbar-notification,
[data-theme="dark"] .sidebar,
[data-theme="ultra"] .sidebar,
[data-theme="dark"] .sidebar-footer,
[data-theme="ultra"] .sidebar-footer,
[data-theme="dark"] .input,
[data-theme="ultra"] .input {
  background: var(--bg-card);
}

@media (max-width: 1180px) {
  .sidebar {
    width: min(88vw, 330px);
    max-width: 330px;
    border-radius: 0 22px 22px 0;
    box-shadow: 28px 0 70px rgba(23, 32, 42, 0.18);
  }

  .topbar {
    min-height: 66px;
    padding-inline: 16px;
  }
}

@media (max-width: 760px) {
  body::before {
    opacity: 0.6;
  }

  .login-page {
    display: flex;
    align-items: center;
    min-height: 100dvh;
    padding: 16px;
    background:
      radial-gradient(circle at 85% 0%, rgba(232, 111, 25, 0.16), transparent 42%),
      #f7f7f5;
  }

  .login-story {
    display: none;
  }

  .login-panel {
    width: 100%;
    max-width: 440px;
    padding: 30px 24px;
    border-radius: 24px;
  }

  .login-brand {
    text-align: center;
  }

  .login-brand .logo-shell--lg {
    margin-inline: auto;
  }

  .main-content {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 62px;
    padding: 8px 11px;
  }

  .topbar-toggle,
  .topbar-notification {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .topbar-context__eyebrow,
  .topbar-status,
  .topbar-utility-button span {
    display: none;
  }

  .topbar-context strong {
    max-width: 118px;
    font-size: 13px;
  }

  .topbar-utility-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .page,
  .page-compact {
    padding: 18px 12px 24px;
  }

  .page-title {
    margin-bottom: 18px;
  }

  .page-header,
  .page-header--wrap {
    gap: 9px;
    margin-bottom: 18px;
  }

  .page-header > div:first-child,
  .page-header--wrap > div:first-child {
    width: 100%;
  }

  .card {
    padding: 17px;
    border-radius: 15px;
  }

  .dashboard-stats-grid,
  .dashboard-panels-grid,
  .dashboard-panels-grid--bottom {
    gap: 12px;
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-card {
    min-height: 132px;
  }

  .dashboard-card__icon {
    width: 38px;
    height: 38px;
  }

  .stat-value {
    font-size: 24px;
  }

  .grid-auto-300,
  .grid-auto-320,
  .statement-card-grid,
  .arrival-departure-summary {
    grid-template-columns: 1fr;
  }

  .btn,
  .input {
    min-height: 46px;
    border-radius: 12px;
  }

  .search-input {
    min-width: 0;
  }

  .table-shell,
  div[style*="overflow:auto"]:has(.sheet-table),
  div[style*="overflow: auto"]:has(.sheet-table) {
    max-height: calc(100dvh - 225px);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(23, 32, 42, 0.07);
  }

  .sheet-table th,
  .sheet-table td {
    height: 45px;
  }

  .modal-overlay {
    padding: 0 !important;
  }

  .modal {
    align-self: flex-end;
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }

  .notification-dropdown {
    top: 62px;
    right: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 150px);
  }

  .mobile-dock {
    position: fixed;
    right: 10px;
    bottom: max(9px, env(safe-area-inset-bottom));
    left: 10px;
    z-index: 44;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 64px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(23, 32, 42, 0.09);
    border-radius: 21px;
    box-shadow: 0 18px 48px rgba(23, 32, 42, 0.18);
    backdrop-filter: blur(20px) saturate(150%);
  }

  .mobile-dock__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    color: #87909a;
    font-family: inherit;
    font-size: 9px;
    font-weight: 700;
    background: transparent;
    border: 0;
    border-radius: 14px;
  }

  .mobile-dock__item svg {
    width: 19px;
    height: 19px;
  }

  .mobile-dock__item.active {
    color: #c9520d;
    background: #fff2e8;
  }

  .mobile-dock__item--primary {
    position: relative;
    color: #fff;
    background: linear-gradient(145deg, #f08335, #dc5d0b);
    box-shadow: 0 8px 18px rgba(232, 111, 25, 0.25);
  }

  .mobile-dock__item--primary.active {
    color: #fff;
    background: linear-gradient(145deg, #f08335, #dc5d0b);
  }

  [data-theme="dark"] .mobile-dock,
  [data-theme="ultra"] .mobile-dock {
    background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  }
}

@media (max-width: 420px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card {
    min-height: 122px;
  }

  .topbar-context strong {
    max-width: 90px;
  }

  .mobile-dock {
    right: 7px;
    left: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Keep Safari/WebKit booking forms on one stable scroll layer. Full-screen
   backdrop blur plus nested kinetic scrolling can black out during keyboard
   viewport changes on iPhone/iPad. */
@media (max-width: 1180px) {
  .modal-overlay {
    overflow: hidden !important;
    background: rgba(23, 32, 42, 0.42) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .modal {
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@supports (-webkit-touch-callout: none) {
  .modal-overlay {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

.modal-overlay--webkit-safe {
  background: rgba(23, 32, 42, 0.42) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
