/*
 * One stylesheet for the customer's status page and the panel. Mobile first: the customer opens the
 * status page on a phone, and technicians often run the panel from one too.
 * No inline styles anywhere (the Content-Security-Policy forbids them).
 */
:root {
  --brand: #1d5f73;
  --ink: #1f2328;
  --muted: #5d6570;
  --line: #dde4ea;
  --bg: #f6f8fa;
  --card: #ffffff;
  --soft: #edf2f6;
  --ok: #1d7a4c;
  --ok-bg: #e7f5ee;
  --warn: #9a5b00;
  --warn-bg: #fff4dc;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --info: #22529a;
  --info-bg: #e8f0fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 10px rgba(0, 0, 0, .04);
  --focus: 0 0 0 3px rgba(34, 82, 154, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--info); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: .5rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Demo band */
.demo-band {
  background: #2d2a26;
  color: #fff;
  font-size: .86rem;
  padding: .45rem 16px;
  text-align: center;
}
.demo-band strong { color: #ffd88a; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem;
  border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--brand); color: #fff;
}
.btn:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--info); border-color: transparent; padding-left: .4rem; padding-right: .4rem; }
.btn-danger { background: #fff; color: var(--bad); border-color: #efc4c0; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-big { min-height: 52px; font-size: 1.05rem; padding: .7rem 1.3rem; }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
form.inline { display: inline; }

/* Cards and notices */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.notice { border-radius: 10px; padding: .75rem 1rem; border: 1px solid; margin: 0 0 1rem; }
.notice p:last-child { margin-bottom: 0; }
.notice-ok { background: var(--ok-bg); border-color: #b8e0cb; color: #11472d; }
.notice-warn { background: var(--warn-bg); border-color: #f1d49a; color: #5c3900; }
.notice-error { background: var(--bad-bg); border-color: #f2c1bc; color: #7a1a14; }
.notice-info { background: var(--info-bg); border-color: #c4d6f2; color: #173a70; }

/* Chips */
.chip {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
  background: var(--soft); color: var(--ink); border: 1px solid transparent;
}
/* Listing statuses and warning tones */
.st-draft { background: #eef0f3; color: #4a5560; }
.st-published { background: #e7f5ee; color: #11472d; }
.st-sold, .st-rented { background: #e3ecf8; color: #173a70; }
.st-withdrawn, .st-expired { background: #eeeeee; color: #555; }
.st-terminated { background: #fdecea; color: #7a1a14; border-color: #f2c1bc; }
.st-planned { background: #e8f0fb; color: #173a70; }
.st-done { background: #e7f5ee; color: #11472d; }
.st-noshow { background: #fff4dc; color: #5c3900; }
.st-cancelled { background: #eeeeee; color: #555; text-decoration: line-through; }
.st-failed { background: #fdecea; color: #7a1a14; border-color: #f2c1bc; }
.pay-paid { background: #e7f5ee; color: #11472d; }
.pay-unpaid { background: #fff4dc; color: #5c3900; }
.chip-warn { background: #fff4dc; color: #5c3900; border-color: #f1d49a; }
.chip-high { background: #ffe6cc; color: #7a3d00; border-color: #f0b878; }
.chip-crit { background: #fdecea; color: #7a1a14; border-color: #f2c1bc; }
.chip-late { background: #b3261e; color: #fff; }

/* Forms */
.field { margin: 0 0 1rem; }
.field label, .label { display: block; font-weight: 600; margin: 0 0 .3rem; }
.field .hint { font-size: .86rem; color: var(--muted); margin: .25rem 0 0; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=color], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem;
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cfc7c0; border-radius: 10px;
}
input[type=color] { padding: .2rem; width: 5rem; }
textarea { min-height: 96px; resize: vertical; }
[aria-invalid=true] { border-color: var(--bad); background: #fffafa; }
.field-error { color: var(--bad); font-size: .88rem; font-weight: 600; margin: .3rem 0 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .4rem 0; }
.check input { width: 1.25rem; height: 1.25rem; margin-top: .15rem; flex: none; }
/* min-width: 0 — a fieldset is otherwise as wide as its widest option text and pushes the phone layout sideways */
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1.2rem; background: #fff; min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0 .4rem; }
legend .num { display: inline-flex; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand); color: #fff; align-items: center; justify-content: center; font-size: .9rem; margin-right: .35rem; }
.counter { font-size: .85rem; color: var(--muted); text-align: right; }
.counter.over { color: var(--bad); font-weight: 700; }

.code-box { font-size: 2rem; font-weight: 800; letter-spacing: .12em; background: #fff; border: 2px dashed var(--brand); border-radius: var(--radius); padding: .6rem 1rem; display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; }
.timeline li::before { content: ""; position: absolute; left: .35rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--line); }
.timeline li.done::before { background: var(--ok); }
.timeline li.now::before { background: var(--brand); box-shadow: 0 0 0 4px rgba(31, 95, 139, .18); }
.timeline li.bad::before { background: var(--bad); }
/* Panel */
.panel-head { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 25; }
.panel-head .wrap { display: flex; align-items: center; gap: .6rem; min-height: 56px; max-width: none; }
.panel-shell { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - 56px); }
@media (min-width: 960px) { .panel-shell { grid-template-columns: 230px 1fr; } }
.side-nav { display: none; background: #fff; border-right: 1px solid var(--line); padding: 1rem .6rem; }
@media (min-width: 960px) { .side-nav { display: block; } }
.side-nav a { display: block; padding: .55rem .8rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; }
.side-nav a[aria-current=page] { background: var(--soft); color: var(--brand); }
.side-nav .sep { border-top: 1px solid var(--line); margin: .6rem 0; }
.panel-main { padding: 1rem 16px 6rem; min-width: 0; }
@media (min-width: 960px) { .panel-main { padding: 1.4rem 28px 3rem; } }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 960px) { .bottom-nav { display: none; } }
.bottom-nav a, .bottom-nav summary { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; font-size: .75rem; font-weight: 700; color: var(--muted); text-decoration: none; list-style: none; cursor: pointer; }
.bottom-nav summary::-webkit-details-marker { display: none; }
.bottom-nav .ico { font-size: 1.2rem; line-height: 1; }
.bottom-nav a[aria-current=page] { color: var(--brand); }
.bottom-nav details { position: relative; }
.bottom-nav details[open] .more-menu { display: block; }
.more-menu { display: none; position: absolute; right: .4rem; bottom: 62px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 210px; padding: .4rem; }
.more-menu a { flex-direction: row; justify-content: flex-start; font-size: .95rem; color: var(--ink); min-height: 44px; padding: 0 .8rem; }
.who { font-size: .85rem; color: var(--muted); }
@media (max-width: 700px) {
  .panel-head .who { display: none; }
  .panel-head .brand { font-size: 1rem; }
}
.page-title { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-title h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; text-decoration: none; color: var(--ink); }
.stat .n { font-size: 1.45rem; font-weight: 800; }
.stat .t { font-size: .82rem; color: var(--muted); }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 700; background: #fcfaf8; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.action-box { border: 2px solid var(--brand); }
.filters { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr repeat(5, 1fr) auto; align-items: end; } }
.filters .field { margin: 0; }
.filters .q { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters .q { grid-column: auto; } }
.kv { display: grid; grid-template-columns: minmax(8rem, 32%) 1fr; gap: .3rem .8rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.events { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.events li { padding: .4rem 0; border-top: 1px solid var(--line); }
details.box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1rem; }
details.box > summary { font-weight: 700; cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.login-box { max-width: 420px; margin: 2rem auto; }
.demo-accounts { display: grid; gap: .5rem; }

/* Printing: the card and delivery slip, and the courier's day list */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print, .panel-head, .side-nav, .bottom-nav, .demo-band, .shop-head, .shop-foot { display: none !important; }
  .print-only { display: block; }
  .panel-shell { display: block; }
  .panel-main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; }
  .slip-card { page-break-after: always; }
  a { color: #000; text-decoration: none; }
}

/* ---- Emlak panel additions ---- */
.req { color: var(--bad); }
.span-2 { grid-column: 1 / -1; }
.task-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; padding: .7rem .8rem; border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; background: #fff; }
.task-row.tone-warn { border-left-color: #e0a526; }
.task-row.tone-high { border-left-color: #e07b1a; }
.task-row.tone-crit, .task-row.tone-late { border-left-color: var(--bad); background: #fffafa; }
.lookup-row input[type=text] { width: auto; flex: 1 1 10rem; }
.lookup-row select { width: auto; }
.grow { flex: 1 1 auto; min-width: 0; }
code { background: var(--soft); padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }

/* ---- Printed documents (A4) ---- */
.doc-page { background: #fff; color: #000; max-width: 190mm; margin: 0 auto 1.2rem; padding: 14mm 16mm; border: 1px solid #bbb; font: 11pt/1.45 "Times New Roman", Georgia, serif; page-break-after: always; }
.doc-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #000; padding-bottom: 4pt; margin-bottom: 10pt; font: 10pt Arial, sans-serif; }
.doc-title { font: 700 15pt Arial, sans-serif; text-align: center; margin: 6pt 0 10pt; }
.doc-section { margin: 0 0 8pt; }
.doc-section h2 { font: 700 11pt Arial, sans-serif; margin: 0 0 3pt; border-bottom: 1px solid #888; }
.doc-kv { display: grid; grid-template-columns: 38mm 1fr; gap: 1pt 8pt; margin: 0; font-size: 10.5pt; }
.doc-kv dt { color: #333; }
.doc-kv dd { margin: 0; }
.doc-text { margin: 8pt 0; }
.doc-footer { font-size: 9.5pt; margin: 8pt 0; }
.doc-copy { font: 8.5pt Arial, sans-serif; color: #444; text-align: right; margin: 8pt 0 0; }
.sign-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10mm; margin-top: 12mm; }
.sign-box { border-top: 1px solid #000; padding-top: 3pt; font: 9.5pt Arial, sans-serif; min-height: 18mm; }
@media print {
  .doc-page { border: 0; margin: 0; padding: 0; max-width: none; }
  @page { size: A4; margin: 14mm; }
}


/* ---- Teknik servis additions ---- */
.st-received { background: #e8f0fb; color: #173a70; }
.st-inspecting { background: #eef0fb; color: #2d2a7a; }
.st-waiting { background: #fff4dc; color: #5c3900; border-color: #f1d49a; }
.st-ready { background: #e7f5ee; color: #11472d; }
.st-delivered { background: #e3ecf8; color: #173a70; }
.st-cancelled { background: #eeeeee; color: #555; }
.q-pending { background: #fff4dc; color: #5c3900; border-color: #f1d49a; }
.q-approved { background: #e7f5ee; color: #11472d; }
.q-rejected { background: #fdecea; color: #7a1a14; border-color: #f2c1bc; }
.q-superseded { background: #eeeeee; color: #555; text-decoration: line-through; }
.chip-urgent { background: #fdecea; color: #7a1a14; border-color: #f2c1bc; }
.chip-late { background: #b3261e; color: #fff; }
.row-line { display: grid; grid-template-columns: 1fr; gap: .3rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.row-line:first-child { border-top: 0; }
@media (min-width: 760px) { .row-line { grid-template-columns: minmax(0, 1fr) auto; align-items: center; } }
.row-line .strong { font-weight: 700; }
.row-line .meta { font-size: .88rem; color: var(--muted); }
.row-line a.cover { text-decoration: none; color: inherit; }
.grid-aside { display: grid; gap: 1rem; }
@media (min-width: 960px) { .grid-aside { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.action-forms details { margin: 0 0 .5rem; }
.action-forms summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.action-forms .sub { padding: .6rem 0 .2rem; }
.pager { display: flex; gap: .6rem; align-items: center; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.warn-box { border-left: 5px solid #e0a526; background: #fffaf0; padding: .6rem .8rem; border-radius: 8px; margin: 0 0 1rem; }
.track-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .08em; }
.money { white-space: nowrap; text-align: right; }

/* ---- Public pages ---- */
body.public { background: var(--bg); }
.public-head { background: #fff; border-bottom: 1px solid var(--line); }
.public-head .wrap { display: flex; align-items: center; gap: .8rem; min-height: 56px; flex-wrap: wrap; padding-top: .3rem; padding-bottom: .3rem; }
.public-head .brand { font-weight: 800; color: var(--brand); text-decoration: none; font-size: 1.1rem; }
.public-main { max-width: 640px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.track-form { display: grid; gap: .6rem; }
.track-form input[type=text] { font-size: 1.3rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.status-big { font-size: 1.5rem; font-weight: 800; }
.public-steps { list-style: none; margin: 0; padding: 0; }
.public-steps li { position: relative; padding: 0 0 .9rem 1.6rem; }
.public-steps li::before { content: ""; position: absolute; left: .35rem; top: .4rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--ok); }
.public-steps li:last-child::before { background: var(--brand); box-shadow: 0 0 0 4px rgba(29, 95, 115, .18); }
.public-foot { max-width: 640px; margin: 0 auto; padding: 0 16px 2rem; color: var(--muted); font-size: .88rem; }

/* ---- Printed service slip: two copies on one A4 page ---- */
.slip { background: #fff; color: #000; max-width: 190mm; margin: 0 auto 1rem; padding: 8mm 10mm; border: 1px solid #bbb; font: 10pt/1.4 Arial, Helvetica, sans-serif; }
.slip + .slip { border-top: 1px dashed #444; }
.slip h1 { font-size: 13pt; margin: 0 0 4pt; }
.slip .slip-head { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 2px solid #000; padding-bottom: 4pt; margin-bottom: 6pt; }
.slip .slip-no { font-size: 13pt; font-weight: 700; }
.slip .doc-kv { grid-template-columns: 34mm 1fr; font-size: 9.5pt; }
.slip table { width: 100%; border-collapse: collapse; font-size: 9pt; margin: 4pt 0; }
.slip th, .slip td { border-bottom: 1px solid #999; padding: 1pt 3pt; text-align: left; }
.slip td.money, .slip th.money { text-align: right; }
.slip .terms { font-size: 8pt; margin: 4pt 0; }
.slip .copy-name { font-size: 8pt; text-align: right; color: #444; }
.slip .sign-row { margin-top: 6mm; }
@media print {
  .slip { border: 0; margin: 0; padding: 0 0 4mm; max-width: none; }
  .slip + .slip { padding-top: 4mm; }
}
.slip .slip-right { text-align: right; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { padding: .35rem 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.box-form { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; background: #fcfdfd; }
