:root {
  --bg: #0e1014;
  --card: #151823;
  --line: #232a42;
  --muted: #9aa3b2;
  --accent: #3b79ff;
  --accent-hover: #2a66db;
  --danger: #ff4d4f;
  --shadow: rgba(0, 0, 0, 0.2);
  --panel: #1a2233;
  --panel-2: #151823;
  --txt: var(--text);
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  padding-bottom: 1.2rem;
}

.btn {
  padding: 8px 16px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.btn:hover {
 background-color: var(--accent-hover);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn.small {
  font-size: 12px;
  padding: 6px 12px;
}

.btn.danger {
  background: var(--danger);
}

h1, h2 {
  margin: 1rem 0 0.5rem;
  font-weight: 500;
  color: var(--text);
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-section {
  background: var(--card);
  padding: 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px var(--shadow);
}



input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

#servicesTable, #savedQuotesTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}

#servicesTable th, #servicesTable td,
#savedQuotesTable th, #savedQuotesTable td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.status-badge {
  display: inline-block;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 6px;
}

.status-badge.draft {
  background: #fde047;
  color: #1e293b;
}

.status-badge.sent {
  background: #3498db;
  color: #fff;
}

.status-badge.accepted {
  background: #2ecc71;
  color: #fff;
}

.actions {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 1.5rem;
}

.foot-note {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  text-align: left;
  margin-top: 2.5rem;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.quote-valid {
  font-size: 14px;
  margin-top: -10px;
}

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

  .actions {
    flex-direction: column;
    gap: 8px;
  }

  .foot-note {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* === Collapsible Sections === */
.collapsible {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  margin: 16px 0;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}

.section-toggle {
  width: 100%;
  background: none;
  color: var(--txt);
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  border: none;
  cursor: pointer;
   background-color: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-toggle:hover {
  background-color: var(--panel-2);
}

.section-content {
  display: none;
}
.section-content.open {
  display: block;
}
/* ================== SIGNATURES SECTION ================== */
.signatures-wrap {
  margin-top: 2rem;
  background-color: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: flex; /* зміна на flex */
  justify-content: space-between; /* або center */
  flex-wrap: wrap;
  gap: 2rem;
}

.signature-box {
  flex: 1 1 320px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center; /* center замість flex-start */
}

.signature-box h3 {
  margin-bottom: 0.5rem;
}

.signature-box canvas.signature {
  border: 2px solid var(--line);
  border-radius: 8px;
  background-color: white;
  width: 100%;
  aspect-ratio: 3 / 1; /* ✅ Рівні пропорції на всіх екранах */
  max-width: 320px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  touch-action: none; /* 🔧 для мобільних */
}

.signature-box button {
  margin-top: 0.5rem;
  background: var(--accent);
  color: white;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.signature-box button:hover {
  background: var(--accent-hover);
}

.signature-box p {
  margin-top: 0.5rem;
  font-size: 13px;
  color: var(--muted);
}
form > section {
  grid-column: span 2;
  padding: 1.5rem;
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 2rem;
}
#itemsBody input,
#itemsBody select {
  padding: 6px;
  margin: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: var(--card);
  color: var(--text);
}

#itemsBody td {
  vertical-align: middle;
}

#itemsBody .item-total {
  white-space: nowrap;
}

#itemsBody button {
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 6px;
  background-color: var(--danger);
  color: #fff;
  cursor: pointer;
}

#itemsBody button:hover {
  background-color: #b91c1c;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem 0.5rem; /* Зменшено верхній та нижній відступ */
  flex-wrap: wrap;
}
header h1 {
  font-size: 24px;
  margin: 0;
}
.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
a.btn, a.btn:focus, a.btn:active, a.btn:visited {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent; /* Safari iOS/macOS */
  text-decoration: none;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

footer {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 1rem;
  background: transparent;
}

/* LIGHT THEME */
.theme-light {
  --bg: #f1f5f9;
  --text: #1e293b;
  --card: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --muted: #64748b;
  --line: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
  --panel-bg: #f8fafc;
   --panel: #f8fafc;
  --panel-2: #f1f5f9;
 
}
input,
textarea,
select {
  background-color: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  transition: border 0.2s, background 0.2s;
  width: 100%;
  box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
  background-color: var(--panel-bg);
}

button {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover {
  background-color: var(--accent-hover);
}

