/* ==========================================================================
 *  app-shell.css — gemeinsame Styles für die neuen internen Seiten
 *  (Pipeline, Aktivitäten, Kalender, E-Mails, Wiedervorlagen, Angebote,
 *   Berichte, Einstellungen)
 *
 *  Verwendet Design-Tokens aus crm-contact-redesign.css (--rd-*).
 * ========================================================================== */

.app-page {
  padding: 28px 32px 48px;
  max-width: 1560px;
  margin: 0 auto;
  width: 100%;
}
.app-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.app-page-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--rd-text1, #0F172A);
  letter-spacing: -0.02em;
  margin: 0;
}
.app-page-subtitle {
  font-size: 13.5px;
  color: var(--rd-text3, #64748B);
  margin-top: 6px;
}
.app-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.app-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--rd-border, #E5E7EB);
  background: #fff;
  color: var(--rd-text1, #0F172A);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.app-btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.app-btn:active { transform: translateY(1px); }
.app-btn--primary {
  background: var(--rd-primary, #2563EB);
  color: #fff;
  border-color: var(--rd-primary, #2563EB);
}
.app-btn--primary:hover {
  background: var(--rd-primary-hover, #1D4ED8);
  border-color: var(--rd-primary-hover, #1D4ED8);
}
.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--rd-text2, #334155);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.app-chip.is-active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--rd-primary, #2563EB);
  border-color: rgba(37, 99, 235, 0.25);
}
.app-card {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.app-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.app-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--rd-text1, #0F172A);
  letter-spacing: -0.01em;
}
.app-empty {
  padding: 40px;
  text-align: center;
  color: var(--rd-text3, #64748B);
  font-size: 13px;
}

/* ==========================================================================
 *  PIPELINE BOARD
 * ========================================================================== */
.pl-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(240px, 1fr));
  gap: 18px;
}
.pl-col {
  background: #F8FAFC;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 16px;
  padding: 14px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.pl-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rd-border, #E5E7EB);
}
.pl-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--rd-text1, #0F172A);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pl-col-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.pl-col--neu .pl-col-dot   { background: #94A3B8; }
.pl-col--erreicht .pl-col-dot { background: #2563EB; }
.pl-col--rueckruf .pl-col-dot { background: #7C3AED; }
.pl-col--termin .pl-col-dot   { background: #F97316; }
.pl-col--abschluss .pl-col-dot { background: #16A34A; }
.pl-col-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--rd-text3, #64748B);
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  padding: 2px 8px;
  border-radius: 999px;
}
.pl-cards { display: flex; flex-direction: column; gap: 10px; }
.pl-card {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
.pl-card:hover {
  border-color: #CBD5E1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.pl-card-name { font-size: 13.5px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.pl-card-co { font-size: 12px; color: var(--rd-text3, #64748B); margin-top: 2px; }
.pl-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.pl-card-val {
  font-size: 12px; font-weight: 700; color: var(--rd-primary, #2563EB);
}
.pl-card-tag {
  font-size: 10.5px; font-weight: 600; color: var(--rd-text3, #64748B);
  background: #F1F5F9; padding: 2px 8px; border-radius: 999px;
}

/* ==========================================================================
 *  ACTIVITIES FEED
 * ========================================================================== */
.act-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.act-feed { display: flex; flex-direction: column; gap: 10px; }
.act-item {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 14px;
}
.act-ic {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: #F1F5F9; color: var(--rd-primary, #2563EB);
}
.act-ic--call { background: rgba(22,163,74,.1); color: #16A34A; }
.act-ic--email { background: rgba(124,58,237,.1); color: #7C3AED; }
.act-ic--note { background: rgba(37,99,235,.1); color: #2563EB; }
.act-ic--meeting { background: rgba(249,115,22,.1); color: #F97316; }
.act-body { flex: 1; }
.act-title { font-size: 13.5px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.act-sub { font-size: 12px; color: var(--rd-text3, #64748B); margin-top: 2px; }
.act-time { font-size: 11.5px; color: var(--rd-text3, #64748B); white-space: nowrap; }

/* ==========================================================================
 *  CALENDAR
 * ========================================================================== */
.cal-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
.cal-month {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  padding: 20px;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.cal-day-name {
  font-size: 11px; font-weight: 700; color: var(--rd-text3, #64748B);
  text-align: center; padding: 6px 0; text-transform: uppercase;
}
.cal-cell {
  aspect-ratio: 1;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 10px;
  padding: 6px;
  font-size: 12px;
  color: var(--rd-text2, #334155);
  position: relative;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.cal-cell:hover { background: #F8FAFC; }
.cal-cell.is-today { border-color: var(--rd-primary, #2563EB); background: rgba(37,99,235,.05); }
.cal-cell.is-other { color: #CBD5E1; }
.cal-cell-dot { position: absolute; bottom: 4px; left: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--rd-primary, #2563EB); }
.cal-upcoming { display: flex; flex-direction: column; gap: 10px; }
.cal-item {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 12px;
  padding: 12px 14px;
}
.cal-item-title { font-size: 13px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.cal-item-time { font-size: 12px; color: var(--rd-primary, #2563EB); font-weight: 600; margin-top: 2px; }
.cal-item-sub { font-size: 11.5px; color: var(--rd-text3, #64748B); margin-top: 4px; }

/* ==========================================================================
 *  EMAILS
 * ========================================================================== */
.em-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}
.em-sidebar {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  padding: 12px;
  height: fit-content;
}
.em-folder {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--rd-text2, #334155); font-weight: 600;
}
.em-folder:hover { background: #F8FAFC; }
.em-folder.is-active {
  background: rgba(37,99,235,.1);
  color: var(--rd-primary, #2563EB);
}
.em-folder-cnt {
  font-size: 11px; font-weight: 700;
  background: #F1F5F9; padding: 2px 8px; border-radius: 999px;
  color: var(--rd-text3, #64748B);
}
.em-folder.is-active .em-folder-cnt {
  background: rgba(37,99,235,.15); color: var(--rd-primary, #2563EB);
}
.em-list {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  overflow: hidden;
}
.em-row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rd-border, #E5E7EB);
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: background .1s;
}
.em-row:hover { background: #F8FAFC; }
.em-row:last-child { border-bottom: none; }
.em-from { font-size: 13px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.em-preview { font-size: 12.5px; color: var(--rd-text3, #64748B); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-preview strong { color: var(--rd-text1, #0F172A); font-weight: 700; }
.em-date { font-size: 11.5px; color: var(--rd-text3, #64748B); white-space: nowrap; }
.em-row.is-unread .em-from,
.em-row.is-unread .em-preview strong { color: #0F172A; }
.em-row.is-unread { background: #F8FAFF; }

/* ==========================================================================
 *  TASKS / WIEDERVORLAGEN
 * ========================================================================== */
.tk-groups { display: flex; flex-direction: column; gap: 22px; }
.tk-group-hdr {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.tk-group-title {
  font-size: 14px; font-weight: 700; color: var(--rd-text1, #0F172A);
}
.tk-group-cnt {
  font-size: 11.5px; font-weight: 700;
  background: #F1F5F9; color: var(--rd-text3, #64748B);
  padding: 2px 8px; border-radius: 999px;
}
.tk-group--overdue .tk-group-cnt {
  background: rgba(239,68,68,.12); color: #DC2626;
}
.tk-group--open .tk-group-cnt {
  background: rgba(249,115,22,.12); color: #EA580C;
}
.tk-group--done .tk-group-cnt {
  background: rgba(22,163,74,.12); color: #15803D;
}
.tk-list { display: flex; flex-direction: column; gap: 8px; }
.tk-item {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.tk-check {
  width: 20px; height: 20px; border: 2px solid #CBD5E1; border-radius: 6px;
  flex-shrink: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; font-size: 13px; font-weight: 700;
}
.tk-item.is-done .tk-check {
  background: #16A34A; border-color: #16A34A; color: #fff;
}
.tk-item.is-done .tk-title { text-decoration: line-through; color: var(--rd-text3, #64748B); }
.tk-body { flex: 1; }
.tk-title { font-size: 13.5px; font-weight: 600; color: var(--rd-text1, #0F172A); }
.tk-sub { font-size: 11.5px; color: var(--rd-text3, #64748B); margin-top: 2px; }
.tk-due { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tk-due--overdue { background: rgba(239,68,68,.12); color: #DC2626; }
.tk-due--soon { background: rgba(249,115,22,.12); color: #EA580C; }
.tk-due--ok { background: rgba(22,163,74,.12); color: #15803D; }

/* ==========================================================================
 *  OFFERS
 * ========================================================================== */
.of-table {
  width: 100%;
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.of-table th, .of-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--rd-border, #E5E7EB);
}
.of-table thead th {
  background: #F8FAFC;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--rd-text3, #64748B);
  font-weight: 700;
  letter-spacing: 0.03em;
}
.of-table tbody tr:last-child td { border-bottom: none; }
.of-table tbody tr:hover { background: #F8FAFC; cursor: pointer; }
.of-name { font-size: 13.5px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.of-co { font-size: 12px; color: var(--rd-text3, #64748B); }
.of-val { font-weight: 700; color: var(--rd-primary, #2563EB); font-size: 13.5px; }
.of-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
}
.of-badge--open       { background: #F1F5F9; color: #475569; }
.of-badge--sent       { background: rgba(37,99,235,.1); color: #2563EB; }
.of-badge--accepted   { background: rgba(22,163,74,.12); color: #15803D; }
.of-badge--rejected   { background: rgba(239,68,68,.12); color: #DC2626; }
.of-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==========================================================================
 *  REPORTS / KPI
 * ========================================================================== */
.rp-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.rp-kpi {
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 18px;
  padding: 20px;
}
.rp-kpi-lbl {
  font-size: 11.5px;
  color: var(--rd-text3, #64748B);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.rp-kpi-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--rd-text1, #0F172A);
  letter-spacing: -0.03em;
  margin-top: 10px;
}
.rp-kpi-sub { font-size: 12px; color: var(--rd-text3, #64748B); margin-top: 6px; }
.rp-kpi-trend { font-size: 12px; font-weight: 700; margin-top: 8px; }
.rp-kpi-trend--up { color: #16A34A; }
.rp-kpi-trend--down { color: #DC2626; }
.rp-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==========================================================================
 *  SETTINGS
 * ========================================================================== */
.st-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--rd-border, #E5E7EB);
  margin-bottom: 24px;
  overflow-x: auto;
}
.st-tab {
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rd-text3, #64748B);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.st-tab:hover { color: var(--rd-text1, #0F172A); }
.st-tab.is-active {
  color: var(--rd-primary, #2563EB);
  border-bottom-color: var(--rd-primary, #2563EB);
}
.st-panel { display: none; }
.st-panel.is-active { display: block; }
.st-list { display: flex; flex-direction: column; gap: 10px; }
.st-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--rd-border, #E5E7EB);
  border-radius: 14px;
}
.st-row-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: #fff; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.st-row-body { flex: 1; }
.st-row-name { font-size: 13.5px; font-weight: 700; color: var(--rd-text1, #0F172A); }
.st-row-sub { font-size: 12px; color: var(--rd-text3, #64748B); }
.st-role {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  background: #F1F5F9; color: var(--rd-text2, #334155);
}
.st-role--admin { background: rgba(124,58,237,.1); color: #6D28D9; }
.st-role--teamleiter { background: rgba(37,99,235,.1); color: #1D4ED8; }

/* ==========================================================================
 *  RESPONSIVE
 * ========================================================================== */
@media (max-width: 1280px) {
  .pl-board { grid-template-columns: repeat(3, minmax(240px, 1fr)); }
  .rp-kpis { grid-template-columns: repeat(2, 1fr); }
  .rp-charts { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app-page { padding: 20px 16px 40px; }
  .app-page-title { font-size: 22px; }
  .pl-board { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: 1fr; }
  .em-shell { grid-template-columns: 1fr; }
  .em-row { grid-template-columns: 1fr auto; }
  .em-row .em-preview { grid-column: 1 / -1; }
  .rp-kpis { grid-template-columns: 1fr; }
}
