/* Клиентски портал v2 — само светла тема. Договорът за имената е
   reports/packets/CSS-VOCABULARY.md (O1). Не добавяй цветове извън
   променливите долу — нарушение = FAIL на одит. */

:root {
  --bg: #F3F2F2;
  --surf: #EAE9E9;
  --ink: #201E1D;
  --mut: #6D6A69;
  --line: rgba(32, 30, 29, 0.14);
  --line2: rgba(32, 30, 29, 0.25);
  --acc: #EC3013;
  --accH: #DD2B0F;
  --accSoft: #FFF2EF;
  --btnInk: #F3F2F2;
  --hov: rgba(32, 30, 29, 0.06);
  --overlay: rgba(32, 30, 29, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

/* ——— Оформление ——— */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.container--admin {
  max-width: 880px;
}

.site-header {
  height: 70px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--line2);
  background: var(--bg);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-header__left {
  display: flex;
  align-items: center;
  gap: 40px;
  /* Позволява .tabs да поеме компресията вместо целият ред да прелее —
     flex децата иначе имат implicit min-width: auto (пълната ширина на
     съдържанието), точно капанът от .request-row/.invoice-row по-горе. */
  min-width: 0;
}

.site-header__brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.16px;
  flex-shrink: 0;
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.site-header__user {
  text-align: right;
  min-width: 0;
}

.site-header__user-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__user-email {
  font-size: 12.5px;
  color: var(--mut);
}

.tabs {
  display: flex;
  height: 70px;
  align-self: stretch;
  /* Вътрешен хоризонтален скрол вместо да бута .site-header__right извън
     viewport-а — на широк екран без ефект (няма препълване, няма
     скролбар); §5.2 не описва тесен екран, но 70px височината остава
     непроменена и в двата случая. */
  overflow-x: auto;
  min-width: 0;
}

.tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 70px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  box-shadow: inset 0 -3px 0 transparent;
}

.tab--active {
  font-weight: 600;
  color: var(--acc);
  box-shadow: inset 0 -3px 0 var(--acc);
}

.page {
  padding: 40px 0 80px;
}

.h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.52px;
  margin: 0;
}

.section {
  margin-top: 32px;
}

.section__title {
  font-size: 14px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line2);
  margin: 0 0 16px;
}

.section--top2 {
  border-top: 2px solid var(--line2);
}

.micro {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mut);
}

/* ——— Контроли ——— */

.btn {
  font-family: 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: 0;
  box-shadow: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  background: transparent;
  color: var(--ink);
}

.btn--primary {
  height: 54px;
  background: var(--acc);
  color: var(--btnInk);
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.btn--primary:hover {
  background: var(--accH);
}

.btn--auto {
  width: auto;
}

.btn--secondary {
  height: 44px;
  background: transparent;
  border: 1px solid var(--line2);
  color: var(--ink);
}

.btn--secondary:hover {
  background: var(--hov);
}

.btn--modal {
  height: 48px;
  border: 1px solid var(--line2);
  background: transparent;
}

.btn--modal.btn--primary {
  border: none;
  background: var(--acc);
  color: var(--btnInk);
}

.btn--small {
  height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
  border: 1px solid var(--line2);
  background: transparent;
}

.btn--small:hover {
  background: var(--hov);
}

.btn--danger {
  border-color: var(--acc);
  color: var(--acc);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mut);
}

.input,
.textarea {
  height: 48px;
  background: var(--surf);
  border: none;
  border-radius: 0;
  padding: 0 14px;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 12px 14px;
  resize: vertical;
  font-family: inherit;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--mut);
}

.hint {
  font-size: 12.5px;
  color: var(--mut);
}

.err {
  font-size: 12.5px;
  color: var(--acc);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  cursor: pointer;
}

.check__box {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line2);
  background: var(--bg);
  border-radius: 0;
  position: relative;
}

.check--on .check__box {
  background: var(--acc);
  border-color: var(--acc);
}

.check--on .check__box::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--btnInk);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check__label {
  font-size: 14px;
  font-weight: 500;
}

.check__hint {
  font-size: 12.5px;
  color: var(--mut);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.stepper__btn {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line2);
  background: transparent;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
}

.stepper--wide .stepper__btn {
  width: 56px;
  height: 56px;
}

.stepper__btn:hover {
  background: var(--hov);
}

.stepper__val {
  min-width: 48px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
}

.stepper--wide .stepper__val {
  font-size: 17px;
  font-weight: 800;
}

.stepper__sub {
  font-size: 10.5px;
  color: var(--mut);
  text-align: center;
}

.opts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.opt {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--surf);
  font-size: 13.5px;
  cursor: pointer;
  text-align: center;
}

.opt--on {
  background: var(--accSoft);
  border: 1px solid var(--acc);
  color: var(--acc);
  font-weight: 600;
}

.shades {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  max-width: 520px;
}

.shade {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 10px;
  color: var(--ink);
}

.shade--on {
  border: 2px solid var(--acc);
  font-weight: 600;
}

.quiet-link {
  font-size: 12.5px;
  color: var(--mut);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.quiet-link:hover {
  color: var(--acc);
}

/* ——— Данни ——— */

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.list {
  border-top: 2px solid var(--line2);
}

.list--narrow {
  max-width: 860px;
}

.list__row {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.list__row--click {
  cursor: pointer;
}

.list__row--click:hover {
  background: var(--hov);
}

.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  gap: 16px;
}

.kv__k {
  font-size: 13.5px;
  color: var(--mut);
}

.kv__v {
  font-size: 13.5px;
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 0;
}

.badge--unpaid {
  background: var(--accSoft);
  color: var(--acc);
  border: 1px solid var(--acc);
}

.badge--paid {
  background: var(--surf);
  color: var(--mut);
  border: 1px solid var(--line2);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  background: var(--surf);
  font-size: 12.5px;
}

.card {
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--line2);
}

.card--done {
  opacity: 0.55;
}

.card > * + * {
  margin-top: 12px;
}

.card__client {
  font-size: 16px;
  font-weight: 800;
}

.card__files {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.state-loading,
.state-empty,
.state-error {
  font-size: 14px;
  color: var(--mut);
  padding: 40px 0;
}

.state-error {
  color: var(--acc);
}

/* ——— Наслоени ——— */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 100%;
  background: var(--bg);
  border-left: 2px solid var(--line2);
  overflow-y: auto;
}

.drawer__head {
  position: sticky;
  top: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 2px solid var(--line2);
}

.drawer__title {
  font-size: 22px;
  font-weight: 800;
}

.drawer__body {
  padding: 24px 28px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet__panel {
  background: var(--bg);
  border: 1px solid var(--line2);
  max-width: 480px;
  width: 100%;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}

.toast {
  position: fixed;
  left: 32px;
  bottom: 32px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  padding: 12px 18px;
  z-index: 100;
}

/* ——— Добавка 1 (CSS-VOCABULARY.md): екраните на Т2 — вход + профил ——— */

.login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login__aside {
  border-right: 2px solid var(--line2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
}

.login__bar {
  width: 56px;
  height: 6px;
  background: var(--acc);
}

.login__title {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.26px;
  margin: 0;
}

.login__panel {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 420px) 1fr;
  gap: 40px;
}

/* ——— Добавка 2 (CSS-VOCABULARY.md): споделен микро-хедър ——— */

.micro-head {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--mut);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line2);
}

/* ——— Добавка 4 (CSS-VOCABULARY.md): качване на файлове, §5.3 ——— */

.nova-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
}

.nova-aside {
  position: sticky;
  top: 36px;
}

.section__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line2);
  margin: 0 0 16px;
}

.section__title-row .section__title {
  border-bottom: none;
  padding-bottom: 0;
  margin: 0;
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 40px 24px;
  background: var(--surf);
  border: 1px dashed var(--line2);
  cursor: pointer;
}

.drop--over {
  background: var(--accSoft);
}

.drop__icon {
  font-size: 28px;
  line-height: 1;
  color: var(--acc);
}

.drop__title {
  font-size: 14px;
  font-weight: 600;
}

.filelist__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.filelist__name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filelist__size {
  flex: none;
  font-size: 12.5px;
  color: var(--mut);
}

.filelist__remove {
  flex: none;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line2);
  color: var(--mut);
  font-size: 14px;
  cursor: pointer;
}

.filelist__remove:hover {
  background: var(--hov);
  color: var(--ink);
}

.filelist__bar {
  height: 3px;
  background: var(--line);
  margin-top: 6px;
}

.filelist__bar-fill {
  height: 100%;
  background: var(--acc);
}

.pricing-group {
  max-width: 460px;
}

.pricing-group__title {
  font-size: 14px;
  font-weight: 600;
}

.pricing-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.pricing-row__label {
  font-size: 13.5px;
  color: var(--ink);
}

.pricing-row__price {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--mut);
  white-space: nowrap;
}

/* ——— Добавка 5 (CSS-VOCABULARY.md): таблични редове, §5.4 и §5.6 ——— */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-head__meta {
  text-align: right;
}

.filter--on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.request-row {
  display: grid;
  grid-template-columns: 110px 1fr 150px 170px;
  gap: 24px;
  align-items: center;
}

.invoice-row {
  display: grid;
  grid-template-columns: 150px 1fr 150px 120px;
  gap: 24px;
  align-items: center;
}

/* Грид клетките наследяват implicit min-width: auto — при nowrap текст
   (.list-row__sub--ellipsis) min-content е ЦЯЛАТА верига от думи, не
   най-дългата дума, така че клетката отказва да се свие под пълната
   ширина на текста и overflow/ellipsis никога не влизат в сила. */
.request-row > *,
.invoice-row > * {
  min-width: 0;
}

.list-row__title {
  font-size: 14.5px;
  font-weight: 800;
}

.list-row__name {
  font-size: 14.5px;
  font-weight: 400;
}

.list-row__sub {
  font-size: 12.5px;
  color: var(--mut);
}

.list-row__sub--ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row__color {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-row__swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
}

.list-row__end {
  justify-self: end;
}

.note-box {
  background: var(--surf);
  padding: 14px;
}

/* ——— Отзивчивост ——— */

@media (max-width: 900px) {
  .container {
    padding: 0 20px;
  }

  .login {
    grid-template-columns: 1fr;
  }

  .login__aside {
    border-right: none;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .nova-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .drawer__panel {
    width: 100%;
  }

  /* Фиксираните колони (.request-row 110+150+170px, .invoice-row
     150+150+120px) + 3× gap 24px вече не се събират в наличната ширина
     под този breakpoint (измерено: реално хоризонтално преливане на
     zayavki при 550px) — свиваме междината, не колоните/типографията от
     §5.4 — те остават както са зададени. */
  .request-row,
  .invoice-row {
    gap: 8px;
  }

  /* .site-header__right преливаше извън viewport-а на 550px (измерено:
     right = 676px при clientWidth 550px) — §5.2 не описва тесен екран.
     Имейлът е информативен, не действен (за разлика от името и бутона
     „Изход") — първото, което пада. .tabs вече поема остатъка с
     вътрешен скрол (виж по-горе), .site-header__user-name пази ellipsis
     за необичайно дълги имена. */
  .site-header__user-email {
    display: none;
  }
}
