/* =========================================================
   LYRAX — Área do proprietário
   Usa as cores, fontes e botões de style.css
   ========================================================= */

.owner { color-scheme: dark; }
.owner [hidden] { display: none !important; }

/* ---------- Campos ---------- */
.field { display: grid; gap: 7px; text-align: left; min-width: 0; }
.field > span, .totals dt, .box-title, .cell .label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.field input, .field select, .field textarea, .totals input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.4;
  transition: border-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c98f5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
.field input::placeholder, .field textarea::placeholder, .totals input::placeholder { color: var(--dim); }
.field input:focus, .field select:focus, .field textarea:focus, .totals input:focus {
  outline: none; border-color: rgba(201, 143, 90, .6); box-shadow: 0 0 0 4px rgba(201, 143, 90, .12);
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: 1 / -1; }

.icon-btn {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--muted); cursor: pointer;
  transition: color .25s, border-color .25s, background .25s;
}
.icon-btn .ico { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--bronze-hi); border-color: rgba(201, 143, 90, .45); }
.icon-btn.danger:hover { color: #ff8a80; border-color: rgba(255, 138, 128, .45); }
.icon-btn.wa:hover { color: #4ade80; border-color: rgba(74, 222, 128, .45); }

.link-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: color .25s;
}
.link-btn:hover { color: var(--bronze-hi); }
.link-btn .ico { width: 16px; height: 16px; }

.muted { color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(50% 45% at 50% 28%, rgba(201, 143, 90, .16), transparent 70%),
    radial-gradient(40% 40% at 50% 100%, rgba(214, 210, 203, .04), transparent 70%);
}
.login-card {
  width: min(100%, 400px); display: grid; gap: 18px; text-align: center;
  padding: 40px clamp(22px, 5vw, 34px) 30px; border-radius: 28px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01)), var(--surface);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .95);
  animation: fade .8s var(--ease) both;
}
.login-card.shake { animation: shake .42s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.login-mark {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto;
  box-shadow: 0 0 0 1px var(--line-2), 0 14px 40px -10px rgba(201, 143, 90, .6);
}
.login-card .eyebrow { justify-content: center; margin: 4px 0 -8px; }
.login-title { font-family: var(--serif); font-weight: 600; font-size: 1.9rem; line-height: 1.15; color: var(--silver-1); margin-bottom: 4px; }
.login-error {
  font-size: 13.5px; line-height: 1.4; color: #ffb4ab; text-align: left;
  background: rgba(255, 82, 82, .08); border: 1px solid rgba(255, 82, 82, .28); border-radius: 12px; padding: 10px 14px;
}
.login-btn { width: 100%; margin-top: 4px; }
.login-btn[disabled] { opacity: .7; cursor: progress; transform: none; }
.login-back { display: inline-flex; align-items: center; gap: 8px; justify-self: center; font-size: 13px; font-weight: 600; color: var(--muted); transition: color .25s; }
.login-back:hover { color: var(--bronze-hi); }
.login-back .ico { width: 16px; height: 16px; }

/* ---------- Topo do painel ---------- */
.app-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(9, 9, 10, .86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tabs {
  display: flex; gap: 4px; padding: 5px; border-radius: 999px;
  background: rgba(20, 20, 22, .82); border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tabs a {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .35s var(--ease), color .3s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] {
  background: linear-gradient(180deg, #2a2723, #1c1a18); color: var(--silver-1);
  box-shadow: inset 0 0 0 1px rgba(201, 143, 90, .35);
}
.tabs a[aria-current] .ico { color: var(--bronze-hi); }

/* ---------- Conteúdo ---------- */
.app-main { padding-block: clamp(28px, 5vw, 56px) 40px; }
.panel { animation: fade .5s var(--ease) both; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.panel-head .eyebrow { margin-bottom: 10px; }
.panel-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.1;
  background: var(--grad-silver); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat {
  display: grid; gap: 4px; min-width: 0; padding: 20px 22px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface);
}
.stat span { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.stat strong {
  font-family: var(--serif); font-weight: 600; font-size: 1.55rem; line-height: 1.25; color: var(--silver-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat strong.gold { color: var(--bronze-hi); }
.stat small { font-size: 12.5px; color: var(--dim); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted);
  transition: border-color .25s;
}
.search:focus-within { border-color: rgba(201, 143, 90, .6); }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 15px; outline: none; }
.search input::placeholder { color: var(--dim); }
.filter { display: flex; flex-wrap: wrap; gap: 6px; }
.filter button {
  height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: none;
  color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .25s;
}
.filter button:hover { color: var(--text); }
.filter button[aria-pressed="true"] { color: var(--bronze-hi); border-color: rgba(201, 143, 90, .5); background: rgba(201, 143, 90, .08); }

/* ---------- Listas ---------- */
.list { display: grid; gap: 10px; }
.row {
  display: grid; align-items: center; gap: 18px; padding: 16px 18px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .3s;
}
.row:hover { border-color: var(--line-2); }
.client-row { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) 118px auto; }
.quote-row { grid-template-columns: 62px minmax(0, 1.4fr) minmax(0, .8fr) 118px auto; }
.who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who > div { min-width: 0; }
.row h3 { font-size: 15.5px; font-weight: 600; line-height: 1.3; color: var(--silver-1); overflow-wrap: anywhere; }
.avatar {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  font-family: var(--serif); font-weight: 700; font-size: 14px; letter-spacing: .04em; color: var(--bronze-hi);
  background: linear-gradient(145deg, #25221f, #141312); border: 1px solid rgba(201, 143, 90, .3);
}
.cell { display: grid; gap: 2px; min-width: 0; }
.cell .label { font-size: 10px; color: var(--dim); }
.cell strong { font-size: 14.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.add-date {
  justify-self: start; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--bronze-hi); font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.quote-num { font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: .06em; color: var(--bronze); }
.quote-total { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--silver-1); }

.status {
  justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--line-2); color: var(--muted);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-ativo, .status-aprovado { color: #6fdc9c; border-color: rgba(111, 220, 156, .3); background: rgba(111, 220, 156, .07); }
.status-pausado, .status-enviado { color: var(--bronze-hi); border-color: rgba(201, 143, 90, .35); background: rgba(201, 143, 90, .07); }
.status-cancelado, .status-recusado { color: #ff8a80; border-color: rgba(255, 138, 128, .3); background: rgba(255, 138, 128, .06); }

.row-actions { display: flex; justify-content: flex-end; gap: 6px; }

.empty {
  display: grid; justify-items: center; gap: 14px; padding: 48px 20px; text-align: center;
  border: 1px dashed var(--line-2); border-radius: 18px; color: var(--muted);
}

/* ---------- Editor de orçamento ---------- */
.editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 24px; }
.back {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color .25s, border-color .25s;
}
.back:hover { color: var(--bronze-hi); border-color: rgba(201, 143, 90, .5); }
.back .ico { width: 16px; height: 16px; }
.editor-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.2; color: var(--silver-1); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor-main { display: grid; gap: 16px; min-width: 0; }
.box { display: grid; gap: 16px; min-width: 0; padding: 22px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
.box-title { color: var(--bronze); }
.box > .link-btn { justify-self: start; }

.items { display: grid; gap: 12px; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 76px 128px 112px 38px; align-items: end; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.item-total { display: grid; gap: 7px; min-width: 0; }
.item-total span { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.item-total strong { display: flex; align-items: center; min-height: 48px; font-weight: 600; white-space: nowrap; }
.item .icon-btn { margin-bottom: 5px; }

.summary { position: sticky; top: 92px; }
.totals { display: grid; gap: 12px; margin: 0; }
.totals > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.totals dd { margin: 0; font-weight: 600; text-align: right; }
.totals input { width: 120px; min-height: 40px; padding: 8px 12px; text-align: right; }
.totals .total { padding-top: 14px; border-top: 1px solid var(--line); }
.totals .total dt { color: var(--silver-2); }
.totals .total dd { font-family: var(--serif); font-size: 1.6rem; color: var(--bronze-hi); }
.summary .btn { width: 100%; }

/* ---------- Meus sites ---------- */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.site-card {
  display: grid; align-content: space-between; gap: 22px; padding: 22px; border-radius: 22px;
  border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 100% 0%, rgba(201, 143, 90, .1), transparent 60%), var(--surface);
  transition: border-color .3s, transform .3s var(--ease);
}
.site-card:hover { border-color: rgba(201, 143, 90, .35); transform: translateY(-3px); }
.site-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-top > a { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-top h3 { font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--silver-1); }
.site-top .row-actions { margin-left: auto; }
.site-links { display: flex; flex-wrap: wrap; gap: 10px; }
.site-add {
  display: grid; place-content: center; justify-items: center; gap: 10px; min-height: 140px; border-radius: 22px;
  border: 1px dashed var(--line-2); background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: color .25s, border-color .25s;
}
.site-add:hover { color: var(--bronze-hi); border-color: rgba(201, 143, 90, .5); }

/* ---------- Rodapé ---------- */
.app-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--dim); font-size: 13px;
}
.app-foot p { display: flex; align-items: center; gap: 8px; }
.app-foot p .ico { width: 16px; height: 16px; color: var(--bronze); }
.app-foot-actions { display: flex; flex-wrap: wrap; gap: 22px; }

/* ---------- Janelas ---------- */
.dialog {
  width: min(100% - 32px, 620px); max-height: calc(100% - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--line-2); border-radius: 24px; background: var(--surface); color: var(--text);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, .95);
}
.dialog-sm { width: min(100% - 32px, 440px); }
.dialog[open] { animation: pop .35s var(--ease); }
.dialog::backdrop { background: rgba(5, 5, 6, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.dialog-card { display: grid; gap: 18px; padding: clamp(20px, 4vw, 28px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h3 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; color: var(--silver-1); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- Aviso ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300; max-width: calc(100% - 32px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; background: #1d1c1f; border: 1px solid rgba(201, 143, 90, .4);
  color: var(--text); font-size: 14px; font-weight: 600; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
  transition: opacity .3s, transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(255, 138, 128, .5); color: #ffb4ab; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .client-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .client-row .who { grid-column: 1 / -1; }
  .quote-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .quote-row .quote-total { grid-column: 2; }
  .quote-row .status { grid-column: 3; justify-self: end; }
  .quote-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
}

@media (max-width: 860px) {
  /* sem blur no topo: ele prenderia a barra de abas fixa dentro do cabeçalho */
  .app-top { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(9, 9, 10, .95); }
  .tabs { position: fixed; left: 50%; bottom: 14px; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .8); }
  .toast { bottom: 92px; }
}

@media (max-width: 600px) {
  .hide-sm { display: none; }
  .app-top .btn-sm { padding: 0 14px; }
  .stats { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stat { padding: 16px 18px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .item { grid-template-columns: 72px minmax(0, 1fr) 38px; }
  .item-desc, .item-total { grid-column: 1 / -1; }
  .item-total { display: flex; justify-content: space-between; align-items: center; }
  .item-total strong { min-height: 0; }
  .tabs a { padding: 0 13px; }
  .tabs a:not([aria-current]) span { display: none; }
  .dialog-foot .btn { flex: 1; }
}

/* ---------- Impressão do orçamento (Gerar PDF) ---------- */
.print-area { display: none; }

@media print {
  @page { margin: 14mm; }
  body.owner { background: #fff !important; color: #1d1b19; padding: 0 !important; overflow: visible; }
  body.owner > :not(.print-area) { display: none !important; }
  .print-area { display: block !important; }

  .pq { font-family: var(--sans); font-size: 11pt; line-height: 1.5; color: #1d1b19; }
  .pq-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid #c98f5a; }
  .pq-brand { display: flex; align-items: center; gap: 12px; }
  .pq-brand img { width: 54px; height: 54px; border-radius: 50%; }
  .pq-brand strong { display: block; font-family: var(--serif); font-size: 19pt; font-weight: 600; letter-spacing: .3em; line-height: 1.1; }
  .pq-brand span { font-size: 7.5pt; font-weight: 600; letter-spacing: .4em; text-transform: uppercase; color: #93602f; }
  .pq-meta { text-align: right; }
  .pq-meta h1 { font-family: var(--serif); font-size: 20pt; font-weight: 600; line-height: 1.1; margin-bottom: 4px; }
  .pq-meta p { color: #6b6761; }
  .pq-client { display: grid; gap: 1px; margin: 22px 0 18px; }
  .pq-label { font-size: 7.5pt; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #8a847c; }
  .pq-client strong { font-size: 14pt; }
  .pq-items { width: 100%; border-collapse: collapse; }
  .pq-items th { padding: 8px 6px; border-bottom: 1px solid #cfcac3; text-align: left; font-size: 7.5pt; letter-spacing: .16em; text-transform: uppercase; color: #8a847c; }
  .pq-items td { padding: 10px 6px; border-bottom: 1px solid #ebe7e1; vertical-align: top; }
  .pq-items .num { text-align: right; white-space: nowrap; }
  .pq-totals { display: grid; gap: 6px; width: 270px; margin: 16px 0 0 auto; }
  .pq-totals div { display: flex; justify-content: space-between; gap: 16px; }
  .pq-totals .pq-total { margin-top: 4px; padding-top: 8px; border-top: 2px solid #1d1b19; font-size: 14pt; font-weight: 700; }
  .pq-terms { display: grid; gap: 4px; margin-top: 28px; padding: 14px 16px; border: 1px solid #ebe7e1; border-radius: 10px; }
  .pq-notes { white-space: pre-line; margin-top: 6px; color: #4a4642; }
  .pq-foot { margin-top: 36px; padding-top: 12px; border-top: 1px solid #ebe7e1; text-align: center; font-size: 8.5pt; color: #8a847c; }
}
