/* Client area styles.
   No inline styles anywhere: the content security policy forbids them, which
   is what keeps an injected attribute from becoming an injected style. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2024;
  --muted: #6b7280;
  --line: #d9dde3;
  --accent: #1a5fb4;
  --error-bg: #fdecec;
  --error-ink: #8a1c1c;
  --info-bg: #eaf3ff;
  --info-ink: #14457c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1c2024;
    --ink: #e6e8ea;
    --muted: #9aa3ad;
    --line: #2f353b;
    --accent: #7aa8e8;
    --error-bg: #3a1d1d;
    --error-ink: #f3b6b6;
    --info-bg: #16283f;
    --info-ink: #b7d3f5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.card {
  max-width: 26rem;
  margin: 0 auto;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

h1 { margin: 0 0 1.5rem; font-size: 1.1rem; color: var(--muted); font-weight: 600; }
h2 { margin: 0 0 1rem; font-size: 1.4rem; }

.stack { display: flex; flex-direction: column; gap: .4rem; }
.stack label { margin-top: .6rem; font-size: .9rem; color: var(--muted); }

input[type="email"], input[type="password"], input[type="text"] {
  padding: .6rem .7rem;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  margin-top: 1.2rem;
  padding: .65rem 1rem;
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

button.secondary {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

button[disabled] { opacity: .5; cursor: default; }

a { color: var(--accent); }

.notice { padding: .7rem .8rem; border-radius: 8px; font-size: .95rem; }
.notice-error { background: var(--error-bg); color: var(--error-ink); }
.notice-info { background: var(--info-bg); color: var(--info-ink); }

.separator { margin: 1.2rem 0 .4rem; color: var(--muted); text-align: center; font-size: .9rem; }

.clients { padding: 0; list-style: none; }
.clients li {
  display: flex;
  gap: .6rem;
  align-items: center;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}

.muted { color: var(--muted); font-size: .9rem; }

.badge {
  padding: .1rem .45rem;
  font-size: .75rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
}

.languages {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.languages button { margin: 0; padding: .3rem .7rem; font-size: .85rem; color: var(--muted); background: transparent; border: 0; }

/* tickets */
.tickets { width: 100%; border-collapse: collapse; }
.tickets th, .tickets td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border, #ddd); }
.message { border: 1px solid var(--border, #ddd); border-radius: 6px; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }
.message-staff { background: rgba(0, 90, 180, 0.06); }
.message-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }
/* Plain text with its line breaks kept: no user-supplied markup exists here,
   html/template escaped everything, and pre-wrap does what <br> would. */
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-files { margin-top: 0.4rem; font-size: 0.9em; }
.status-closed { opacity: 0.6; }

/* detail cards */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; margin: 1rem 0; }
dl.details dt { color: var(--muted, #666); }
dl.details dd { margin: 0; }
.status-suspended { color: #b45309; }
.status-cancelled, .status-terminated { opacity: 0.6; }

/* invoices */
.invoice-items { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-items th, .invoice-items td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border, #ddd); }
.invoice-items .num { text-align: right; }
.invoice-items tfoot td { border-bottom: none; }
.invoice-items tfoot tr.grand td { font-weight: 600; border-top: 2px solid var(--border, #999); }
.pay { display: flex; gap: 0.6rem; margin: 1rem 0; }

/* the printable form */
.print-page main { max-width: 48rem; margin: 0 auto; padding: 2rem 1rem; }
@media print {
  .no-print { display: none; }
  .print-page main { padding: 0; }
}

/* the order form: the soft list follows its own OS radio, no script involved */
.os-choice { border: 1px solid var(--border, #ddd); border-radius: 6px; padding: 0.5rem 0.8rem; margin: 0.4rem 0; }
.os-choice .os-soft { display: none; margin: 0.4rem 0 0 1.6rem; }
.os-choice:has(input[type=radio]:checked) .os-soft { display: block; }
label.inline { display: flex; gap: 0.4rem; align-items: center; }
a.button { display: inline-block; padding: 0.3rem 0.7rem; border: 1px solid var(--border, #bbb); border-radius: 6px; text-decoration: none; }
