/* ============================================================
   up2retail Admin — Modern, Clean, Functional
   ============================================================ */

:root {
  --bg:        #FFFFFF;
  --bg-soft:   #F7F7F5;
  --bg-soft-2: #F0F0EE;
  --ink:       #0E0E0E;
  --ink-2:     #3A3A3A;
  --ink-3:     #6B6B6B;
  --ink-4:     #9A9A9A;
  --line:      #ECECEA;
  --line-2:    #D8D8D6;
  --accent:    #E63946;
  --accent-soft: rgba(230,57,70,.10);
  --success:   #1A7F3A;
  --success-soft: rgba(26,127,58,.10);
  --warn:      #B07300;
  --warn-soft: rgba(176,115,0,.10);
  --info:      #2563EB;
  --info-soft: rgba(37,99,235,.10);
  --radius: 10px;
  --sans:    'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm: 0 1px 2px rgba(14,14,14,.05);
  --shadow-md: 0 4px 14px rgba(14,14,14,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }

/* === TOP BAR ============================================== */
.ad-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.ad-logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.ad-logo span { color: var(--accent); }
.ad-logo-tag {
  font-size: 10px !important;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4) !important;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 100px;
  margin-left: 4px;
}

.ad-nav { flex: 1; display: flex; gap: 4px; }
.ad-nav a {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 8px;
  transition: all .15s ease;
}
.ad-nav a:hover { color: var(--ink); background: var(--bg-soft); }
.ad-nav a.is-active { color: var(--ink); background: var(--bg-soft-2); }

.ad-logout button {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all .15s ease;
}
.ad-logout button:hover { color: var(--accent); background: var(--accent-soft); }

/* === MAIN ================================================ */
.ad-main {
  flex: 1 1 auto;
  padding: 32px 28px 64px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.ad-page-head {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.ad-page-head h1 {
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 4px;
}
.ad-page-head p {
  color: var(--ink-3);
  font-size: 13.5px;
}
.ad-page-head .ad-actions { display: inline-flex; gap: 8px; }

/* === STATS CARDS ========================================== */
.ad-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.ad-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.ad-stat-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 8px;
}
.ad-stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
}
.ad-stat-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* === SECTION ============================================== */
.ad-section { margin-top: 36px; }
.ad-section-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* === TABLE / LIST ========================================= */
.ad-list {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ad-list-empty {
  padding: 36px;
  text-align: center;
  color: var(--ink-4);
  font-size: 13.5px;
}
.ad-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background .15s ease;
}
.ad-row:last-child { border-bottom: none; }
.ad-row:hover { background: var(--bg-soft); }
.ad-row.is-past { opacity: .55; }

.ad-row-when {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.ad-row-when small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.ad-row-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ad-row-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.ad-row-meta {
  font-size: 12.5px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.ad-row-meta a { color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.ad-row-meta a:hover { color: var(--ink); border-color: var(--ink); }
.ad-row-topic {
  font-size: 12.5px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-row-actions { display: inline-flex; gap: 6px; align-items: center; }

/* === BUTTONS ============================================== */
.ad-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: all .15s ease;
}
.ad-btn:hover { background: #1F1F1F; }
.ad-btn-ghost {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}
.ad-btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); background: var(--bg-soft); }
.ad-btn-danger {
  background: #fff;
  color: var(--accent);
  border-color: var(--accent-soft);
}
.ad-btn-danger:hover { background: var(--accent-soft); border-color: var(--accent); }
.ad-btn-mini { padding: 5px 10px; font-size: 11.5px; }
.ad-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-3);
}
.ad-btn-icon:hover { color: var(--ink); border-color: var(--ink-3); background: var(--bg-soft); }

/* === BADGE ================================================ */
.ad-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ad-badge.is-today    { background: var(--accent-soft);  color: var(--accent); }
.ad-badge.is-soon     { background: var(--warn-soft);    color: var(--warn); }
.ad-badge.is-future   { background: var(--info-soft);    color: var(--info); }
.ad-badge.is-past     { background: var(--bg-soft-2);    color: var(--ink-4); }
.ad-badge.is-success  { background: var(--success-soft); color: var(--success); }
.ad-badge.is-warn     { background: var(--warn-soft);    color: var(--warn); }
.ad-badge.is-new      { background: var(--info-soft);    color: var(--info); }

/* === STATUS PILLS (ATS, CRM) ============================== */
.ad-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  background: #fff;
}
.ad-status-pill.s-new        { color: var(--info); }
.ad-status-pill.s-review     { color: var(--warn); }
.ad-status-pill.s-invited    { color: var(--success); }
.ad-status-pill.s-rejected   { color: var(--ink-4); }
.ad-status-pill.s-hired      { color: var(--success); background: var(--success-soft); }
.ad-status-pill.s-contacted  { color: var(--warn); }
.ad-status-pill.s-qualified  { color: var(--info); background: var(--info-soft); }
.ad-status-pill.s-won        { color: var(--success); background: var(--success-soft); }
.ad-status-pill.s-lost       { color: var(--accent); }

/* === DETAIL TABLE ========================================= */
.ad-detail {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 24px;
  padding: 18px 22px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 14px 0;
}
.ad-detail dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding-top: 4px;
}
.ad-detail dd {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}
.ad-detail dd a { color: var(--ink); border-bottom: 1px solid var(--line-2); }

/* === FORMS (in admin) ===================================== */
.ad-form {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  margin: 40px auto;
  box-shadow: var(--shadow-sm);
}
.ad-form h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 6px;
}
.ad-form p {
  font-size: 13.5px;
  color: var(--ink-3);
  margin-bottom: 20px;
}
.ad-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.ad-field label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.ad-field input,
.ad-field select,
.ad-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.ad-field input:focus,
.ad-field select:focus,
.ad-field textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14,14,14,.06);
}

.ad-error {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.ad-success {
  background: var(--success-soft);
  color: var(--success);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}
.ad-info {
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* === FOOTER =============================================== */
.ad-foot {
  flex: 0 0 auto;
  padding: 16px 28px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--ink-4);
}

/* === ACTIVITY LOG ========================================= */
.ad-activity { list-style: none; padding: 0; margin: 0; }
.ad-activity-item {
  position: relative;
  padding: 12px 14px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  margin-bottom: 8px;
}
.ad-activity-meta {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.ad-activity-meta strong { color: var(--ink-2); font-weight: 600; }
.ad-activity-title { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.ad-activity-body { font-size: 13.5px; color: var(--ink-3); line-height: 1.45; }

/* === TASKS ================================================ */
.ad-tasks { list-style: none; padding: 0; margin: 0; }
.ad-task-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  margin-bottom: 6px;
  transition: all .15s ease;
}
.ad-task-item.is-overdue { border-color: var(--accent); background: var(--accent-soft); }
.ad-task-item.is-today   { border-color: var(--warn); }
.ad-task-item.is-done    { opacity: .55; }
.ad-task-item.is-done .ad-task-title { text-decoration: line-through; }

.ad-task-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-top: 2px;
  transition: all .15s ease;
  font: inherit;
  font-weight: 700;
  flex-shrink: 0;
}
.ad-task-check:hover { border-color: var(--ink); background: var(--bg-soft); }
.ad-task-item.is-done .ad-task-check { background: var(--success); border-color: var(--success); color: #fff; }

.ad-task-body { flex: 1; min-width: 0; }
.ad-task-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.ad-task-meta {
  font-size: 11.5px; color: var(--ink-3);
  display: inline-flex; gap: 12px; flex-wrap: wrap; margin-top: 4px;
}
.ad-task-meta a { color: var(--ink-2); }
.ad-task-meta a:hover { color: var(--accent); }
.ad-task-notes { font-size: 13px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }

/* === TAGS ================================================= */
.ad-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-right: 4px;
  background: var(--bg-soft);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* === SCORE STARS ========================================== */
.ad-stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.ad-stars button {
  font: inherit;
  font-size: 18px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--line-2);
  padding: 0 2px;
  transition: color .12s ease;
}
.ad-stars button:hover,
.ad-stars button.is-active { color: var(--warn); }

/* === SEARCH BOX =========================================== */
.ad-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
  width: 100%;
  max-width: 280px;
}
.ad-search input {
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  outline: none;
}

/* === CHARTS =============================================== */
.ad-chart-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.ad-chart-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.ad-chart-head h3 {
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--ink);
}
.ad-chart-head .ad-chart-sub {
  font-size: 11.5px; color: var(--ink-4);
}
.ad-chart-canvas { height: 220px; position: relative; }

.ad-funnel { display: flex; flex-direction: column; gap: 4px; }
.ad-funnel-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--line);
}
.ad-funnel-bar {
  height: 8px;
  background: var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}
.ad-funnel-label { font-size: 13px; font-weight: 500; flex: 1; min-width: 100px; }
.ad-funnel-value { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; }
.ad-funnel-rate { font-size: 11.5px; color: var(--ink-4); min-width: 60px; text-align: right; }

/* === HAMBURGER TOGGLE (default hidden on desktop) ========= */
.ad-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ad-nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform .2s ease, opacity .2s ease;
}
body.ad-nav-open .ad-nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.ad-nav-open .ad-nav-toggle span:nth-child(2) { opacity: 0; }
body.ad-nav-open .ad-nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Logout-Button Icon-Modus für Mobile (Standard: nur Text sichtbar) */
.ad-logout-icon { display: none; }
.ad-logout-name { display: inline; }

/* Public-Page-Body (Login) — keine Top-Bar Sticky-Effekte nötig */
body.ad-public .ad-top { border-bottom: 1px solid var(--line); }

/* === MOBILE / TABLET ====================================== */
@media (max-width: 900px) {
  .ad-top { gap: 12px; padding: 12px 18px; }
  .ad-nav-toggle { display: inline-flex; }
  .ad-logo { flex: 1; }

  /* Off-Canvas Drawer */
  .ad-nav {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(280px, 86vw);
    background: var(--bg);
    border-left: 1px solid var(--line);
    box-shadow: -8px 0 24px rgba(14,14,14,.10);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 80px 14px 24px;
    transform: translateX(110%);
    transition: transform .25s ease;
    z-index: 100;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.ad-nav-open .ad-nav { transform: translateX(0); }
  .ad-nav a {
    padding: 12px 14px;
    font-size: 14.5px;
    border-radius: 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Backdrop */
  body.ad-nav-open::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(14,14,14,.35);
    z-index: 90;
    animation: ad-fade-in .2s ease;
  }
  @keyframes ad-fade-in { from { opacity: 0; } to { opacity: 1; } }

  /* Logout: nur Icon auf Mobile */
  .ad-logout button { padding: 8px 10px; min-height: 40px; min-width: 40px; }
  .ad-logout-name { display: none; }
  .ad-logout-icon { display: inline; }

  /* Main */
  .ad-main { padding: 22px 16px 48px; }
  .ad-page-head { gap: 12px; margin-bottom: 22px; }
  .ad-page-head h1 { font-size: clamp(20px, 6vw, 26px); }

  /* Stats: 2 Spalten statt 4 */
  .ad-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
  .ad-stat { padding: 14px 16px; }
  .ad-stat-value { font-size: 24px; }

  /* Section / List */
  .ad-section { margin-top: 28px; }
  .ad-section-head { font-size: 10.5px; }

  .ad-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 16px;
  }
  .ad-row-when { font-size: 13px; flex-direction: row; gap: 8px; align-items: baseline; }
  .ad-row-when small { font-size: 11.5px; }
  .ad-row-actions { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }

  /* Detail-Panels */
  .ad-detail { grid-template-columns: 1fr; gap: 4px 0; padding: 16px; }
  .ad-detail dt { padding-top: 12px; }
  .ad-detail dt:first-of-type { padding-top: 0; }

  /* Forms: 2-Spalten-Grids zu 1-Spalte */
  .ad-form [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Touch-Targets */
  .ad-btn, .ad-btn-mini { min-height: 38px; padding: 8px 14px; }
  .ad-btn-mini { padding: 7px 12px; font-size: 12.5px; }
  input[type=text], input[type=email], input[type=password], input[type=date],
  input[type=number], input[type=url], select, textarea {
    min-height: 42px;
    font-size: 16px; /* iOS: kein Auto-Zoom bei Focus */
  }
  textarea { min-height: 80px; }

  /* Filter-Tabs horizontal scrollbar */
  .ad-section-head [style*="display:inline-flex"],
  .ad-section-head .ad-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .ad-section-head [style*="display:inline-flex"] > * { flex-shrink: 0; }

  /* Tabellen mit horizontal scroll */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Charts: höher auf mobile */
  .ad-chart-canvas { height: 260px; }

  /* Funnel-Rows */
  .ad-funnel-row { gap: 8px; padding: 8px 12px; }
  .ad-funnel-label { min-width: 72px; font-size: 12.5px; }
  .ad-funnel-value { min-width: 38px; font-size: 12.5px; }
  .ad-funnel-rate  { min-width: 44px; font-size: 11px; }

  /* Footer */
  .ad-foot { flex-direction: column; gap: 6px; align-items: flex-start; padding: 14px 18px; }
}

/* === SMALL PHONES (≤ 420px) =============================== */
@media (max-width: 420px) {
  .ad-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ad-stat { padding: 12px 14px; }
  .ad-stat-value { font-size: 22px; }
  .ad-stat-label { font-size: 9.5px; letter-spacing: 0.13em; }
  .ad-page-head h1 { font-size: 22px; }
  .ad-logo { font-size: 15px; }
  .ad-logo-tag { display: none; }
}
