:root {
  --bg-1: #082447;
  --bg-2: #0f4f7a;
  --ink: #173553;
  --ink-soft: #526f89;
  --surface: #f8fbff;
  --line: #d6e2ee;
  --primary: #1e67d2;
  --primary-dark: #0f4db0;
  --danger: #bf2b31;
  --warn: #cb7300;
  --ok: #2c8f46;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: #dbe8f5;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  background:
    radial-gradient(circle at 6% 14%, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0.18) 9rem, transparent 9rem),
    radial-gradient(circle at 88% 90%, rgba(90, 198, 230, 0.2) 0, rgba(90, 198, 230, 0.2) 10rem, transparent 10rem),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.window-bar {
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: rgba(9, 48, 84, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  padding: 0;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  image-rendering: auto;
  filter: saturate(0.96) contrast(0.95) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.28));
  transform: scale(1);
}

.window-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-btn {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  height: 34px;
  border-radius: 18px;
  padding: 0 10px;
  font-weight: 600;
}

.pill-code {
  margin-left: 6px;
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
}

.app-pill {
  height: 34px;
  border-color: rgba(255, 255, 255, 0.25);
}

.login-main {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 600px;
  background: rgba(246, 251, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  box-shadow: 0 22px 36px rgba(2, 14, 27, 0.35);
  padding: 28px;
}

.login-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.logo-badge {
  width: 72px;
  height: 72px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  padding: 0;
}

.logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: saturate(0.96) contrast(0.95) drop-shadow(0 2px 8px rgba(4, 23, 44, 0.24));
  transform: scale(1);
}

.logo-badge.small {
  width: 56px;
  height: 56px;
  border-radius: 0;
  padding: 0;
}

h1,
h2,
h3 {
  margin: 0;
}

.login-title-row h1 {
  font-size: 44px;
  color: #14355a;
  line-height: 1.05;
}

.login-title-row p {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 700;
  color: #1d4870;
  line-height: 1.15;
}

.login-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #244665;
  font-weight: 600;
  font-size: 14px;
}

input,
select {
  height: 44px;
  border: 1px solid #bfd2e6;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  color: #133857;
  background: #fff;
}

input:focus,
select:focus {
  outline: none;
  border-color: #5d9ef8;
  box-shadow: 0 0 0 3px rgba(30, 103, 210, 0.15);
}

.primary-btn,
.danger-btn,
.ghost-btn {
  height: 44px;
  border: 0;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 16px;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.danger-btn {
  color: #fff;
  background: linear-gradient(135deg, #cc3b42, #ac1e26);
}

.ghost-btn {
  color: #1d4f80;
  border: 1px solid #c4d8ec;
  background: #edf5ff;
}

.primary-btn:disabled,
.danger-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.error-text {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-view {
  min-height: 100vh;
  background: linear-gradient(160deg, #f2f7fd 0%, #e4eef8 40%, #d4e3f2 100%);
}

.app-header {
  height: 54px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  background: linear-gradient(135deg, #113b65, #1a4e80);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-chip {
  height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: min(520px, 46vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.hero-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.hero-card h2 {
  color: #14375c;
  font-size: 35px;
  font-weight: 800;
}

.hero-card p {
  margin: 4px 0 0;
  color: #40617f;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  height: 40px;
  border: 1px solid #c9d9e8;
  background: #eef4fb;
  color: #2a4e72;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  background: #fff;
  border-color: #a7c4e2;
}

.panel {
  display: none;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.panel.active {
  display: block;
}

.panel h3 {
  font-size: 38px;
  margin-bottom: 10px;
  color: #16385d;
}

.gate-search-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.gate-search-row span {
  font-size: 14px;
  color: #395c7d;
  font-weight: 700;
  text-align: center;
}

.gate-alert {
  border-radius: 18px;
  padding: 18px 20px;
  color: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  min-height: 180px;
}

.gate-alert strong {
  font-size: 42px;
  display: block;
  margin-bottom: 6px;
}

.gate-alert p {
  margin: 0 0 6px;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.2;
}

.gate-icon {
  width: 90px;
  height: 90px;
  border-radius: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  font-size: 54px;
}

.gate-alert.none {
  background: linear-gradient(160deg, #1f6cc7, #165eb1);
}

.gate-alert.blacklisted {
  background: linear-gradient(160deg, #b9262d, #9f1f27);
}

.gate-alert.watchlist {
  background: linear-gradient(160deg, #d07b00, #ba6a00);
}

.gate-alert.observed {
  background: linear-gradient(160deg, #2f8f4a, #27773f);
}

.metrics-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metrics-grid article {
  background: #fff;
  border: 1px solid #d4e1ed;
  border-radius: 14px;
  padding: 12px 14px;
}

.metrics-grid small {
  font-size: 16px;
  color: #4c6985;
  font-weight: 700;
}

.metrics-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 45px;
  font-weight: 800;
  color: #16385c;
}

.metrics-grid .danger {
  color: #c92e34;
}

.metrics-grid .warn {
  color: #cf7800;
}

.metrics-grid .ok {
  color: #2f8e49;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr repeat(3, auto);
  gap: 8px;
  margin-bottom: 10px;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
}

.check-line input {
  width: 20px;
  height: 20px;
}

.info-line {
  margin: 0 0 8px;
  color: #4a6683;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th,
td {
  text-align: left;
  padding: 9px;
  border-bottom: 1px solid #dfebf6;
  font-size: 14px;
}

th {
  background: #edf4fb;
  color: #1c4268;
  font-weight: 800;
}

tr.selected {
  background: #e4effa;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(4, 17, 32, 0.58);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: min(520px, 100%);
  background: #f9fcff;
  border: 1px solid #c9dbed;
  border-radius: 18px;
  box-shadow: 0 22px 36px rgba(3, 15, 31, 0.34);
  padding: 18px;
}

.modal-card h4 {
  margin: 0;
  color: #10395f;
  font-size: 24px;
}

.modal-card p {
  margin: 10px 0 0;
  color: #315471;
  font-weight: 600;
  font-size: 16px;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-ok,
.modal-cancel {
  min-width: 110px;
}

body.rtl {
  font-family: "Dubai", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body.rtl .login-title-row,
body.rtl .hero-card,
body.rtl .brand-inline,
body.rtl .header-right {
  direction: rtl;
}

body.rtl .pill-code {
  margin-left: 0;
  margin-right: 6px;
}

body.rtl label,
body.rtl .info-line,
body.rtl .hero-card p,
body.rtl .hero-card h2,
body.rtl .panel h3 {
  text-align: right;
}

body.rtl th,
body.rtl td {
  text-align: right;
}

body.rtl .modal-card,
body.rtl .modal-card p,
body.rtl .modal-card h4 {
  text-align: right;
}

body.rtl .modal-actions {
  justify-content: flex-start;
}

@media (max-width: 1000px) {
  .hero-card h2 {
    font-size: 28px;
  }

  .panel h3 {
    font-size: 28px;
  }

  .gate-alert strong {
    font-size: 30px;
  }

  .gate-alert p {
    font-size: 19px;
  }

  .gate-search-row,
  .toolbar,
  .editor-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-header {
    height: auto;
    padding: 8px 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand-inline {
    font-size: 20px;
    min-width: 0;
  }

  .logo-mark {
    width: 28px;
    height: 28px;
  }

  .logo-badge {
    width: 62px;
    height: 62px;
  }

  .logo-badge.small {
    width: 50px;
    height: 50px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-right .app-pill,
  .header-right .ghost-btn {
    height: 36px;
    width: auto;
  }

  .user-chip {
    order: 3;
    width: 100%;
    max-width: 100%;
    min-height: 34px;
    height: auto;
    padding: 6px 10px;
  }

  .app-main {
    padding: 10px;
  }

  .hero-card {
    padding: 10px 12px;
  }

  .hero-card h2 {
    font-size: 22px;
  }

  .hero-card p {
    font-size: 15px;
  }

  .tab {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .panel h3 {
    font-size: 30px;
  }

  .toolbar .primary-btn,
  .toolbar .danger-btn {
    width: 100%;
  }
}
