/* Base layout */
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f5f7;
  color: #111;

  /* Safe area for iPhones */
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(env(safe-area-inset-bottom) + 60px);
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 22px;
  margin: 0 0 16px;
  text-align: center;
  font-weight: 700;
}

/* Tabs (top segmented) */
.tabs {
  display: flex;
  background: #e5e5ea;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.tab.active {
  background: #ffffff;
  color: #000;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Card base */
.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

/* Segmented control */
.segmented {
  display: flex;
  background: #e5e5ea;
  padding: 3px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.segmented-item {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
  color: #555;
  font-weight: 500;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.segmented-item.active {
  background: #ffffff;
  color: #000;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Fields */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #555;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #d0d0d0;
  font-size: 14px;
  background: #f9f9fb;
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

.row {
  display: flex;
  gap: 8px;
}

.row .field {
  flex: 1;
}

.field-with-add .field-inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

/* Small + button */
.btn-icon {
  width: 42px;
  border-radius: 12px;
  border: none;
  font-size: 20px;
  font-weight: 600;
  background: #e5e5ea;
  cursor: pointer;
}

/* Buttons and status */
.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 11px 12px;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  box-shadow: none;
  cursor: default;
}

.status-msg {
  margin-top: 8px;
  font-size: 13px;
  min-height: 16px;
}

.status-success {
  color: #1b5e20;
}

.status-error {
  color: #b71c1c;
}

/* Pills */
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e5e5ea;
  color: #555;
  margin-bottom: 8px;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pill-button {
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 12px;
  border: none;
  background: #e3f2fd;
  color: #0d47a1;
  cursor: pointer;
}

/* Lists */
.list-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Transaction / client cards */
.item-card {
  border-radius: 14px;
  padding: 10px 12px;
  background: #f9f9fb;
  border: 1px solid #e2e2e7;
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease,
    transform 0.1s ease;
}

.item-card:hover {
  background: #f5f5f7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.item-title {
  font-size: 14px;
  font-weight: 600;
}

.item-sub {
  font-size: 12px;
  color: #6e6e73;
}

.item-notes {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
}

/* Status pills */
.status-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e5e5ea;
  color: #555;
}

.status-pending {
  background: #fff9c4;
  color: #827717;
}

.status-inprogress {
  background: #e3f2fd;
  color: #0d47a1;
}

.status-closedwon {
  background: #c8e6c9;
  color: #1b5e20;
}

.status-closedlost {
  background: #ffcdd2;
  color: #b71c1c;
}

/* Clients list row */
.client-row {
  border-radius: 14px;
  padding: 10px 12px;
  background: #f9f9fb;
  border: 1px solid #e2e2e7;
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease,
    transform 0.1s ease;
}

.client-row:hover {
  background: #f5f5f7;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* Talents list */
.talent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.talent-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e2e7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.talent-row:hover {
  background: #f5f5f7;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.talent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8e8e93, #c7c7cc);
  margin-right: 10px;
}

.talent-main {
  flex: 1;
}

.talent-name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.talent-subtitle {
  font-size: 12px;
  color: #6e6e73;
}

.talent-chevron {
  font-size: 18px;
  color: #c7c7cc;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px;
  z-index: 9999;
}

.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  animation: modalSlideUp 0.28s ease;
  overflow-y: auto;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}

.modal-subtext {
  font-size: 13px;
  color: #6e6e73;
  margin: 0 0 10px;
}

.modal-field {
  margin-bottom: 10px;
}

.modal-field label {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
  color: #555;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d0d0d0;
  font-size: 13px;
  background: #f9f9fb;
}

.modal-field textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-secondary {
  flex: 1;
  padding: 9px 0;
  border-radius: 999px;
  background: #e5e5ea;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-save {
  flex: 2;
  padding: 9px 0;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #007aff;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.modal-table th {
  text-align: left;
  font-size: 12px;
  padding: 4px 4px;
  color: #707070;
  border-bottom: 1px solid #ddd;
}

.modal-table td {
  font-size: 12px;
  padding: 4px 4px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
}

.modal-empty {
  padding: 10px 0;
  text-align: center;
  color: #888;
  font-size: 13px;
}

/* Summary chips */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.summary-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f2f7;
  font-size: 12px;
}

/* Talent Modal — Layout B3 */
.talent-modal-header {
  text-align: center;
  margin-bottom: 14px;
}

.talent-avatar-large {
  width: 70px;
  height: 70px;
  border-radius: 99px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, #8e8e93, #c7c7cc);
}

.talent-modal-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #111;
}

.talent-stats-row {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
}

.talent-stat-card {
  flex: 1;
  background: #f2f2f7;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #e5e5ea;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stat-title {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
}

/* Recent activity */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
  margin-top: 8px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ececec;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.recent-col {
  display: flex;
  flex-direction: column;
}

.recent-date {
  font-size: 12px;
  color: #777;
}

.recent-client {
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.recent-category {
  font-size: 12px;
  color: #555;
  text-align: right;
}

.recent-amount {
  font-size: 13px;
  font-weight: 600;
  color: #000;
  text-align: right;
}

.recent-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 10px;
}

/* ============================================================
   SKELETON LOADERS (Apple Style)
   ============================================================ */

.skeleton-row {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #ececec;
  margin-bottom: 6px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #e5e5ea;
  margin-right: 12px;
  position: relative;
  overflow: hidden;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-line {
  height: 10px;
  border-radius: 6px;
  background: #e5e5ea;
  position: relative;
  overflow: hidden;
}

.skeleton-line-lg {
  width: 70%;
}

.skeleton-line-sm {
  width: 40%;
}

.skeleton-avatar::after,
.skeleton-line::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.6) 50%,
    rgba(255,255,255,0) 100%
  );
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ============================================================
   MOBILE NAVIGATION BAR (Bottom)
   ============================================================ */

.mobile-nav {
  display: none; /* Hidden on desktop */
}

@media (max-width: 540px) {
  .tabs {
    display: none !important;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: #ffffff;
    border-top: 1px solid #e5e5ea;
    padding-bottom: env(safe-area-inset-bottom);
    justify-content: space-around;
    align-items: center;
    z-index: 9999;
  }

  .mobile-nav-button {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: #666;
    padding: 8px 0;
    cursor: pointer;
    transition: color 0.2s;
  }

  .mobile-nav-button.active {
    color: #007aff;
    font-weight: 600;
  }
}

/* ============================================================
   FLOATING SUBMIT BUTTON (Mobile)
   ============================================================ */

@media (max-width: 540px) {
  .floating-submit {
    position: fixed;
    bottom: calc(60px + env(safe-area-inset-bottom));
    right: 16px;
    background: #007aff;
    color: #ffffff;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,122,255,0.4);
    cursor: pointer;
    z-index: 9998;
    display: none;
  }

  #view-add.active-view .floating-submit {
    display: block;
  }

  .btn-primary {
    display: none !important;
  }
}

/* ============================================================
   RESPONSIVE TWEAKS
   ============================================================ */

@media (max-width: 480px) {
  .app { padding: 12px; }
  .card { padding: 14px; }

  .item-title { font-size: 13px; }
  .item-sub { font-size: 11px; }

  .talent-name { font-size: 13px; }
  .talent-subtitle { font-size: 11px; }

  .modal-box {
    max-height: 85vh;
    padding: 18px;
  }
}

* {
  -webkit-text-size-adjust: 100%;
  overflow-wrap: anywhere;
}
