/* extracted from crm/customers.html */

:root {
      --bg: #f7f7f8;
      --fg: #111827;
      --muted: #6b7280;
      --line: #e5e7eb;
      --card: #fff;
      --brand: #2563eb;
    }

    * {
      box-sizing: border-box
    }

    body {
      margin: 20px;
      font-family: system-ui, Segoe UI, Roboto, Arial;
      background: var(--bg);
      color: var(--fg)
    }

    h1 {
      margin: 0 0 10px
    }

    .toolbar {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      margin: 8px 0 16px
    }

    .btn {
      appearance: none;
      border: 1px solid var(--line);
      background: #fff;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer
    }

    .btn.primary {
      background: var(--brand);
      color: #fff;
      border-color: var(--brand)
    }

    .input,
    .select {
      padding: 8px 10px;
      border: 1px solid var(--line);
      border-radius: 8px
    }

    .input {
      min-width: 260px
    }

    .grid {
      display: block;
      position: relative;
      overflow: visible;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 14px;
      user-select: none;
      position: relative;
      overflow: visible;
      transition: transform .12s ease, opacity .12s ease, box-shadow .18s ease;
    }

    .card.active {
      outline: 2px solid var(--brand);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, .15)
    }

    .card.dragging {
      opacity: .6
    }

    .card.drop-target {
      outline: 2px dashed #94a3b8
    }

    /* Flash-Highlight */
    @keyframes flashCard {
      0% {
        outline-color: #f59e0b;
        box-shadow: 0 0 0 6px rgba(245, 158, 11, .25)
      }

      100% {
        outline-color: transparent;
        box-shadow: none
      }
    }

    .card.flash {
      outline: 2px solid #f59e0b;
      animation: flashCard .8s ease-out 1
    }

    .row {
      display: flex;
      justify-content: space-between;
      gap: 10px
    }

    .name {
      font-weight: 700
    }

    .muted {
      color: var(--muted);
      font-size: 12px
    }

    .pill {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid var(--line);
      font-size: 12px
    }

    .pill.ok {
      background: #ecfdf5;
      color: #065f46;
      border-color: #d1fae5
    }

    .pill.warn {
      background: #fffbeb;
      color: #92400e;
      border-color: #fde68a
    }

    .pill.danger {
      background: #fef2f2;
      color: #991b1b;
      border-color: #fecaca
    }

    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px
    }

    .icon-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 12px;
    }

    .icon-btn {
      width: 36px;
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
      color: #334155;
      cursor: pointer;
      transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease, color .12s ease;
    }

    .icon-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 22px rgba(15, 23, 42, .08);
      border-color: rgba(37, 99, 235, .28);
      color: var(--brand);
    }

    .icon-btn svg {
      width: 17px;
      height: 17px;
      pointer-events: none;
    }

    .icon-btn.danger:hover {
      border-color: rgba(239, 68, 68, .28);
      color: #b91c1c;
    }

    .icon-btn.is-disabled,
    .icon-btn:disabled {
      opacity: .45;
      cursor: default;
      transform: none;
      box-shadow: none;
    }

    .card-summary-actions {
      display: flex;
      justify-content: flex-end;
      margin-top: 10px
    }

    .btn-detail-toggle {
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 12px;
      color: #475569;
      background: rgba(255, 255, 255, .92);
      border-color: #dbe3ef;
      letter-spacing: .01em;
    }

    .btn-detail-toggle:hover {
      border-color: rgba(37, 99, 235, .28);
      color: var(--brand);
    }

    .card-details-backdrop {
      display: none;
    }

    .customer-shell {
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .customer-rail {
      display: flex;
      gap: 12px;
      overflow-x: auto;
      overflow-y: hidden;
      padding: 4px 4px 10px;
      scroll-snap-type: x proximity;
      scroll-padding-left: 4px;
    }

    .customer-rail>.card {
      flex: 0 0 clamp(220px, calc((100% - 60px) / 6), 260px);
      min-height: 188px;
      scroll-snap-align: start;
    }

    .customer-rail::-webkit-scrollbar {
      height: 10px;
    }

    .customer-rail::-webkit-scrollbar-thumb {
      background: #d7dbe3;
      border-radius: 999px;
    }

    body.card-detail-mode .customer-rail>.card:not(.detail-open) {
      filter: blur(2.5px);
      opacity: .52;
      transform: scale(.985);
    }

    .card.detail-open {
      z-index: 2;
      box-shadow: 0 22px 42px rgba(15, 23, 42, .12);
      outline: 2px solid rgba(37, 99, 235, .18);
      background: #fff;
    }

    .customer-workspace {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 22px;
      padding: 18px 18px 20px;
      box-shadow: 0 20px 48px rgba(15, 23, 42, .08);
      min-height: 420px;
    }

    .customer-workspace-empty {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 8px;
      min-height: 220px;
    }

    .customer-workspace-empty-title {
      font-size: 1.08rem;
      font-weight: 700;
      color: #0f172a;
    }

    .workspace-header {
      display: flex;
      flex-direction: column;
      gap: 14px;
      margin-bottom: 18px;
    }

    .card-detail-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
    }

    .card-detail-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      margin-top: 6px;
    }

    .card-detail-close {
      margin-left: auto;
    }

    .workspace-header-summary {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 16px;
      padding-top: 12px;
      border-top: 1px solid var(--line);
    }

    .workspace-customer-line {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 4px;
    }

    .workspace-summary-pills {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
    }

    .customer-workspace-grid {
      display: grid;
      grid-template-columns: minmax(220px, 1.5fr) minmax(0, 2.5fr) minmax(240px, 1.5fr);
      gap: 20px;
      align-items: start;
    }

    .detail-nav {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding-right: 16px;
      border-right: 1px solid var(--line);
      min-height: 0;
      position: sticky;
      top: 12px;
    }

    .detail-nav-btn {
      appearance: none;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: flex-start;
      gap: 6px;
      width: 100%;
      min-width: 0;
      border: 1px solid transparent;
      background: rgba(248, 250, 252, .9);
      color: var(--fg);
      border-radius: 12px;
      padding: 10px 12px;
      cursor: pointer;
      text-align: left;
      transition: background .12s ease, border-color .12s ease, transform .08s ease, box-shadow .12s ease;
    }

    .detail-nav-btn:hover {
      transform: translateX(2px);
      border-color: rgba(37, 99, 235, .20);
      background: #fff;
      box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
    }

    .detail-nav-btn.active {
      background: rgba(37, 99, 235, .08);
      border-color: rgba(37, 99, 235, .22);
      color: #0f172a;
      box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .05);
    }

    .detail-nav-label {
      font-weight: 600;
      font-size: 13px;
      line-height: 1.2;
      width: 100%;
      min-width: 0;
    }

    .detail-nav-meta {
      color: var(--muted);
      font-size: 12px;
      display: block;
      width: 100%;
      min-width: 0;
      white-space: normal;
      overflow: visible;
      text-overflow: unset;
      overflow-wrap: anywhere;
      word-break: break-word;
      line-height: 1.35;
      text-align: left;
    }

    .detail-content {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .detail-content-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--line);
      margin-bottom: 12px;
    }

    .detail-content-title {
      font-size: 1rem;
      font-weight: 700;
      color: #0f172a;
    }

    .detail-content-body {
      min-height: 220px;
      overflow: visible;
      padding-right: 0;
    }

    .detail-side {
      display: flex;
      flex-direction: column;
      gap: 12px;
      min-width: 0;
      position: sticky;
      top: 12px;
    }

    .detail-side-card {
      background: #f8fafc;
      border: 1px solid #e7edf6;
      border-radius: 16px;
      padding: 14px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
    }

    .detail-side-title {
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 10px;
    }

    .detail-side-actions {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .detail-side-btn {
      width: 100%;
    }

    .detail-side-note {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
      margin-bottom: 10px;
    }

    .detail-side-stats {
      display: grid;
      gap: 8px;
    }

    .detail-side-stat {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 12px;
      background: #fff;
      border: 1px solid #e5e7eb;
    }

    .detail-side-stat span {
      color: var(--muted);
      font-size: 12px;
    }

    .detail-side-stat strong {
      color: #0f172a;
      font-size: 13px;
      font-weight: 700;
      text-align: right;
    }

    .small {
      font-size: 12px
    }

    details {
      margin-top: 10px
    }

    summary {
      cursor: pointer;
      list-style: none
    }

    summary::-webkit-details-marker {
      display: none
    }

    .caret {
      margin-left: 6px
    }

    table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 8px
    }

    th,
    td {
      border-bottom: 1px solid var(--line);
      padding: 6px 4px;
      text-align: left;
      font-size: 13px
    }

    th {
      font-weight: 600
    }

    .right {
      text-align: right
    }

    .empty {
      color: var(--muted);
      font-style: italic;
      padding: 6px 0
    }

    /* Paket-Labels */
    .paketLabel {
      display: inline-block;
      padding: 2px 6px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      color: #fff
    }

    .paketA {
      background: #2563eb
    }

    .paketB {
      background: #16a34a
    }

    .paketC {
      background: #f59e0b
    }

    /* Drawer */
    #drawer {
      position: fixed;
      top: 0;
      right: -420px;
      width: 420px;
      height: 100%;
      background: #fff;
      border-left: 1px solid #ccc;
      box-shadow: -4px 0 20px rgba(0, 0, 0, .06);
      padding: 16px;
      transition: right .25s ease;
      overflow: auto;
      z-index: 10
    }

    #drawer h3 {
      margin: 0
    }

    #editForm input,
    #editForm textarea {
      width: 100%;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: 8px
    }

    #editForm>div {
      margin-top: 10px
    }

    @media (max-width:1260px) {
      .customer-workspace-grid {
        grid-template-columns: 220px minmax(0, 1fr);
      }

      .detail-side {
        grid-column: 1 / -1;
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      }
    }

    @media (max-width:820px) {
      body.card-detail-mode .customer-rail>.card:not(.detail-open) {
        filter: none;
        opacity: 1;
        transform: none;
      }

      .customer-rail {
        display: grid;
        grid-template-columns: 1fr;
        overflow: visible;
      }

      .customer-rail>.card {
        flex: none;
        min-height: 0;
      }

      .workspace-header-summary {
        flex-direction: column;
      }

      .workspace-summary-pills {
        justify-content: flex-start;
      }

      .customer-workspace-grid {
        grid-template-columns: 1fr;
        gap: 16px;
      }

      .detail-nav {
        position: static;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 12px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      }

      .detail-side {
        position: static;
        display: flex;
        grid-template-columns: none;
      }
    }

    @media (max-width:560px) {
      #drawer {
        width: 100%
      }

      .customer-workspace {
        padding: 14px;
        border-radius: 18px;
      }

      .card-detail-header {
        flex-direction: column;
      }
    }

    /* History badges */
    .badge {
      display: inline-block;
      padding: 2px 6px;
      border-radius: 999px;
      font-size: 11px
    }

    .badge.system {
      background: #eef2ff;
      color: #3730a3
    }

    .badge.milestone {
      background: #ecfdf5;
      color: #065f46
    }

    .badge.note {
      background: #fff7ed;
      color: #9a3412
    }
