/* ═══════════════════════════════════════════════════
   iCOACH UI Enhancement Layer
   Polishes the existing design without breaking layouts
   ═══════════════════════════════════════════════════ */

/* ── Smoother base typography ── */
body {
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}

/* ── Upgraded input fields ── */
.input,
select,
textarea {
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 10px;
  border: 1.5px solid #dce3ed;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:hover,
select:hover,
textarea:hover {
  border-color: #b8c9da;
}
.input:focus,
select:focus,
textarea:focus {
  border-color: var(--orange, #c96b2c);
  box-shadow: 0 0 0 4px rgba(201, 107, 44, 0.08);
  background: #fff;
}
.input::placeholder,
textarea::placeholder {
  color: #a0aec0;
}

/* ── Better labels ── */
.label {
  font-size: 11px;
  font-weight: 800;
  color: #4a5568;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* ── Upgraded buttons ── */
.btn {
  padding: 10px 18px;
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.btn-primary {
  background: linear-gradient(135deg, var(--orange, #c96b2c), #b85a1f);
  border: none;
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #b85a1f, #a04e18);
}
.btn-secondary {
  background: #fff;
  border: 1.5px solid #dce3ed;
}
.btn-secondary:hover {
  background: #f7f9fc;
  border-color: #c5cfdb;
}

/* ── Upgraded cards ── */
.card {
  border-radius: 16px;
  border: 1px solid #e8edf5;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.card-header {
  padding: 20px 22px 0;
}
.card-header h2 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.card-body {
  padding: 20px 22px;
}

/* ── Better stat cards ── */
.stat-card,
.stat {
  border-radius: 14px;
  padding: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}
.stat-card:hover,
.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.stat-value {
  font-size: 26px;
  font-weight: 900;
}
.stat-label {
  font-size: 11px;
  font-weight: 800;
}

/* ── Better badges ── */
.badge {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.badge.success { background: #dcfce7; color: #15803d; }
.badge.warning { background: #fef3c7; color: #b45309; }
.badge.info { background: #dbeafe; color: #1d4ed8; }
.badge.danger { background: #fee2e2; color: #dc2626; }
.badge.neutral { background: #f1f5f9; color: #64748b; }

/* ── Better tables ── */
.table th {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  background: #f8fafc;
  padding: 12px 14px;
}
.table td {
  padding: 12px 14px;
  font-size: 13px;
}
.table tbody tr {
  transition: background 0.15s;
}
.table tbody tr:hover {
  background: #f8fafc;
}
.table-wrap {
  border-radius: 14px;
  border: 1px solid #e8edf5;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

/* ── Badge-focus pills (QA, B, P) ── */
.badge-focus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 900;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Edit panel ── */
.edit-panel {
  padding: 22px;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  background: linear-gradient(180deg, #fefefe, #f9fafb);
  margin-bottom: 18px;
}
.edit-panel h3 {
  font-size: 17px;
  font-weight: 900;
  color: #1e293b;
  margin: 0 0 18px;
}

/* ── Detail box ── */
.detail-box {
  padding: 20px;
  border-radius: 14px;
  border: 1px solid #e8edf5;
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  margin-top: 18px;
}
.detail-box h3 {
  font-size: 17px;
  font-weight: 900;
  margin: 0 0 16px;
}
.detail-grid {
  gap: 14px;
  font-size: 13px;
}
.detail-grid strong {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
}

/* ── Chart cards ── */
.chart-card {
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e8edf5;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.chart-card h3 {
  font-size: 15px;
  font-weight: 900;
  margin: 0 0 14px;
}

/* ── Better flash messages ── */
.flash {
  padding: 14px 48px 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.flash.success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border-color: #a7f3d0;
}
.flash.error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: #991b1b;
  border-color: #fecaca;
}

/* ── Timeline ── */
.timeline-horizontal {
  gap: 0;
  padding: 14px 0;
}
.timeline-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}
.timeline-item.done .timeline-circle {
  background: linear-gradient(135deg, var(--green, #5c9f67), #4a8a55);
  color: #fff;
  box-shadow: 0 4px 12px rgba(92, 159, 103, 0.3);
}
.timeline-connector.done {
  background: var(--green, #5c9f67);
}

/* ── Login page ── */
.auth-page {
  background: linear-gradient(135deg, #f0f4f8 0%, #e8edf5 50%, #f5f0eb 100%);
}
.auth-wrap {
  gap: 24px;
}
.auth-wrap .hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  background: linear-gradient(135deg, #fff 0%, #faf8f5 100%);
}
.auth-wrap .card:not(.hero) {
  padding-bottom: 8px;
}
.auth-wrap .card:not(.hero) .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 6px;
}

/* ── Page header area ── */
.page h2 {
  letter-spacing: -0.01em;
}

/* ── Filter bar refinement ── */
.filters .input,
.filters select {
  height: 40px;
  font-size: 13px;
}

/* ── Tabs — compact navigation strip ── */
.tabs {
  display: flex !important;
  gap: 4px !important;
  padding: 10px 32px 0 !important;
  background: transparent !important;
  border-bottom: 2px solid #e8edf5;
  flex-wrap: nowrap !important;
}
.tabs a {
  height: auto !important;
  padding: 10px 20px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border-radius: 8px 8px 0 0 !important;
  border: none !important;
  background: transparent !important;
  color: #64748b !important;
  box-shadow: none !important;
  position: relative;
  transition: color 0.2s, background 0.2s;
}
.tabs a:hover {
  background: #f1f5f9 !important;
  color: #1e293b !important;
}
.tabs a.active {
  background: #fff !important;
  color: var(--cdb-blue, #2563d9) !important;
  border: 1px solid #e8edf5 !important;
  border-bottom: 2px solid #fff !important;
  margin-bottom: -2px;
  box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.04) !important;
}

.subtabs {
  gap: 4px !important;
  padding: 8px 32px 0 !important;
}
.subtabs a {
  font-size: 12px !important;
  font-weight: 700;
  border-radius: 8px;
  padding: 7px 14px;
  transition: all 0.2s;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
}
.subtabs a:hover {
  background: #f8fafc;
  color: #1e293b;
}
.subtabs a.active {
  background: var(--orange, #c96b2c) !important;
  color: #fff !important;
  border-color: var(--orange, #c96b2c) !important;
}

/* ── Smooth scrollbar ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Selection color ── */
::selection {
  background: rgba(201, 107, 44, 0.15);
  color: inherit;
}

/* ── Link hover transitions ── */
a {
  transition: color 0.15s;
}

/* ═══════════════════════════════════════════════════
   Coaching Log Form — New Sectioned Layout
   ═══════════════════════════════════════════════════ */
.log-form-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  margin-bottom: 20px;
  overflow: hidden;
}
.log-form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #fefefe 0%, #faf8f5 100%);
}
.log-form-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--orange, #c96b2c), #b85a1f);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
  flex-shrink: 0;
}
.log-form-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: #1e293b;
  letter-spacing: -0.01em;
}
.log-form-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
}

.log-form-section {
  padding: 24px 28px;
  border-bottom: 1px solid #f1f5f9;
}
.log-form-section:last-of-type {
  border-bottom: none;
}
.log-form-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 900;
  color: #334155;
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.log-form-step {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--orange, #c96b2c);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  flex-shrink: 0;
}

.log-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 640px) {
  .log-form-grid { grid-template-columns: 1fr; }
  .log-form-header { padding: 18px 16px; }
  .log-form-section { padding: 18px 16px; }
  .log-form-actions { padding: 18px 16px; }
}

.log-form-fields {
  display: grid;
  gap: 16px;
}

.log-form-actions {
  display: flex;
  gap: 12px;
  padding: 20px 28px 24px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.btn-lg {
  padding: 12px 28px !important;
  font-size: 15px !important;
  min-height: 44px !important;
}

.required-star {
  color: #e73842;
  font-weight: 900;
}

.input-readonly {
  background: #f1f5f9 !important;
  cursor: not-allowed !important;
  color: #64748b !important;
}

.checkbox-group {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}
.checkbox-label:hover {
  border-color: var(--orange, #c96b2c);
  background: #fff8f3;
}
.checkbox-label:has(input:checked) {
  border-color: var(--orange, #c96b2c);
  background: #fff8f3;
  color: var(--orange, #c96b2c);
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--orange, #c96b2c);
  width: 16px;
  height: 16px;
}

/* EOS field numbering */
.eos-field .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.eos-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #eef4ff;
  color: #2563d9;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
}
.eos-time {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.eos-commitment {
  border-top: 2px solid #fef3c7;
  padding-top: 16px;
  margin-top: 4px;
}
.eos-commitment .label {
  color: #b45309;
}

/* ═══════════════════════════════════════════════════
   Coaching Log Detail View
   ═══════════════════════════════════════════════════ */
.log-detail {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  margin-top: 18px;
  overflow: hidden;
}
.log-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 26px;
  background: linear-gradient(135deg, #fefefe, #f8fafc);
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}
.log-detail-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.log-detail-id-badge {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 16px;
  border-radius: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.log-detail-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  color: #1e293b;
}
.log-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.log-detail-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}
.log-detail-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.log-detail-section {
  padding: 22px 26px;
  border-bottom: 1px solid #f1f5f9;
}
.log-detail-section:last-child {
  border-bottom: none;
}
.log-detail-section-title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 16px;
}

.log-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.log-info-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 14px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: #fafbfc;
}
.log-info-icon {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  align-self: center;
}
.log-info-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}
.log-info-value {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
}

.log-content-block {
  padding: 16px 18px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: #fafbfc;
  margin-bottom: 10px;
}
.log-content-block:last-child { margin-bottom: 0; }
.log-content-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 8px;
}
.log-content-body {
  font-size: 14px;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.log-content-pill {
  display: inline-flex;
  padding: 6px 14px;
  border-radius: 8px;
  background: #eef4ff;
  color: #2563d9;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.commitment-block {
  border-color: #fcd34d;
  background: #fffbeb;
}
.commitment-block .log-content-label { color: #b45309; }

.qa-block {
  border-color: #c4b5fd;
  background: #f5f3ff;
}
.qa-block .log-content-label { color: #6d28d9; }

.dispute-block {
  border-color: #fca5a5;
  background: #fef2f2;
}
.dispute-block .log-content-label { color: #dc2626; }

.resolution-block {
  border-color: #86efac;
  background: #f0fdf4;
}
.resolution-block .log-content-label { color: #16a34a; }

.log-dispute-section {
  background: #fffbfb;
}

.log-detail-footer {
  padding: 22px 26px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.log-resolve-form {
  display: grid;
  gap: 12px;
  max-width: 600px;
}
.log-coachee-actions {
  display: grid;
  gap: 16px;
}
.log-dispute-form {
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.log-dispute-form .field {
  margin-bottom: 10px;
}

/* ── Two-column layout (Timeline + Follow-ups) ── */
.log-detail-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.log-detail-two-col.single-col {
  grid-template-columns: 1fr;
}
@media (max-width: 768px) {
  .log-detail-two-col { grid-template-columns: 1fr; }
}

/* ── Vertical Timeline ── */
.timeline-vertical {
  display: grid;
  gap: 0;
  position: relative;
}
.tl-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.tl-row:last-child { padding-bottom: 0; }
.tl-row::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}
.tl-row:last-child::before { display: none; }
.tl-row.done::before { background: var(--green, #5c9f67); }
.tl-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.tl-row.done .tl-dot {
  background: linear-gradient(135deg, var(--green, #5c9f67), #4a8a55);
  color: #fff;
  box-shadow: 0 3px 8px rgba(92, 159, 103, 0.3);
}
.tl-row.active .tl-dot {
  background: var(--orange, #c96b2c);
  color: #fff;
  box-shadow: 0 3px 8px rgba(201, 107, 44, 0.3);
  animation: tlPulse 2s ease-in-out infinite;
}
@keyframes tlPulse {
  0%, 100% { box-shadow: 0 3px 8px rgba(201, 107, 44, 0.3); }
  50% { box-shadow: 0 3px 16px rgba(201, 107, 44, 0.5); }
}
.tl-content { min-width: 0; }
.tl-label {
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}
.tl-date {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* ── Follow-Up Chain ── */
.sub-logs-list {
  display: grid;
  gap: 8px;
}
.sub-log-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  background: #fafbfc;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.sub-log-card:hover {
  background: #f0f4ff;
  border-color: #c7d2fe;
  box-shadow: 0 4px 12px rgba(37, 99, 217, 0.08);
  transform: translateY(-1px);
}
.sub-log-id {
  font-size: 13px;
  font-weight: 900;
  color: #1e293b;
  background: #e2e8f0;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.sub-log-info {
  min-width: 0;
}
.sub-log-meta {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}
.sub-log-people {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-top: 2px;
}
.sub-log-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.sub-log-arrow {
  font-size: 24px;
  color: #94a3b8;
  font-weight: 300;
}

@media (max-width: 768px) {
  .log-detail-header { flex-direction: column; align-items: flex-start; padding: 16px; }
  .log-detail-header-actions { width: 100%; }
  .log-detail-header-actions .btn { flex: 1; }
  .log-detail-section { padding: 16px; }
  .log-detail-info-grid { grid-template-columns: 1fr; }
  .log-detail-footer { padding: 16px; }
  .sub-log-card { grid-template-columns: 1fr; gap: 8px; }
  .sub-log-badges { justify-content: flex-start; }
  .sub-log-arrow { display: none; }
}

/* ── Clickable coaching ID in table ── */
.log-id-link {
  color: #2563d9;
  font-weight: 900;
  text-decoration: none;
}
.log-id-link:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

/* ── Follow-up row indent in table ── */
.follow-up-row {
  background: #f8fafc !important;
}
.follow-up-row td:first-child {
  padding-left: 28px !important;
}
.follow-up-indent {
  color: #94a3b8;
  font-size: 15px;
  margin-right: 4px;
  font-weight: 400;
}

/* ── Focus visible for accessibility ── */
:focus-visible {
  outline: 2px solid var(--orange, #c96b2c);
  outline-offset: 2px;
}
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--orange, #c96b2c);
  outline-offset: 2px;
}
