/*
 * Go Enterprises Admin — main stylesheet
 *
 * Palette is sampled from the brand assets:
 *   /images/logo.png                 ink #212121 + five hexes (green, blue, orange, teal, red)
 *   /images/software/produce.png     #286432 + #facf03
 *   /images/software/coldstorage.png #223e66 + #5394cf
 *
 * Layers: tokens → base → Fomantic overrides → shell → components → pages.
 * Prefix for our own classes: go-
 */

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --go-ink: #212121;
  --go-ink-soft: #3d3d3d;
  --go-green: #338c3f;
  --go-green-dark: #286432;
  --go-blue: #295487;
  --go-blue-dark: #223e66;
  --go-ice: #5394cf;
  --go-orange: #f2a02a;
  --go-orange-dark: #c17508;
  --go-teal: #2fccb6;
  --go-teal-dark: #00ac97;
  --go-red: #e56767;
  --go-red-dark: #bc3939;
  --go-yellow: #facf03;

  /* Products */
  --go-produce: var(--go-green-dark);
  --go-produce-tint: #e8f2ea;
  --go-coldstorage: var(--go-blue-dark);
  --go-coldstorage-tint: #e7eef7;
  --go-inspectors: #e08a00;
  --go-inspectors-text: #9a5d00;
  --go-inspectors-tint: #fdf1de;
  --go-transports: #bb3a3b;
  --go-transports-tint: #fbeaea;
  --go-fsvp: var(--go-teal-dark);
  --go-fsvp-text: #00796a;
  --go-fsvp-tint: #e3f7f4;

  /* Neutrals */
  --go-bg: #f4f5f7;
  --go-surface: #ffffff;
  --go-surface-2: #fafbfc;
  --go-line: #e5e7eb;
  --go-line-strong: #d1d5db;
  --go-text: var(--go-ink);
  --go-muted: #6b7280;
  --go-subtle: #9ca3af;

  /* Status */
  --go-ok: var(--go-teal-dark);
  --go-ok-tint: #e3f7f4;
  --go-warn: var(--go-orange-dark);
  --go-warn-tint: #fdf2e1;
  --go-danger: var(--go-red-dark);
  --go-danger-tint: #fbeaea;
  --go-info: var(--go-blue);
  --go-info-tint: #e9eff7;

  /* Type */
  --go-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --go-font-display: 'Poppins', var(--go-font);
  --go-font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Shape */
  --go-radius: 12px;
  --go-radius-sm: 8px;
  --go-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 1px 3px rgba(17, 24, 39, 0.06);
  --go-shadow-lg: 0 10px 30px rgba(17, 24, 39, 0.08);

  /* The five-hex brand stripe */
  --go-stripe: linear-gradient(90deg,
      var(--go-green) 0 20%, var(--go-blue) 20% 40%, var(--go-orange) 40% 60%,
      var(--go-teal) 60% 80%, var(--go-red) 80% 100%);
}

/* ---------- Base ---------- */
html,
body {
  background: var(--go-bg);
  color: var(--go-text);
  font-family: var(--go-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body .ui:not(.icon),
body .ui:not(.icon) *:not(.icon) {
  font-family: var(--go-font);
}

body h1,
body h2,
body h3,
body h4,
body .ui.header,
body .ui.modal > .header {
  font-family: var(--go-font-display);
  color: var(--go-text);
  letter-spacing: -0.01em;
}

a {
  color: var(--go-blue);
}

a:hover {
  color: var(--go-blue-dark);
}

.go-mono {
  font-family: var(--go-font-mono);
  font-size: 0.92em;
}

.go-muted {
  color: var(--go-muted);
}

/* ---------- Fomantic overrides (brand colors) ---------- */
body .ui.button {
  border-radius: var(--go-radius-sm);
  font-weight: 600;
}

body .ui.primary.button,
body .ui.black.button {
  background: var(--go-ink);
  color: #fff;
}

body .ui.primary.button:hover,
body .ui.black.button:hover {
  background: #000;
}

body .ui.green.button { background: var(--go-green); }
body .ui.green.button:hover { background: var(--go-green-dark); }
body .ui.blue.button { background: var(--go-blue); }
body .ui.blue.button:hover { background: var(--go-blue-dark); }
body .ui.teal.button { background: var(--go-teal-dark); }
body .ui.yellow.button,
body .ui.orange.button { background: var(--go-orange); color: var(--go-ink); }
body .ui.yellow.button:hover,
body .ui.orange.button:hover { background: var(--go-orange-dark); color: #fff; }
body .ui.red.button { background: var(--go-red-dark); }
body .ui.red.button:hover { background: #9e2d2d; }

body .ui.basic.red.button {
  background: transparent;
  color: var(--go-danger);
  box-shadow: 0 0 0 1px var(--go-danger) inset;
}

body i.green.icon { color: var(--go-green); }
body i.blue.icon { color: var(--go-blue); }
body i.teal.icon { color: var(--go-teal-dark); }
body i.yellow.icon,
body i.orange.icon { color: var(--go-orange-dark); }
body i.red.icon { color: var(--go-red-dark); }

body .ui.form input:not([type]),
body .ui.form input[type='text'],
body .ui.form input[type='email'],
body .ui.form input[type='password'],
body .ui.form textarea,
body .ui.selection.dropdown,
body .ui.input > input {
  border-radius: var(--go-radius-sm);
  border-color: var(--go-line-strong);
}

body .ui.form input:focus,
body .ui.form textarea:focus,
body .ui.input > input:focus {
  border-color: var(--go-ink);
}

body .ui.form .field > label {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--go-ink-soft);
}

body .ui.modal {
  border-radius: var(--go-radius);
  overflow: hidden;
}

body .ui.modal > .header {
  font-size: 1.15rem;
}

body .ui.modal::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--go-stripe);
}

body .ui.modal > .actions {
  background: var(--go-surface-2);
}

/* ---------- Shell: top bar ---------- */
.go-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--go-surface);
  box-shadow: 0 1px 0 var(--go-line);
}

.go-topbar::after {
  content: '';
  display: block;
  height: 3px;
  background: var(--go-stripe);
}

.go-topbar__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1280px;
  height: 64px;
  margin: 0 auto;
  padding: 0 24px;
}

.go-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--go-text);
  text-decoration: none;
}

.go-brand:hover {
  color: var(--go-text);
}

.go-brand img {
  height: 40px;
  width: auto;
}

.go-brand__name {
  font-family: var(--go-font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.1;
}

.go-brand__name small {
  display: block;
  font-family: var(--go-font);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--go-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.go-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 100%;
}

.go-nav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--go-muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.go-nav__item:hover {
  color: var(--go-text);
}

.go-nav__item.is-active {
  color: var(--go-text);
  border-bottom-color: var(--go-ink);
}

.go-nav__item .icon {
  margin: 0;
}

.go-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.go-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--go-muted);
  font-weight: 500;
}

.go-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--go-line);
  border-radius: var(--go-radius-sm);
  background: var(--go-surface);
  color: var(--go-muted);
  cursor: pointer;
}

.go-icon-button:hover {
  color: var(--go-danger);
  border-color: var(--go-danger);
}

.go-icon-button .icon {
  margin: 0;
}

/* ---------- Shell: page ---------- */
.go-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.go-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.go-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.go-subtitle {
  margin: 4px 0 0;
  color: var(--go-muted);
}

.go-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.go-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--go-muted);
  font-weight: 500;
  text-decoration: none;
}

/* ---------- Components: card ---------- */
.go-card {
  background: var(--go-surface);
  border: 1px solid var(--go-line);
  border-radius: var(--go-radius);
  box-shadow: var(--go-shadow);
}

.go-card + .go-card {
  margin-top: 16px;
}

.go-card > .go-table {
  border-radius: var(--go-radius);
  overflow: hidden;
}

.go-grid > .go-card + .go-card {
  margin-top: 0;
}

.go-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--go-line);
}

.go-card__title {
  margin: 0;
  font-family: var(--go-font-display);
  font-size: 1rem;
  font-weight: 600;
}

.go-card__body {
  padding: 20px;
}

.go-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* ---------- Components: table ---------- */
.go-table {
  width: 100%;
  border-collapse: collapse;
}

.go-table th {
  padding: 12px 20px;
  background: var(--go-surface-2);
  border-bottom: 1px solid var(--go-line);
  color: var(--go-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.go-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--go-line);
  vertical-align: middle;
}

.go-table tr:last-child td {
  border-bottom: 0;
}

.go-table tr[data-href] {
  cursor: pointer;
}

.go-table tbody tr:hover td {
  background: var(--go-surface-2);
}

.go-table .is-collapsing {
  width: 1%;
  white-space: nowrap;
}

.go-table .go-chevron {
  color: var(--go-subtle);
}

/* ---------- Components: entity (avatar + name) ---------- */
.go-entity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.go-avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--go-ink);
  color: #fff;
  font-family: var(--go-font-display);
  font-weight: 700;
  font-size: 0.9rem;
}

.go-avatar--lg {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  font-size: 1.4rem;
}

.go-avatar--produce { background: var(--go-produce); }
.go-avatar--coldstorage { background: var(--go-coldstorage); }
.go-avatar--inspectors { background: var(--go-inspectors); }
.go-avatar--transports { background: var(--go-transports); }

/* Customer logo over the initials; the initials show again if the image fails. */
.go-avatar--logo {
  position: relative;
  overflow: hidden;
  background: var(--go-surface);
  box-shadow: inset 0 0 0 1px var(--go-line);
  color: transparent;
}

.go-avatar--logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.go-entity__name {
  display: block;
  color: var(--go-text);
  font-weight: 600;
  text-decoration: none;
}

a.go-entity__name:hover {
  color: var(--go-blue);
}

.go-entity__meta {
  display: block;
  overflow: hidden;
  color: var(--go-muted);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Components: badges & pills ---------- */
.go-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.go-product {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: var(--go-bg);
  color: var(--go-ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.go-product img,
.go-product .go-product__icon {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.go-product .go-product__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--go-ink);
  color: #fff;
  font-size: 0.65rem;
}

.go-product .go-product__icon .icon {
  margin: 0;
  height: auto;
}

.go-product--produce {
  background: var(--go-produce-tint);
  color: var(--go-produce);
}

.go-product--coldstorage {
  background: var(--go-coldstorage-tint);
  color: var(--go-coldstorage);
}

.go-product--inspectors {
  background: var(--go-inspectors-tint);
  color: var(--go-inspectors-text);
}

.go-product--transports {
  background: var(--go-transports-tint);
  color: var(--go-transports);
}

.go-product--fsvp {
  background: var(--go-fsvp-tint);
  color: var(--go-fsvp-text);
}

.go-product--fsvp .go-product__icon {
  background: var(--go-fsvp);
}

.go-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.go-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.go-pill--ok { background: var(--go-ok-tint); color: var(--go-ok); }
.go-pill--warn { background: var(--go-warn-tint); color: var(--go-warn); }
.go-pill--danger { background: var(--go-danger-tint); color: var(--go-danger); }
.go-pill--info { background: var(--go-info-tint); color: var(--go-info); }

.go-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--go-line);
  border-radius: var(--go-radius-sm);
  background: var(--go-surface);
  color: var(--go-ink-soft);
  font-size: 0.86rem;
}

/* ---------- Components: definition list ---------- */
.go-dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 10px 20px;
  margin: 0;
}

.go-dl dt {
  color: var(--go-muted);
  font-weight: 500;
}

.go-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- Components: tabs ---------- */
.go-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 20px 0;
  border-bottom: 1px solid var(--go-line);
}

.go-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--go-muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}

.go-tab:hover {
  color: var(--go-text);
}

.go-tab.is-active {
  color: var(--go-text);
  border-bottom-color: var(--go-ink);
}

.go-tab .icon {
  margin: 0;
}

.go-tabs__spacer {
  margin-left: auto;
}

/* ---------- Components: empty state ---------- */
.go-empty {
  padding: 48px 24px;
  text-align: center;
}

.go-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--go-bg);
  color: var(--go-muted);
  font-size: 1.4rem;
}

.go-empty__icon .icon {
  margin: 0;
}

.go-empty h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.go-empty p {
  max-width: 420px;
  margin: 0 auto 18px;
  color: var(--go-muted);
}

/* ---------- Components: code / secret ---------- */
.go-code {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--go-line);
  border-radius: var(--go-radius-sm);
  background: var(--go-surface-2);
  font-family: var(--go-font-mono);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.go-code code {
  flex: 1;
}

/* ---------- Components: search ---------- */
.go-search.ui.search .prompt {
  width: 280px;
  border-radius: var(--go-radius-sm) !important;
}

/* ---------- Page: home / launcher ---------- */
.go-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px;
}

.go-hero img {
  height: 96px;
  width: auto;
}

.go-hero h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.go-hero p {
  margin: 0;
  color: var(--go-muted);
}

.go-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  color: var(--go-text);
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.go-tile:hover {
  color: var(--go-text);
  box-shadow: var(--go-shadow-lg);
  transform: translateY(-1px);
}

.go-tile img,
.go-tile .go-tile__icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.go-tile .go-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--go-ink);
  color: #fff;
  font-size: 1.4rem;
}

.go-tile .go-tile__icon .icon {
  margin: 0;
  height: auto;
}

.go-tile strong {
  display: block;
  font-family: var(--go-font-display);
  font-size: 1.05rem;
}

.go-tile span {
  color: var(--go-muted);
}

/* ---------- Page: customer profile header ---------- */
.go-profile {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px;
  flex-wrap: wrap;
}

.go-profile__main {
  flex: 1;
  min-width: 240px;
}

.go-profile__name {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 700;
}

.go-profile__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ---------- Page: login ---------- */
.go-login {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--go-surface);
}

.go-login__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 48px;
  background: var(--go-bg);
}

.go-login__brand::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: var(--go-stripe);
}

.go-login__logo {
  width: min(360px, 70%);
  height: auto;
}

.go-login__products {
  display: flex;
  gap: 16px;
}

.go-login__products img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  box-shadow: var(--go-shadow);
}

.go-login__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

body .go-login__form.ui.form {
  width: 100%;
  max-width: 380px;
}

.go-login__form h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  font-weight: 700;
}

.go-login__form > p {
  margin: 0 0 28px;
  color: var(--go-muted);
}

body .go-login__form .ui.submit.button {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
}

.go-login__footer {
  margin-top: 32px;
  color: var(--go-subtle);
  font-size: 0.8rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .go-login {
    grid-template-columns: 1fr;
  }

  .go-login__brand {
    padding: 32px 24px;
    gap: 20px;
  }

  .go-login__logo {
    width: 160px;
  }

  .go-login__products img {
    width: 44px;
    height: 44px;
  }

  .go-brand__name,
  .go-user__name,
  .go-nav__label {
    display: none;
  }

  .go-topbar__inner {
    gap: 8px;
    padding: 0 16px;
  }

  .go-page {
    padding: 20px 16px 48px;
  }

  .go-table .is-hide-mobile {
    display: none;
  }

  .go-table th,
  .go-table td {
    padding-left: 14px;
    padding-right: 14px;
  }

  .go-table .go-entity__meta {
    white-space: normal;
  }

  .go-table .go-pill {
    margin: 2px 0;
  }

  .go-search.ui.search .prompt,
  .go-search .ui.input {
    width: 100%;
  }

  .go-tabs {
    gap: 0;
  }

  .go-tab {
    padding: 10px;
  }

  .go-tabs .ui.button {
    padding: 10px 12px;
  }

  .go-tabs .ui.button .icon {
    margin: 0;
  }

  .go-actions,
  .go-actions > * {
    width: 100%;
  }
}

/* ---------- Shell: user chip (kept after responsive block on purpose: base size) ---------- */
.go-user .go-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.8rem;
}

/* ---------- Components: callout ---------- */
.go-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--go-line);
  border-left: 4px solid var(--go-info);
  border-radius: var(--go-radius-sm);
  background: var(--go-surface);
  color: var(--go-ink-soft);
}

.go-callout .icon {
  margin: 2px 0 0;
  color: var(--go-info);
}

.go-callout--warn {
  border-left-color: var(--go-warn);
}

.go-callout--warn .icon {
  color: var(--go-warn);
}

.go-callout p {
  margin: 0;
}

.go-callout strong {
  color: var(--go-text);
}

/* ---------- Components: help text & inline form ---------- */
.go-help {
  margin: 4px 0 0;
  color: var(--go-muted);
  font-size: 0.86rem;
}

.go-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--go-line);
  background: var(--go-surface-2);
  border-radius: 0 0 var(--go-radius) var(--go-radius);
}

.go-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.go-subtab {
  padding: 8px 14px;
  border: 1px solid var(--go-line);
  border-radius: 999px;
  background: var(--go-surface);
  color: var(--go-muted);
  font-weight: 600;
  text-decoration: none;
}

.go-subtab:hover {
  color: var(--go-text);
}

.go-subtab.is-active {
  border-color: var(--go-ink);
  background: var(--go-ink);
  color: #fff;
}

.go-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.go-chip-list a.go-chip {
  text-decoration: none;
}

.go-chip-list a.go-chip:hover {
  border-color: var(--go-ink);
  color: var(--go-text);
}
