:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #eef5f3;
  --line: #d6dee2;
  --text: #17212b;
  --muted: #66717f;
  --soft: #879599;
  --accent: #136f63;
  --accent-2: #b84a35;
  --accent-3: #2457a6;
  --warning: #b7791f;
  --shadow: 0 14px 38px rgba(23, 35, 38, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(19, 111, 99, 0.08), rgba(243, 245, 247, 0) 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.75fr) minmax(520px, 1.25fr);
}

.login-panel {
  background: var(--surface);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 760;
  font-size: 20px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #52a39a);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
}

.login-panel h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.12;
}

.login-panel p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 107, 101, 0.12);
}

.primary-btn,
.secondary-btn,
.icon-btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 760;
}

.primary-btn {
  background: var(--accent);
  color: white;
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.login-visual {
  position: relative;
  overflow: hidden;
  padding: 48px;
  display: flex;
  align-items: center;
  background:
    linear-gradient(rgba(246, 247, 248, 0.75), rgba(246, 247, 248, 0.9)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900'%3E%3Crect width='1200' height='900' fill='%23e4ebeb'/%3E%3Cg fill='none' stroke='%2395a7aa' stroke-width='2' opacity='.55'%3E%3Cpath d='M82 192c82-46 176-31 244-1 78 34 159 38 260 11 99-26 208-49 326 0 80 33 143 37 206 14'/%3E%3Cpath d='M41 376c117-30 218-22 303 26 91 52 194 42 284 12 104-34 208-31 312 18 71 33 133 39 210 13'/%3E%3Cpath d='M72 616c90-56 174-57 278-8 89 42 173 30 272-11 108-44 218-38 334 16 56 26 111 31 174 11'/%3E%3C/g%3E%3Cg fill='%230b6b65' opacity='.82'%3E%3Ccircle cx='321' cy='201' r='7'/%3E%3Ccircle cx='646' cy='409' r='7'/%3E%3Ccircle cx='892' cy='615' r='7'/%3E%3Ccircle cx='483' cy='602' r='7'/%3E%3C/g%3E%3Cg fill='%23ffffff' stroke='%23cbd5d6'%3E%3Crect x='125' y='118' width='246' height='126' rx='8'/%3E%3Crect x='716' y='524' width='258' height='126' rx='8'/%3E%3Crect x='441' y='320' width='246' height='126' rx='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.visual-card {
  width: min(620px, 100%);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(217, 223, 223, 0.9);
  border-radius: 8px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.visual-card h2 {
  margin: 0 0 18px;
  font-size: 24px;
}

.kpi-row,
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.kpi,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff, #f9fbfc);
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.05);
}

.kpi strong,
.stat strong {
  display: block;
  font-size: 24px;
  margin-bottom: 5px;
}

.kpi span,
.stat span {
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 720;
}

.nav button.active {
  background: linear-gradient(180deg, var(--surface-2), #ffffff);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav svg,
.inline-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 245, 247, 0.94);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  font-size: 21px;
  margin: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 24px 28px 38px;
  display: grid;
  gap: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 190px 170px;
  gap: 10px;
  align-items: center;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(23, 33, 43, 0.07);
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f9fbfc);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2,
.section-title {
  margin: 0;
  font-size: 18px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f7fafb;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr.clickable:hover {
  background: #f1f7f5;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.pill.strong {
  background: rgba(11, 107, 101, 0.12);
  color: var(--accent);
}

.pill.warn {
  background: rgba(183, 121, 31, 0.13);
  color: #83520c;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.map-stage {
  min-height: 520px;
  position: relative;
  overflow: hidden;
  background: #dfe8e6;
  border-radius: 8px;
}

.map-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 8px;
}

.leaflet-map {
  width: 100%;
  height: 100%;
  min-height: 520px;
  z-index: 1;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.map-pin {
  align-items: center;
  background: var(--accent-2);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(23, 35, 38, 0.24);
  color: #fff;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.map-note {
  bottom: 10px;
  left: 10px;
  max-width: min(540px, calc(100% - 20px));
  position: absolute;
  z-index: 2;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
}

.country-list,
.detail-stack,
.category-grid {
  display: grid;
  gap: 10px;
}

.country-btn,
.customer-card,
.category-card,
.contact-card,
.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.country-btn {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.country-btn.active {
  border-color: var(--accent);
  background: #eef8f6;
}

.customer-card {
  cursor: pointer;
}

.customer-card:hover,
.category-card:hover {
  border-color: var(--accent);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.detail-header h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  margin-bottom: 6px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.asset-tile {
  border: 1px dashed #b8c5c6;
  border-radius: 8px;
  min-height: 118px;
  background: #f8fbfb;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  color: var(--muted);
}

.email-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.email-output {
  min-height: 440px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #173033;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 20;
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .login-shell,
  .app-shell,
  .two-col,
  .map-layout,
  .email-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

  .login-visual {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .login-panel,
  .login-visual,
  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .toolbar,
  .detail-grid,
  .stats-row,
  .kpi-row,
  .asset-grid,
  .nav {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.sidebar .brand-link {
  margin-bottom: 0;
}
