/* ═══════════════════════════════════════
   PLANSTY · Global Styles - Premium Edition
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Geist:wght@400;500;600;700;800&display=swap');

:root {
  --navy:         #1D3557;
  --powder:       #A8DADC;
  --ice:          #F8FAFC;
  --white:        #FFFFFF;
  --slate:        #6B7280;
  --coral:        #EE6C4D;

  --green:        #22C55E;
  --yellow:       #F59E0B;
  --red:          #EF4444;
  --green-soft:   #DCFCE7;
  --yellow-soft:  #FEF3C7;
  --red-soft:     #FEE2E2;

  --paper:        #F8FAFC;
  --paper-2:      #F1F5F9;
  --cream:        #F8FAFC;
  --cream-2:      #F1F5F9;
  --surface:      #FFFFFF;
  --line:         #E2E8F0;
  --line-2:       #CBD5E1;
  --ink:          #1D3557;
  --ink-2:        #1E3A5F;
  --muted:        #6B7280;
  --muted-2:      #9CA3AF;
  --sage:         #A8DADC;
  --sage-deep:    #1D3557;
  --sage-soft:    #C9E8E9;
  --sage-glow:    #E8F4F4;
  --terra:        #EE6C4D;
  --terra-soft:   #FDEAE4;
  --gold:         #F59E0B;
  --gold-soft:    #FEF3C7;

  --shadow-sm: 0 1px 3px rgba(29,53,87,0.08), 0 1px 2px rgba(29,53,87,0.06);
  --shadow-md: 0 4px 12px rgba(29,53,87,0.10), 0 2px 6px rgba(29,53,87,0.06);
  --shadow-lg: 0 10px 30px rgba(29,53,87,0.12), 0 4px 10px rgba(29,53,87,0.08);
  --shadow-coral: 0 4px 14px rgba(238,108,77,0.35);
  --shadow-navy: 0 4px 14px rgba(29,53,87,0.30);

  --radius-sm:    10px;
  --radius:       16px;
  --radius-lg:    22px;
  --radius-xl:    28px;
  --radius-pill:  50px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ice);
  background-image:
    radial-gradient(circle at 10% 0%, rgba(168,218,220,0.12), transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(238,108,77,0.06), transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { color: var(--navy); font-weight: 600; letter-spacing: -0.02em; }
a { color: var(--navy); text-decoration: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { transform:translateY(100%); } to { transform:translateY(0); } }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes breathe { 0%,100% { transform:scale(1); } 50% { transform:scale(1.06); } }

/* AVATARS */
.avatar, .client-avatar, .detail-avatar-lg, .account-avatar {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--powder), var(--navy));
  color: white; font-family: 'Geist', sans-serif; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.account-avatar img, .detail-avatar-lg img, .client-avatar img { width:100%; height:100%; object-fit:cover; }
.av0 { background: linear-gradient(135deg, #A8DADC, #1D3557); }
.av1 { background: linear-gradient(135deg, #EE6C4D, #C4502D); }
.av2 { background: linear-gradient(135deg, #F59E0B, #D97706); }
.av3 { background: linear-gradient(135deg, #6B7280, #4B5563); }
.av4 { background: linear-gradient(135deg, #22C55E, #16A34A); }
.av5 { background: linear-gradient(135deg, #A8DADC, #1D3557); }
.av6 { background: linear-gradient(135deg, #EE6C4D, #C4502D); }
.av7 { background: linear-gradient(135deg, #1D3557, #152740); }

/* FORMS */
label, .form-label {
  display: block; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 6px; margin-top: 14px;
}
label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="search"],
input[type="url"], textarea, select {
  width: 100%; padding: 12px 16px;
  background: var(--white); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-family: 'Geist', sans-serif;
  font-size: 14.5px; color: var(--navy); transition: all 0.2s;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--powder);
  box-shadow: 0 0 0 3px rgba(168,218,220,0.25);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  background-size: 12px; padding-right: 38px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-highlight {
  background: var(--sage-glow); border: 1px solid rgba(168,218,220,0.4);
  border-radius: var(--radius); padding: 16px; margin: 16px 0;
}

.duration-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.duration-picker button, .btn-chip {
  padding: 8px 16px; background: var(--white); border: 1.5px solid var(--line);
  border-radius: var(--radius-pill); font-family: 'Geist', sans-serif;
  font-size: 13px; font-weight: 600; color: var(--navy); cursor: pointer; transition: all 0.2s;
}
.duration-picker button:hover, .btn-chip:hover { border-color: var(--powder); color: var(--navy); }
.duration-picker button.active, .btn-chip.active {
  background: var(--navy); border-color: var(--navy); color: white;
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px; border-radius: var(--radius-pill);
  border: none; font-family: 'Geist', sans-serif; font-size: 14px;
  font-weight: 700; cursor: pointer; transition: all 0.22s;
  text-decoration: none; white-space: nowrap; letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--coral); color: white;
  box-shadow: var(--shadow-coral);
  width: 100%;
}
.btn-primary:hover {
  background: #D55A3A; transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(238,108,77,0.45);
}

.btn-secondary, .btn-ghost {
  background: var(--navy); color: white;
  box-shadow: var(--shadow-navy);
  padding: 11px 22px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border-radius: var(--radius-pill);
  font-family: 'Geist', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.22s; border: none;
}
.btn-secondary:hover, .btn-ghost:hover {
  background: #152740; transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(29,53,87,0.38);
}

.btn-danger {
  background: var(--white); color: var(--red);
  border: 1.5px solid var(--line); padding: 11px 20px;
  border-radius: var(--radius-pill); font-family: 'Geist', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }

.btn-new, .add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px 8px 14px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--radius-pill);
  font-family: 'Geist', sans-serif; font-size: 13.5px; font-weight: 700;
  color: var(--navy); cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.btn-new:hover, .add-btn:hover {
  border-color: var(--powder); background: var(--sage-glow);
}

.form-actions {
  display: flex; gap: 10px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--line);
}

/* INPUTS (class) */
.input {
  width: 100%; padding: 12px 16px; background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: 'Geist', sans-serif; font-size: 14.5px; color: var(--navy);
  transition: all 0.2s; -webkit-appearance: none; outline: none;
  display: block; box-sizing: border-box;
}
.input:focus { border-color: var(--powder); box-shadow: 0 0 0 3px rgba(168,218,220,0.25); }
.input::placeholder { color: var(--muted-2); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.label {
  display: block; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--slate); margin-bottom: 6px;
}
.field { margin-bottom: 14px; }

/* MODAL */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(29,53,87,0.35); backdrop-filter: blur(6px);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.25s ease; }
.modal {
  background: var(--ice); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto;
  padding: 10px 22px 40px; animation: slideUp 0.35s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 -20px 60px rgba(29,53,87,0.15);
}
.modal-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--line-2); margin: 12px auto 20px;
}
.modal-title {
  font-family: 'Fraunces', serif; font-weight: 500;
  font-size: 24px; letter-spacing: -0.03em; margin-bottom: 20px; color: var(--navy);
}

/* TOAST */
.toast {
  position: fixed; bottom: 82px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--navy); color: white; padding: 11px 20px;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index: 600; white-space: nowrap; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* PILLS */
.pill { display: inline-flex; align-items: center; padding: 3px 12px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700; }
.pill-pending  { background: var(--yellow-soft); color: #92400E; }
.pill-confirmed { background: var(--green-soft); color: #166534; }
.pill-declined { background: var(--red-soft); color: #991B1B; }

/* SPINNER */
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--line);
  border-top-color: var(--navy); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* EMPTY STATE */
.empty {
  text-align: center; padding: 56px 20px; background: var(--white);
  border: 1.5px dashed var(--line-2); border-radius: var(--radius-lg);
}
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  background: var(--sage-glow); display: flex; align-items: center;
  justify-content: center; font-size: 1.8rem;
}
.empty-title { font-family: 'Fraunces', serif; font-weight: 500; font-size: 20px; letter-spacing: -0.02em; margin-bottom: 6px; }
.empty-desc { font-size: 13.5px; color: var(--muted); max-width: 280px; margin: 0 auto; line-height: 1.6; }

/* SECTION HEADER */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.section-title { font-family: 'Fraunces', serif; font-weight: 500; font-size: 34px; line-height: 1.05; letter-spacing: -0.03em; }
.section-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }

/* ADD BUTTON */
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--coral); color: white; border: none;
  padding: 10px 20px; border-radius: var(--radius-pill);
  font-family: 'Geist', sans-serif; font-weight: 700; font-size: 13px;
  cursor: pointer; transition: all 0.22s; white-space: nowrap;
  flex-shrink: 0; box-shadow: var(--shadow-coral);
}
.btn-add:hover { background: #D55A3A; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(238,108,77,0.4); }

/* ICON BUTTON */
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s; color: var(--muted);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { border-color: var(--powder); color: var(--navy); background: var(--sage-glow); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* CHIPS */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 16px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); background: var(--white);
  font-family: 'Geist', sans-serif; font-size: 12.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all 0.18s;
}
.chip.selected { background: var(--navy); border-color: var(--navy); color: white; }

/* SENDING */
.sending-ov { display: none; position: fixed; inset: 0; z-index: 500; background: rgba(29,53,87,0.35); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.sending-ov.open { display: flex; }
.sending-card { background: var(--white); border-radius: var(--radius-lg); padding: 32px 28px; text-align: center; width: 88%; max-width: 280px; box-shadow: var(--shadow-lg); }

/* FOCUS */
button:focus, a:focus { outline: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--powder); outline-offset: 2px; border-radius: 6px; }

@supports (padding: max(0px)) { body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); } }
@media (max-width: 420px) { .section-title { font-size: 28px; } }

/* SPLASH / LOADING */
.loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.loading-logo {
  display: block;
  opacity: 0;
  animation: planstySplashFade 2.6s ease-in-out forwards;
}
.loading-logo img {
  display: block;
  max-width: 240px;
  width: 58vw;
  height: auto;
}
@keyframes planstySplashFade {
  0%   { opacity: 0; transform: scale(0.96); }
  45%  { opacity: 1; transform: scale(1); }
  100% { opacity: 1; transform: scale(1); }
}
.spinner {
  display: none;
}
