/* Oswald loaded via <link> in _layout_head.php */

/* ===== VARS ===== */
:root {
  --orange: #FF9500;
  --orange-dark: #E68800;
  --text: #1E1E1E;
  --muted: #757575;
  --bg: #F2F2F2;
  --card: #FFFFFF;
  --border: #EBEBEB;
  --appbar-h: 56px;
  --r: 14px;
  --r-btn: 10px;
  --r-input: 12px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: contain;
}

a { color: inherit; }
button { font-family: 'Oswald', sans-serif; }
select, input, textarea { font-family: 'Oswald', sans-serif; }

/* ===== LAYOUT ===== */
.lk-app { min-height: 100vh; }

/* ===== APPBAR ===== */
.lk-appbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--orange);
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
}
.lk-appbar-title {
  color: #fff;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  flex: 1;
}
.lk-appbar-btn {
  color: #fff;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms;
  flex-shrink: 0;
}
.lk-appbar-btn:hover { background: rgba(255,255,255,0.18); }

/* ===== FLASH ===== */
.lk-flash {
  margin: 10px 12px 0;
  padding: 10px 14px;
  border-radius: var(--r-btn);
  font-size: 0.85rem;
  font-weight: 500;
}
.lk-flash.error   { background: #FEE2E2; color: #991B1B; }
.lk-flash.success { background: #D1FAE5; color: #065F46; }
.lk-flash.info    { background: #DBEAFE; color: #1E40AF; }

/* ===== CARD ===== */
.lk-card {
  background: var(--card);
  border-radius: var(--r);
  margin: 12px 12px 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* date + tags row */
.lk-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.lk-date {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 400;
  white-space: nowrap;
}
.lk-tags {
  font-size: 0.9rem;
  color: var(--orange);
  font-weight: 400;
  text-align: right;
  line-height: 1.4;
}

/* phone row */
.lk-phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 4px 0 14px;
}
.lk-action-btns {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.lk-phone-link {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-right: 4px;
}
.lk-phone-link:hover { color: var(--orange); }

.lk-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 150ms;
  color: var(--text);
}
.lk-icon-btn:hover { opacity: 0.6; }

/* status select — wrapper provides the arrow via ::after */
.lk-select-wrap {
  position: relative;
  display: block;
  margin-bottom: 14px;
}
.lk-select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #1E1E1E;
  pointer-events: none;
}
.lk-select {
  width: 100%;
  padding: 10px 36px 10px 16px;
  border: none;
  border-radius: var(--r-btn);
  background-color: #F0F0F0;
  background-image: none;
  font-family: 'Oswald', sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  margin-bottom: 0;
  transition: box-shadow 150ms;
}
.lk-select:focus { outline: none; box-shadow: 0 0 0 2px var(--orange); }

/* comments block */
.lk-comments {
  background: #FAFAFA;
  border-radius: var(--r-btn);
  padding: 12px 14px;
  margin-top: 14px;
}

.lk-comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.lk-comment:first-child { padding-top: 2px; }
.lk-comment:last-child { border-bottom: none; padding-bottom: 2px; }
.lk-comment-meta {
  font-size: 0.75rem;
  color: var(--text);
  font-weight: 400;
  margin-bottom: 2px;
}
.lk-comment-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.45;
  font-weight: 400;
}

/* comment textarea */
.lk-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--text);
  border-radius: var(--r-btn);
  font-family: 'Oswald', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text);
  background: var(--card);
  resize: none;
  min-height: 88px;
}
.lk-textarea:focus { outline: none; border-color: var(--orange); }
.lk-textarea::placeholder { color: #C7C7C7; }

/* deadline row */
.lk-deadline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  opacity: 0.35;
  transition: opacity 200ms;
}
.lk-deadline-row.on { opacity: 1; }
.lk-deadline-icon {
  flex-shrink: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.lk-deadline-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  font-family: 'Oswald', sans-serif;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
  -webkit-appearance: none;
  transition: border-color 150ms;
  cursor: pointer;
}
.lk-deadline-input:focus { outline: none; border-color: var(--orange); }

/* toggle switch */
.lk-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  display: inline-block;
}
.lk-toggle input { display: none; }
.lk-toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 12px;
  transition: background 200ms;
}
.lk-toggle input:checked ~ .lk-toggle-track { background: #22c55e; }
.lk-toggle-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 200ms;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.lk-toggle input:checked ~ .lk-toggle-thumb { transform: translateX(18px); }

/* deadline badge + done button */
.lk-deadline-done {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}
.lk-deadline-badge {
  font-size: 0.8em;
  color: var(--orange);
  font-weight: 400;
}
.lk-done-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #22c55e;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity 150ms;
}
.lk-done-btn:hover { opacity: 0.6; }

/* save button */
.lk-btn-save {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--r-btn);
  padding: 12px 32px;
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  margin-top: 10px;
  min-height: 48px;
  transition: background 150ms;
}
.lk-btn-save:hover { background: var(--orange-dark); }

/* no leads */
.lk-no-leads {
  margin: 12px;
  padding: 32px 16px;
  background: var(--card);
  border-radius: var(--r);
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== LEAD LIST ===== */
.lk-list-section { margin: 4px 12px 24px; }
.lk-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
}
.lk-list-title {
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--orange);
}
.lk-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--r-btn);
  padding: 6px 16px;
  font-family: 'Oswald', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 36px;
  letter-spacing: 0.02em;
}
.lk-list-card {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.lk-list-item {
  display: flex;
  align-items: center;
  padding: 11px 4px 11px 12px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 150ms;
  min-height: 52px;
}
.lk-list-item:last-child { border-bottom: none; }
.lk-list-item:hover { background: rgba(255,149,0,0.05); }
.lk-list-item.lk-active { background: rgba(255,149,0,0.07); }
.lk-list-phone {
  font-size: 0.9rem;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text);
  min-width: 108px;
}
.lk-list-comment {
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-weight: 400;
}
.lk-list-eye {
  flex-shrink: 0;
  color: var(--text);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 150ms;
}
.lk-list-item:hover .lk-list-eye { color: var(--orange); }

/* ===== LOGIN ===== */
.lk-login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lk-login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--r);
  padding: 32px 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.09);
}
.lk-login-logo {
  width: 60px;
  height: 60px;
  display: block;
  margin: 0 auto 16px;
  border-radius: var(--r-btn);
}
.lk-login-title {
  font-size: 1.8rem;
  font-weight: 400;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.lk-login-sub {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
  font-weight: 400;
}
.lk-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: var(--card);
  transition: border-color 150ms;
  margin-bottom: 12px;
  -webkit-appearance: none;
}
.lk-input:focus { outline: none; border-color: var(--orange); }
.lk-btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--r-btn);
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  min-height: 50px;
  letter-spacing: 0.03em;
  transition: background 150ms;
}
.lk-btn-primary:hover { background: var(--orange-dark); }

/* ===== BADGE ===== */
.lk-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
}

/* ===== TOAST ===== */
.lk-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1E1E1E;
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--r-btn);
  font-family: 'Oswald', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  z-index: 9999;
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  white-space: nowrap;
  pointer-events: none;
}
.lk-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== LOADER (font FOUT prevention) ===== */
.lk-loader {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 99999;
  opacity: 1;
  transition: opacity 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lk-loader-dots { display: flex; gap: 8px; }
.lk-loader-dot {
  width: 11px;
  height: 11px;
  background: var(--orange);
  border-radius: 50%;
  animation: lkPulse 0.9s infinite ease-in-out;
}
.lk-loader-dot:nth-child(2) { animation-delay: 0.15s; }
.lk-loader-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes lkPulse {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
  40%            { transform: scale(1);    opacity: 1; }
}

/* ===== NEW LEAD BUTTON ===== */
.lk-new-lead-section {
  margin: 12px 12px 4px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.lk-btn-new-lead {
  width: 100%;
  padding: 14px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--r-btn);
  font-family: 'Oswald', sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  min-height: 52px;
  transition: background 150ms;
}
.lk-btn-new-lead:hover { background: var(--orange-dark); }

@media (min-width: 480px) {
  .lk-card, .lk-list-section, .lk-no-leads {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
  .lk-appbar { max-width: 480px; margin: 0 auto; }
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #E8E8E8;
  }
  .lk-app {
    width: 100%;
    max-width: 480px;
    background: var(--bg);
    min-height: 100vh;
  }
}
