.services-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.services-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.services-header h2 {
  margin: 0;
}

.services-subtitle {
  margin-top: 6px;
  opacity: .75;
  font-size: 13px;
}

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

.services-toolbar input,
.services-toolbar select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  min-height: 38px;
}

.services-toolbar input {
  min-width: 260px;
}

.services-table {
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.services-row {
  display: grid;
  grid-template-columns: 70px 1.35fr 120px 1.8fr 220px;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.services-row.th {
  background: rgba(0,0,0,.04);
  font-weight: 700;
  cursor: default;
}

.services-row:not(.th):hover {
  background: rgba(255,224,102,.20);
  cursor: pointer;
}

.services-row:last-child {
  border-bottom: 0;
}

.svc-id {
  font-weight: 700;
  opacity: .75;
}

.svc-counts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}

.svc-counts span {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(0,0,0,.025);
}

.service-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  max-width: 210px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-badge.green {
  background: #dff7e7;
  color: #0f6b2c;
  border-color: #8bd3a3;
}

.service-badge.yellow {
  background: #fff2bf;
  color: #8a6400;
  border-color: #e1bd3f;
}

.service-badge.red {
  background: #ffd6d6;
  color: #9d0000;
  border-color: #ef9a9a;
}

.service-badge.gray {
  background: #eeeeee;
  color: #555;
  border-color: #cccccc;
}

.services-empty {
  padding: 14px;
  opacity: .7;
}

.services-loading,
.services-error {
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.10);
}

.services-error {
  background: #ffe0e0;
  color: #900;
}

@media (max-width: 900px) {
  .services-row {
    grid-template-columns: 60px 1fr;
  }

  .services-row.th {
    display: none;
  }

  .services-row > div:nth-child(3),
  .services-row > div:nth-child(4),
  .services-row > div:nth-child(5) {
    grid-column: 2;
  }

  .services-toolbar input {
    min-width: 100%;
  }
}
.service-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.36);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 14px;
}

.service-modal {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  padding: 16px;
}

.service-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(0,0,0,.08);
  padding-bottom: 12px;
}

.service-modal-head h3 {
  margin: 0 0 4px 0;
}

.service-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.service-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.service-tab {
  border: 1px solid rgba(0,0,0,.14);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

.service-tab.active {
  background: #ffe066;
  border-color: #e0bd30;
}

.service-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.service-field.full,
.service-checks.full,
.service-advanced.full {
  grid-column: 1 / -1;
}

.service-field label {
  display: block;
  font-size: 12px;
  opacity: .75;
  margin-bottom: 5px;
}

.service-field input,
.service-field select,
.service-field textarea {
  width: 100%;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.service-field textarea {
  min-height: 78px;
  resize: vertical;
}

.service-field.ok input,
.service-field.ok select,
.service-field.ok textarea {
  border: 2px solid #1a7f37;
  background: #e6ffea;
}

.service-field.bad input,
.service-field.bad select,
.service-field.bad textarea {
  border: 2px solid #d10000;
  background: #ffe0e0;
}

.service-error {
  color: #b00000;
  font-size: 12px;
  margin-top: 4px;
  min-height: 14px;
}

.service-checks {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  background: rgba(0,0,0,.025);
}

.service-checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.service-advanced {
  border: 1px dashed rgba(0,0,0,.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,.025);
}

.service-advanced summary {
  cursor: pointer;
  font-weight: 700;
}

.service-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  padding-top: 12px;
}

.service-tab-placeholder {
  padding: 18px;
  border-radius: 14px;
  background: #f7f7f7;
  border: 1px solid rgba(0,0,0,.10);
  opacity: .8;
}

@media (max-width: 760px) {
  .service-form-grid {
    grid-template-columns: 1fr;
  }
}

.service-tab-section h4 {
  margin: 0 0 4px 0;
}

.service-tab-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.service-price-table {
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.service-price-row {
  display: grid;
  grid-template-columns: 90px 1.5fr 120px 120px 90px 90px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.service-price-row.th {
  background: rgba(0,0,0,.04);
  font-weight: 700;
}

.service-price-row:not(.th):hover {
  background: rgba(255,224,102,.20);
  cursor: pointer;
}

.service-price-empty {
  padding: 14px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  background: #f7f7f7;
  opacity: .75;
}

.service-price-form {
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,.02);
}

.service-tab-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 900px) {
  .service-price-row {
    grid-template-columns: 80px 1fr;
  }

  .service-price-row.th {
    display: none;
  }

  .service-price-row > div:nth-child(n+3) {
    grid-column: 2;
  }
}

.service-field-hint {
  font-size: 11px;
  opacity: .65;
  margin: -2px 0 5px 0;
}

.service-field.warn input,
.service-field.warn select,
.service-field.warn textarea {
  border: 2px solid #d4a500;
  background: #fff2cc;
}

.service-price-row.has-step {
  box-shadow: inset 4px 0 0 #1a7f37;
}

.service-price-row.no-step {
  box-shadow: inset 4px 0 0 #d4a500;
}

.service-price-row.selected {
  background: #fff2bf;
  box-shadow: inset 5px 0 0 #d4a500;
}

.service-price-row.selected:hover {
  background: #ffeaa0;
}

.service-tab-header .btn {
  white-space: nowrap;
}

.service-price-row.ok {
  box-shadow: inset 5px 0 0 #1a7f37;
  background: #f6fff8;
}

.service-price-row.warn,
.service-price-row.no-step {
  box-shadow: inset 5px 0 0 #d4a500;
  background: #fff8d8;
}

.service-price-row.bad {
  box-shadow: inset 5px 0 0 #d10000;
  background: #ffe0e0;
}

.service-price-row.inactive {
  box-shadow: inset 5px 0 0 #999;
  background: #eeeeee;
  opacity: .75;
}

.service-price-row.selected {
  outline: 2px solid #d4a500;
  outline-offset: -2px;
}

/* Consistent row status colors - same principle as Kunder */
.services-row.green:not(.th) {
  background: #e8f8ee;
  border-left: 8px solid #22c55e;
}

.services-row.yellow:not(.th) {
  background: #fff3bf;
  border-left: 8px solid #eab308;
}

.services-row.red:not(.th) {
  background: #ffd6d6;
  border-left: 8px solid #dc2626;
}

.services-row.gray:not(.th) {
  background: #eeeeee;
  border-left: 8px solid #9ca3af;
  opacity: .85;
}

.services-row.green:not(.th):hover {
  background: #d9f3e2;
}

.services-row.yellow:not(.th):hover {
  background: #ffeaa0;
}

.services-row.red:not(.th):hover {
  background: #ffc2c2;
}

.services-row.gray:not(.th):hover {
  background: #e2e2e2;
}

/* Stronger service row status colors */
.services-row.green:not(.th) {
  background: #c9f7d8 !important;
  border-left: 10px solid #16a34a !important;
}

.services-row.yellow:not(.th) {
  background: #fff0a8 !important;
  border-left: 10px solid #eab308 !important;
}

.services-row.red:not(.th) {
  background: #ffc4c4 !important;
  border-left: 10px solid #dc2626 !important;
}

.services-row.gray:not(.th) {
  background: #e5e7eb !important;
  border-left: 10px solid #6b7280 !important;
  opacity: .95 !important;
}

.services-row.green:not(.th):hover {
  background: #b8efcb !important;
}

.services-row.yellow:not(.th):hover {
  background: #ffe27a !important;
}

.services-row.red:not(.th):hover {
  background: #ffadad !important;
}

.services-row.gray:not(.th):hover {
  background: #d1d5db !important;
}

/* Stronger service modal tabs and icons */
.service-tabs {
  gap: 8px;
  flex-wrap: wrap;
}

.service-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d6dce8;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}

.service-tab:hover {
  background: #fff7cc;
  border-color: #eab308;
}

.service-tab.active {
  background: #ffe266 !important;
  border-color: #d4a500 !important;
  color: #111827 !important;
  box-shadow: 0 4px 10px rgba(212, 165, 0, .25);
}

.service-tab[data-tab="base"]::before {
  content: "\2699";
}

.service-tab[data-tab="prices"]::before {
  content: "\1F4B0";
}

.service-tab[data-tab="cti"]::before {
  content: "\260E";
}

.service-tab[data-tab="legacy"]::before {
  content: "\1F5C4";
}

.service-tab[data-tab="flow"]::before {
  content: "\1F500";
}

.service-tab[data-tab="providers"]::before {
  content: "\1F517";
}

.service-tab[data-tab="sms"]::before {
  content: "\1F4F2";
}

.service-tab[data-tab="email"]::before {
  content: "\2709";
}

/* Stronger modal status pill */
.service-modal-head-actions .service-badge {
  min-width: 110px;
  height: 34px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  border-width: 2px;
}

.service-modal-head-actions .service-badge.green::before {
  content: "\2714  ";
}

.service-modal-head-actions .service-badge.yellow::before {
  content: "\26A0  ";
}

.service-modal-head-actions .service-badge.red::before {
  content: "\26D4  ";
}

.service-modal-head-actions .service-badge.gray::before {
  content: "\25CF  ";
}

/* Clearer service form fields */
.service-field label {
  font-weight: 700;
  color: #334155;
}

.service-field input,
.service-field select,
.service-field textarea {
  border: 1px solid #d6dce8;
  background: #ffffff;
}

.service-field input:focus,
.service-field select:focus,
.service-field textarea:focus {
  outline: none;
  border-color: #2f7fc1;
  box-shadow: 0 0 0 3px rgba(47, 127, 193, .18);
}

.service-field.ok input,
.service-field.ok select,
.service-field.ok textarea {
  border-color: #22c55e;
  background: #f0fdf4;
}

.service-field.bad input,
.service-field.bad select,
.service-field.bad textarea {
  border-color: #dc2626;
  background: #fff1f2;
}

/* Checkbox bar more visible */
.service-checks {
  background: #f8fafc;
  border: 1px solid #d6dce8;
  border-radius: 14px;
  padding: 12px 14px;
}

.service-checks label {
  font-weight: 700;
}

/* Cleaner modal status text */
.service-modal-head-actions .service-badge.gray {
  color: transparent !important;
  position: relative;
}

.service-modal-head-actions .service-badge.gray::before {
  content: "● Ej sparad";
  color: #374151;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
}

.service-modal-head-actions .service-badge.green {
  color: transparent !important;
  position: relative;
}

.service-modal-head-actions .service-badge.green::before {
  content: "✓ OK";
  color: #0f6b2c;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
}

.service-modal-head-actions .service-badge.yellow {
  color: transparent !important;
  position: relative;
}

.service-modal-head-actions .service-badge.yellow::before {
  content: "⚠ Varning";
  color: #8a6400;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
}

.service-modal-head-actions .service-badge.red {
  color: transparent !important;
  position: relative;
}

.service-modal-head-actions .service-badge.red::before {
  content: "⛔ Fel";
  color: #9d0000;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
}
