:root {
  --ink: #102235;
  --ink-soft: #476177;
  --muted: #6d8296;
  --line: #d7e3ee;
  --line-strong: #bfd0df;
  --panel: rgba(255, 255, 255, 0.94);
  --wash: #eef6fb;
  --navy: #061d31;
  --teal: #0f8f83;
  --teal-dark: #0a6f67;
  --blue: #1268d6;
  --amber: #e4a11b;
  --danger: #b4232f;
  --success: #167044;
  --shadow: 0 18px 48px rgba(12, 38, 62, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(18, 104, 214, 0.15), transparent 28rem),
    radial-gradient(circle at 85% 15%, rgba(15, 143, 131, 0.16), transparent 24rem),
    linear-gradient(135deg, #f6fbff 0%, #eef5f9 45%, #f9fbf6 100%);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(14px, 3vw, 34px);
  background: linear-gradient(135deg, #061d31 0%, #0b314f 58%, #0d766e 100%);
  color: #fff;
  box-shadow: 0 16px 34px rgba(3, 17, 30, 0.22);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(25, 180, 255, 0.28);
}

.brand-mark img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  color: #b8d5e8;
  font-size: 12px;
}

.admin-nav,
.session-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-nav {
  justify-content: center;
}

.admin-nav a,
.hero-actions a,
.quick-nav a {
  text-decoration: none;
}

.admin-nav a {
  padding: 8px 11px;
  border-radius: 999px;
  color: #dceefb;
  font-size: 13px;
  transition: background 0.18s ease, color 0.18s ease;
}

.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.session-tools {
  justify-content: flex-end;
}

.session-tools #whoami {
  color: #dbeafe;
  font-size: 13px;
}

.container {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  width: min(1480px, calc(100% - 28px));
  margin: 22px auto 36px;
}

.hero-card,
.quick-nav,
.panel {
  grid-column: 1 / -1;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 20px;
  align-items: center;
  overflow: hidden;
  position: relative;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid rgba(198, 216, 231, 0.9);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 249, 255, 0.88)),
    radial-gradient(circle at 90% 10%, rgba(15, 143, 131, 0.18), transparent 18rem);
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -120px;
  width: 300px;
  height: 300px;
  border: 42px solid rgba(18, 104, 214, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-card h1 {
  max-width: 880px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(26px, 4vw, 46px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.hero-actions {
  display: grid;
  gap: 10px;
  min-width: 0;
  z-index: 1;
}

.hero-side {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.hero-logo-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(18, 104, 214, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 34px rgba(12, 38, 62, 0.08);
}

.hero-logo-card img {
  width: min(100%, 230px);
  max-height: 150px;
  object-fit: contain;
}

.hero-logo-card span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.hero-actions a {
  padding: 11px 14px;
  border: 1px solid rgba(15, 143, 131, 0.2);
  border-radius: 16px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(16, 34, 53, 0.08);
}

.quick-nav {
  position: sticky;
  top: 72px;
  z-index: 15;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid rgba(198, 216, 231, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(12, 38, 62, 0.08);
}

.quick-nav a {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: #edf7fb;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-nav a:hover {
  background: var(--navy);
  color: #fff;
}

.panel {
  min-width: 0;
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid rgba(198, 216, 231, 0.92);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(12, 38, 62, 0.08);
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.panel h2::before {
  content: "";
  width: 9px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #19b4ff, var(--teal));
}

.panel-overview,
.panel-licenses,
.panel-businesses,
.panel-details,
.panel-transactions,
.panel-activity,
.panel-register,
.panel-users,
.panel-devices,
.panel-advanced {
  grid-column: 1 / -1;
}

.panel-overview {
  order: 1;
}

.panel-licenses {
  order: 2;
}

.panel-businesses {
  order: 3;
}

.panel-details {
  order: 4;
}

.panel-devices {
  order: 5;
}

.panel-users {
  order: 6;
}

.panel-transactions {
  order: 7;
}

.panel-activity {
  order: 8;
}

.panel-register {
  order: 9;
}

.panel-advanced {
  order: 10;
}

.hero-card {
  order: 0;
}

.quick-nav {
  order: 0;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid > * {
  min-width: 0;
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(203, 218, 231, 0.9);
  border-radius: 18px;
  background:
    linear-gradient(145deg, #ffffff, #f3f9fd),
    radial-gradient(circle at top right, rgba(15, 143, 131, 0.16), transparent 8rem);
}

.stat::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -24px;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: rgba(18, 104, 214, 0.07);
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  color: var(--navy);
  font-size: 28px;
  font-weight: 900;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}

.toolbar > input,
.toolbar > select {
  flex: 1 1 220px;
}

.toolbar > button {
  flex: 0 0 auto;
}

.toolbar > .muted,
.toolbar > .status-ok,
.toolbar > .status-bad {
  flex: 1 1 180px;
}

input,
select,
button,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  min-width: 180px;
  max-width: 100%;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(18, 104, 214, 0.55);
  box-shadow: 0 0 0 4px rgba(18, 104, 214, 0.12);
}

textarea {
  width: 100%;
  font-family: Consolas, "Courier New", monospace;
  resize: vertical;
}

button {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 143, 131, 0.18);
}

button.secondary {
  border-color: #29465f;
  background: linear-gradient(135deg, #395872, #1a334a);
}

button.danger {
  border-color: var(--danger);
  background: linear-gradient(135deg, #d33845, var(--danger));
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.password-row {
  display: flex;
  gap: 8px;
}

.password-row input {
  flex: 1;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.panel-businesses table {
  min-width: 1360px;
}

.panel-licenses table {
  min-width: 1240px;
}

.panel-devices table {
  min-width: 980px;
}

.panel-users table {
  min-width: 760px;
}

.panel-transactions table {
  min-width: 1180px;
}

.panel-activity table {
  min-width: 1040px;
}

.panel-audit table {
  min-width: 1040px;
}

th,
td {
  border-bottom: 1px solid #e7eef5;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f2f8fc;
  color: #395872;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:nth-child(even) td {
  background: #fbfdff;
}

tbody tr:hover td {
  background: #eff8fc;
}

code {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid #d6e5f1;
  border-radius: 8px;
  background: #f5f9fc;
  color: #153a5b;
  font-size: 12px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.secrets {
  margin-top: 12px;
  border: 1px dashed rgba(15, 143, 131, 0.45);
  border-radius: 18px;
  padding: 14px;
  font-size: 13px;
  background: linear-gradient(135deg, #effcf7, #f7fdff);
}

.hidden {
  display: none !important;
}

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

.status-ok,
.status-bad,
.status-warn {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-ok {
  background: rgba(22, 112, 68, 0.11);
  color: var(--success);
}

.status-bad {
  background: rgba(180, 35, 47, 0.11);
  color: var(--danger);
}

.status-warn {
  background: rgba(190, 118, 0, 0.14);
  color: #9a5d00;
}

.login-wrap {
  width: min(430px, calc(100% - 28px));
  margin: 72px auto;
}

.login-wrap.panel {
  padding: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 12px;
}

.login-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(18, 104, 214, 0.14);
}

.login-wrap h2 {
  margin: 0 0 4px;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-nav,
  .session-tools {
    justify-content: flex-start;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }

  .hero-side {
    grid-template-columns: minmax(220px, 320px) minmax(220px, 1fr);
    align-items: stretch;
  }

  .quick-nav {
    position: static;
  }

  .grid-4,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
  }

  .admin-nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .container {
    grid-template-columns: 1fr;
    width: min(100% - 18px, 1480px);
    margin-top: 12px;
  }

  .hero-card,
  .quick-nav,
  .panel {
    margin-bottom: 14px;
  }

  .hero-card {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .hero-side {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .hero-actions a {
    padding: 10px;
    text-align: center;
    font-size: 12px;
  }

  .quick-nav {
    position: static;
    border-radius: 16px;
  }

  .grid-4,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar > input,
  .toolbar > select,
  .toolbar > button,
  .toolbar > .muted,
  .toolbar > .status-ok,
  .toolbar > .status-bad {
    width: 100%;
  }

  input,
  select,
  button,
  textarea {
    width: 100%;
    min-width: 0;
  }

  .row button {
    flex: 1 1 140px;
  }

  .table-wrap {
    max-height: 70vh;
    border-radius: 14px;
  }

}

@media (max-width: 480px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .hero-card h1 {
    font-size: 27px;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: 18px;
  }
}
