/* ============================================================
   БАЗОВІ СКИДАННЯ ТА НАЛАШТУВАННЯ
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color: #323232;
  background-color: #f5f5f5; /* Легкий фон поза інвойсом */
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ============================================================
   КОНТЕЙНЕР (ОБОВ'ЯЗКОВО ДЛЯ ВИРІВНЮВАННЯ)
   ============================================================ */

.container {
  max-width: 900px;
  min-width: 850px; /* Захист від "злипання" контенту */
  margin: 0 auto;
  padding: 0 40px;
  background-color: #ffffff;
}

/* ============================================================
   ШАПКА (HEADER)
   ============================================================ */

.invoice-header {
  background-color: #f8f8f8;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 0;
}

.logo {
  display: flex;
  align-items: baseline;
}

.logo-text {
  font-weight: 900;
  font-size: 52px;
  color: #5cd2d6;
}
.logo-accent {
  font-weight: 900;
  font-size: 52px;
  color: #323232;
}
.logo-domain {
  font-weight: 900;
  font-size: 28px;
  color: #323232;
}

.top-line {
  background-color: #5cd2d6;
  height: 8px;
  flex: 1;
  max-width: 500px;
  margin-left: 30px;
  border-radius: 99px;
}

/* ============================================================
   СЕКЦІЯ АДРЕСИ ТА НОМЕРА
   ============================================================ */

.invoice-top-wrapper {
  display: flex;
  justify-content: space-between;
  padding: 36px 0 28px;
}

.address-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.container-icon {
  color: #5cd2d6;
  flex-shrink: 0;
}

.icon {
  fill: currentColor; /* Заливка для маленьких іконок адреси */
}

.address-text {
  font-size: 14px;
  color: #323232;
}

.header-right {
  text-align: right;
}
.invoice-title {
  font-size: 52px;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}
.invoice-number {
  color: #5cd2d6;
}
.invoice-date {
  font-size: 14px;
  color: #7a7a7a;
  margin-top: 8px;
}

/* ============================================================
   КЛІЄНТ ТА БЕЙДЖ СУМИ
   ============================================================ */

.billing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 36px;
}

.client-details {
  display: flex;
  gap: 15px;
}
.accent-bar {
  width: 5px;
  background-color: #5cd2d6;
  border-radius: 3px;
  align-self: stretch;
}
.client-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.client-title {
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
}
.client-address {
  font-size: 13px;
  color: #7a7a7a;
}
.client-email {
  font-size: 13px;
  color: #323232;
  font-weight: 500;
}

.total-badge {
  display: flex;
  align-items: center;
  padding: 18px 36px;
  gap: 16px;
  background-color: #5cd2d6;
  clip-path: polygon(10% 0, 100% 0, 100% 100%, 0% 100%);
}

.total-text {
  font-size: 22px;
  color: #ffffff;
}
.total-price {
  font-size: 26px;
  font-weight: 900;
  color: #ffffff;
}

/* ============================================================
   ТАБЛИЦЯ ПОЗИЦІЙ (СИНХРОНІЗАЦІЯ КОЛОНОК)
   ============================================================ */

.table-header-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  color: #5cd2d6;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  border-bottom: 2px solid #5cd2d6;
}

.header-main {
  width: 55%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cyan-square {
  width: 14px;
  height: 14px;
  background-color: #5cd2d6;
}

.header-labels {
  width: 45%;
  display: flex;
  justify-content: space-between;
}
.header-labels span {
  width: 33.33%;
  text-align: right;
  padding-right: 10px;
}

/* Сама таблиця */
.invoice-table td {
  padding: 20px 0;
  border-bottom: 1px solid #eeeeee;
  vertical-align: top; /* Текст завжди зверху */
}

.col-description {
  width: 55%;
}
.item-name {
  font-weight: 700;
  font-size: 16px;
  display: block;
  margin-bottom: 4px;
}
.item-text {
  font-size: 13px;
  color: #7a7a7a;
  line-height: 1.4;
  max-width: 400px;
}

.col-price,
.col-qty,
.col-total {
  width: 15%; /* 15% * 3 = 45% */
  text-align: right;
  padding-right: 10px;
  font-size: 16px;
  white-space: nowrap;
}

/* ============================================================
   НИЖНЯ ЧАСТИНА (ОПЛАТА, ПІДПИС, ПІДСУМКИ)
   ============================================================ */

.footer-row {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.payment-method {
  display: inline-flex;
  padding: 10px 20px;
  background-color: #e6e4e4;
  border-radius: 4px;
  gap: 8px;
  font-size: 14px;
}

.signature-block {
  text-align: left;
}
.manager-label {
  font-size: 13px;
  color: #7a7a7a;
  display: block;
}
.manager-name {
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  margin: 4px 0 10px;
}
.thank-you {
  font-size: 14px;
  margin-top: 15px;
  font-weight: 500;
}

.summary-wrapper {
  width: 320px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px dashed #cccccc;
}

.summary-row span {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  color: #7a7a7a;
}
.summary-row strong {
  font-size: 16px;
}

/* Фінальний рядок */
.summary-row.total-row {
  border-bottom: none;
  padding-top: 20px;
}
.total-row span {
  color: #323232;
  font-weight: 900;
  font-size: 14px;
}
.total-row strong {
  font-size: 24px;
  font-weight: 900;
}

/* ============================================================
   FOOTER СТОРІНКИ
   ============================================================ */

.main-footer {
  margin-top: 60px;
  padding-bottom: 40px;
}
.terms {
  font-size: 12px;
  color: #7a7a7a;
  margin-bottom: 20px;
}
.footer-divider {
  border: 0;
  border-top: 1px dashed #cccccc;
  margin-bottom: 20px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-contacts {
  text-align: center;
  font-size: 12px;
  color: #7a7a7a;
  line-height: 1.7;
}
.footer-contacts p {
  margin: 0;
}

.footer-icon .icon {
  fill: none; /* Прозора всередині */
  stroke: currentColor;
  stroke-width: 1.5px;
  width: 50px;
  height: 50px;
}

/* Стилі для планшетів та телефонів (екран менше 768px) */
@media screen and (max-width: 768px) {
  .container {
    min-width: 100%; /* Дозволяємо контейнеру стискатися */
    padding: 0 20px; /* Зменшуємо бокові відступи */
  }

  .header-top-row,
  .invoice-top-wrapper,
  .billing-row,
  .footer-row {
    flex-direction: column; /* Ставимо блоки один під одного замість ряду */
    align-items: flex-start;
    gap: 20px;
  }

  .header-right,
  .total-badge {
    text-align: left;
    width: 100%; /* Розтягуємо на всю ширину */
  }

  .total-badge {
    clip-path: none; /* Прибираємо скіс на мобілках для кращого вигляду */
  }
}
