@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@300;400;500;600;700;800&display=swap');

:root {
  --slate:        #313745;
  --slate-light:  #4A5060;
  --slate-muted:  rgba(49, 55, 69, 0.75);
  --cream:        #F9F9FB;
  --cream2:       #EEEEF2;
  --white:        #FFFFFF;
  --border:       #DDDDE3;
  --gold:         #C9A84C;
  --gold-light:   #F5EDD4;
  --green-ok:     #2D6A4F;
  --green-light:  #D8F3DC;
  --red:          #C1121F;
  --red-light:    #FFE8E8;
  --orange:       #E07B39;
  --orange-light: #FFF0D9;
  --grey:         #6B7280;
  --grey-light:   #9CA3AF;

  /* legacy aliases so existing pages still work */
  --espresso:     #313745;
  --dark-roast:   #3D4455;
  --medium-roast: #6B7280;
  --light-roast:  #9CA3AF;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'League Spartan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--slate);
  min-height: 100vh;
}

/* -- TOP NAV -- */
.topbar {
  background: var(--slate);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 8px rgba(49,55,69,0.18);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo {
  height: 38px; width: 38px; border-radius: 50%;
  object-fit: contain; background: white; padding: 2px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--white); letter-spacing: -0.3px; }
.logo span { color: var(--grey-light); font-weight: 400; font-size: 13px; margin-left: 4px; }
.topbar-date { font-size: 11px; color: var(--grey-light); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.status-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px; padding: 4px 12px;
  font-size: 11px; color: rgba(255,255,255,0.75);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* -- CHANNEL TABS -- */
.channel-tabs {
  background: var(--dark-roast);
  display: flex; gap: 2px; padding: 0 28px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 10px 18px; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.6); cursor: pointer; border-bottom: 3px solid transparent;
  transition: all 0.2s; white-space: nowrap;
  text-decoration: none;
}
.tab:hover { color: var(--white); }
.tab.active { color: var(--white); border-bottom-color: var(--gold); background: rgba(255,255,255,0.06); }

/* -- MAIN LAYOUT -- */
.main { padding: 24px 28px; max-width: 1600px; margin: 0 auto; }

/* -- SECTION HEADER -- */
.section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--grey);
  margin: 24px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

/* -- KPI CARDS -- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}
.kpi-card {
  background: var(--white);
  border-radius: 10px;
  padding: 18px 18px 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(49,55,69,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(49,55,69,0.1); }
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.kpi-card.green::before  { background: linear-gradient(90deg, #3B5278, #4A6590); }
.kpi-card.brown::before  { background: linear-gradient(90deg, #313745, #4A5060); }
.kpi-card.gold::before   { background: linear-gradient(90deg, #445566, #566578); }
.kpi-card.red::before    { background: linear-gradient(90deg, #2C3E5A, #3B4C6B); }
.kpi-card.orange::before { background: linear-gradient(90deg, #3D5A6E, #4F6D80); }
.kpi-card.blue::before { background: #3b82f6; }
.kpi-card.purple::before { background: #8b5cf6; }
.kpi-card.cyan::before { background: #06b6d4; }
.kpi-card.pink::before { background: #ec4899; }
.kpi-card.slate::before { background: #64748b; }

.kpi-label { font-size: 10px; font-weight: 600; color: var(--grey); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--slate); line-height: 1; margin-bottom: 6px; }
.kpi-value.small { font-size: 20px; }
.kpi-sub { font-size: 11px; color: var(--grey); display: flex; align-items: center; gap: 4px; }
.kpi-sub .up   { color: var(--green-ok); }
.kpi-sub .down { color: var(--red); }
.kpi-sub .warn { color: var(--orange); }
.kpi-channel-badge {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
  background: var(--cream2); color: var(--grey);
}

/* -- CHANNEL GRID -- */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 6px;
}
.channel-card {
  background: var(--white); border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(49,55,69,0.06);
  overflow: hidden;
}
.channel-card-header {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.channel-name { font-size: 13px; font-weight: 700; color: var(--white); }
.channel-status { font-size: 10px; color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 10px; }
.channel-card-body { padding: 14px 16px; }
.channel-metric { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--cream2); }
.channel-metric:last-child { border-bottom: none; }
.cm-label { font-size: 11px; color: var(--grey); }
.cm-value { font-size: 13px; font-weight: 700; color: var(--slate); }
.cm-value.placeholder { color: var(--grey-light); font-weight: 400; font-style: italic; font-size: 11px; }

/* Channel colors -- on-brand blue-grey hues */
.amz  { background: linear-gradient(135deg, #3B4C6B, #2A3650); }
.shop { background: linear-gradient(135deg, #445566, #334455); }
.wmt  { background: linear-gradient(135deg, #3D5A6E, #2A4050); }
.ttk  { background: linear-gradient(135deg, #2C3E5A, #1A2740); }
.b2b  { background: linear-gradient(135deg, #505868, #3D4455); }
.grn  { background: linear-gradient(135deg, #3B5278, #283A55); }
.cafe { background: linear-gradient(135deg, #566578, #404E60); }
.soc  { background: linear-gradient(135deg, #4B5563, #374151); }
.anly { background: linear-gradient(135deg, #374151, #252E3F); }
.pr   { background: linear-gradient(135deg, #485A6F, #344555); }
.eml  { background: linear-gradient(135deg, #5A6577, #424E5E); }

/* -- INVENTORY PANEL -- */
.inventory-panel {
  background: var(--white); border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(49,55,69,0.06);
}
.panel-header {
  background: var(--slate); padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 13px; font-weight: 700; color: var(--white); }
.panel-subtitle { font-size: 10px; color: var(--grey-light); }
.panel-header-right { display: flex; gap: 10px; align-items: center; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--cream2); }
thead th { padding: 9px 14px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--grey); text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:hover { background: var(--cream); }
tbody tr:last-child { border-bottom: none; }
td { padding: 9px 14px; font-size: 12px; color: var(--slate); }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 10px; font-weight: 600;
}
.badge-green  { background: var(--green-light); color: var(--green-ok); }
.badge-red    { background: var(--red-light);   color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-grey   { background: var(--cream2);       color: var(--grey); }
.badge-gold   { background: var(--gold-light);   color: #856404; }

.progress-bar-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--cream2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.fill-green  { background: var(--green-ok); }
.fill-orange { background: var(--orange); }
.fill-red    { background: var(--red); }
.progress-pct { font-size: 11px; font-weight: 600; color: var(--grey); min-width: 35px; }

/* -- ALERTS -- */
.alerts-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--white); border-radius: 8px; padding: 12px 16px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  max-height: 200px;
}
.alert-item.critical { border-left-color: var(--red); }
.alert-item.warning  { border-left-color: var(--orange); }
.alert-item.info     { border-left-color: var(--gold); }
.alert-icon { font-size: 18px; line-height: 1; }
.alert-body { flex: 1; }
.alert-title { font-size: 12px; font-weight: 700; color: var(--slate); margin-bottom: 2px; }
.alert-desc  { font-size: 11px; color: var(--grey); }
.alert-time  { font-size: 10px; color: var(--grey-light); margin-top: 3px; }
.alert-actions-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.alert-cta { padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: default; display: inline-block; }
.alert-cta.critical { background: var(--red-light); color: var(--red); }
.alert-cta.warning  { background: var(--orange-light); color: var(--orange); }
.alert-cta.info     { background: var(--cream2); color: var(--grey); }
.alert-complete-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--green-ok);
  background: var(--green-light); color: var(--green-ok);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.alert-complete-btn:hover { background: var(--green-ok); color: var(--white); }
.alert-action { padding: 4px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 11px; font-weight: 600; }
.alert-action.critical { background: var(--red-light); color: var(--red); }
.alert-action.warning  { background: var(--orange-light); color: var(--orange); }
.alert-action.info     { background: var(--cream2); color: var(--grey); }
.archive-link { font-size: 11px; font-weight: 600; color: var(--slate-light); text-decoration: none; }
.archive-link:hover { color: var(--slate); text-decoration: underline; }
/* -- Undo button on archive page -- */
.alert-undo-btn {
  padding: 4px 12px; border-radius: 6px; border: 1px solid var(--orange);
  background: var(--orange-light); color: var(--orange);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.alert-undo-btn:hover { background: var(--orange); color: var(--white); }
.alert-archived-date { font-size: 10px; color: var(--grey-light); text-align: right; }

/* -- CS SLA PANEL -- */
.sla-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sla-ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { position: relative; width: 90px; height: 90px; }
.ring svg { transform: rotate(-90deg); }
.ring-val { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 18px; font-weight: 800; color: var(--slate); }
.ring-sub { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--grey); white-space: nowrap; }

/* -- TWO-COL LAYOUT -- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* -- CONNECT BANNER -- */
.connect-banner {
  background: linear-gradient(135deg, var(--slate), var(--slate-light));
  border-radius: 10px; padding: 18px 22px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.connect-text h3 { font-size: 14px; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.connect-text p  { font-size: 12px; color: rgba(255,255,255,0.65); }
.connect-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.connect-pill {
  padding: 5px 14px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1.5px solid;
}
.connect-pill.done    { background: rgba(45,106,79,0.3); border-color: var(--green-ok); color: #4ade80; }
.connect-pill.pending { background: rgba(201,168,76,0.15); border-color: var(--gold); color: var(--gold); }

/* -- BUTTONS -- */
.btn {
  padding: 6px 14px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: inherit;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--slate); color: var(--white);
}
.btn-primary:hover {
  background: var(--slate-light); transform: translateY(-1px);
}
.btn-secondary {
  background: var(--cream2); color: var(--grey);
}
.btn-secondary:hover {
  background: var(--border);
}

/* -- MODAL -- */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center; justify-content: center;
  overflow-y: auto;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--white);
  border-radius: 10px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  font-size: 18px; font-weight: 700;
  color: var(--slate); margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--grey); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit;
  font-size: 12px; color: var(--slate);
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--slate);
  box-shadow: 0 0 0 3px rgba(49,55,69,0.1);
}
.form-group textarea {
  resize: vertical; min-height: 80px;
}
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* -- ACTION BUTTONS -- */
.action-buttons {
  display: flex; gap: 6px;
}
.btn-edit, .btn-delete {
  padding: 4px 10px; font-size: 10px; border: none;
  border-radius: 4px; cursor: pointer; font-weight: 600;
  transition: all 0.2s; font-family: inherit;
}
.btn-edit {
  background: rgba(49,55,69,0.1); color: var(--slate);
}
.btn-edit:hover {
  background: rgba(49,55,69,0.18);
}
.btn-delete {
  background: rgba(193,18,31,0.1); color: var(--red);
}
.btn-delete:hover {
  background: rgba(193,18,31,0.2);
}

/* -- FILTER BAR (SKUs page) -- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.filter-bar select {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 12px;
  color: var(--slate); background: var(--white);
}
.filter-bar select:focus {
  outline: none; border-color: var(--slate);
}

/* -- FOOTER -- */
.footer { text-align: center; padding: 28px; font-size: 11px; color: var(--grey-light); }

/* -- RESPONSIVE -- */
@media (max-width: 900px) {
  .two-col, .three-col, .sla-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .topbar { padding: 0 16px; }
  .channel-tabs { padding: 0 16px; }
}