:root {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #e8f1f8;
  --ink: #142235;
  --muted: #64748b;
  --line: #d6e2ee;
  --primary: #0067b1;
  --primary-2: #004f8d;
  --primary-3: #dff0ff;
  --accent: #b6422e;
  --warning: #b77a12;
  --ok: #26734d;
  --shadow: 0 18px 45px rgba(23, 57, 91, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #003f78 0%, #0067b1 46%, #f3f7fb 100%);
}

.auth-screen.hidden,
.auth-locked {
  display: none;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.auth-card img,
.auth-logo {
  width: 186px;
  aspect-ratio: 1;
  object-fit: contain;
  max-width: 100%;
  justify-self: center;
  padding: 0;
  border-radius: 28px;
  background: transparent;
  box-shadow: 0 16px 32px rgba(0, 79, 141, 0.22);
}

.auth-title {
  text-align: center;
}

.auth-title h1 {
  display: inline-block;
  margin: 4px 0 2px;
  padding: 6px 14px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary-2);
  background: var(--primary-3);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

.auth-help-link {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.auth-version {
  margin: -4px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.72;
}

.recovery-panel {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.recovery-panel p {
  margin: 0;
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  text-decoration: none;
}

.session-info {
  margin: 0;
  color: #d7ecff;
  font-size: 0.86rem;
  line-height: 1.35;
}

.app-version {
  margin: 0;
  color: #d7ecff;
  font-size: 0.68rem;
  line-height: 1.35;
  opacity: 0.72;
}

.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  z-index: 40;
  transform: translate(-50%, -16px);
  min-width: min(360px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ok);
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #137333;
}

.toast.success-check::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #e7f6ec;
  color: #137333;
  font-size: 1.25rem;
  line-height: 1;
}

.report-save-toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 10px 0 0;
  padding: 9px 12px;
  border: 1px solid #b7e4c7;
  border-radius: 8px;
  background: #f0fbf4;
  color: #137333;
  font-size: 0.9rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.report-save-toast::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #137333;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
}

.report-save-toast.show {
  opacity: 1;
  transform: translateY(0);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: linear-gradient(180deg, #00599f 0%, #073763 100%);
  color: #f7fbfa;
}

.brand {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: #ffffff;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.brand small,
.panel-header p {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.sidebar .brand small {
  color: #d7ecff;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.primary,
.secondary,
.ghost,
.icon {
  border: 0;
  border-radius: 7px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.1;
}

.nav-item {
  justify-content: flex-start;
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  color: #d8e4e1;
}

.nav-root {
  font-weight: 900;
  text-transform: uppercase;
}

.nav-group {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.nav-group summary {
  min-height: 42px;
  padding: 12px 14px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "⌄";
  float: right;
  color: #9ed0f5;
}

.nav-group[open] summary {
  background: rgba(255, 255, 255, 0.12);
}

.nav-group .nav-item {
  width: calc(100% - 16px);
  min-height: 34px;
  margin: 4px 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.nav-item.active,
.nav-group summary.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-upload-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.document-upload-card.required-upload {
  border-color: #9ac4e8;
  background: #eef7ff;
}

.doc-upload-form {
  margin: 14px 0 16px;
}

.table-input {
  width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.money-input {
  width: 120px;
}

.module-home {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 8px 0;
}

.module-tile {
  min-height: 130px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.module-tile strong,
.module-tile span {
  display: block;
}

.module-tile strong {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.module-tile span {
  color: var(--muted);
}

.save-progress {
  padding: 12px 14px;
  border: 1px solid #9ac4e8;
  border-radius: 8px;
  background: #eef7ff;
  color: var(--primary-2);
  font-weight: 800;
}

.save-progress.error {
  border-color: #f0afa8;
  background: #fff4f2;
  color: var(--accent);
}

.field-error {
  border-color: #d92d20 !important;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.14) !important;
}

.attachment-list a,
.attachment-pending {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--primary-2);
  background: var(--surface-2);
  font-weight: 800;
}

.attachment-pending {
  color: var(--muted);
  background: #f3f7fb;
}

.compact-button {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.compact-history-row {
  background: #f8fbfe;
}

.compact-history-row td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.compact-history-row:hover {
  background: #eef7ff;
}

.quality-checklist {
  display: grid;
  gap: 12px;
}

.quality-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.quality-section h3 {
  margin: 0 0 10px;
  color: var(--primary-2);
  font-size: 1rem;
}

.quality-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 64px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #e5edf5;
}

.quality-row:first-of-type,
.quality-row-head {
  border-top: 0;
}

.quality-row-head {
  padding: 5px 0 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quality-row-head span:nth-child(2),
.quality-row-head span:nth-child(3) {
  text-align: center;
}

.quality-item-label {
  min-width: 0;
  line-height: 1.35;
}

.quality-radio-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.quality-radio-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.quality-summary {
  display: grid;
  gap: 12px;
}

.quality-summary article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.quality-summary ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.quality-dialog {
  width: min(1180px, calc(100vw - 24px));
}

.quality-dialog-form {
  display: grid;
  gap: 16px;
  height: min(860px, calc(100vh - 24px));
  background: #f7fbff;
}

.credit-dialog {
  width: min(1040px, calc(100vw - 24px));
}

.credit-dialog-form {
  display: grid;
  gap: 16px;
  height: min(840px, calc(100vh - 24px));
  background: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar,
.panel-header.split,
.dialog-header,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar {
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  min-width: min(520px, 48vw);
}

.topbar-session {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  max-width: 100%;
  padding: 9px 10px 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 57, 91, 0.08);
}

.topbar-session div {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: right;
}

.topbar-session strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-session span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

button.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.84rem;
  white-space: nowrap;
}

#openTicketMenuBtn {
  min-width: 168px;
  border: 1px solid #c83b2b;
  background: #ffffff;
  color: #c83b2b;
}

.quick-add-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary);
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.quick-add-button:hover {
  background: var(--primary-3);
}

.centered-action-panel {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
}

.blank-ticket-view {
  min-height: 60vh;
  background: var(--bg);
}

.action-blank-view {
  display: none;
  place-items: center;
  padding: 28px;
}

.action-blank-view.active {
  display: grid;
}

.blank-action-button {
  min-width: min(320px, 100%);
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #c83b2b;
  border-radius: 8px;
  background: #ffffff;
  color: #c83b2b;
  font-size: 1rem;
  font-weight: 900;
}

.blank-action-button:hover {
  background: #fff4f2;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

h2 {
  font-size: 1.08rem;
}

h3 {
  font-size: 1rem;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.primary {
  padding: 0 16px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

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

.secondary {
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
}

.ghost {
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
}

.full {
  width: 100%;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view.action-blank-view.active {
  display: grid;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric,
.panel,
.ticket-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 10px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 1.35rem;
  line-height: 1;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.main-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  padding: 16px;
}

.module-card span {
  color: var(--primary-2);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.module-card strong {
  font-size: 2.2rem;
}

.module-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.clickable {
  cursor: pointer;
}

.sync-strip,
.header-actions,
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sync-strip {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sync-strip span,
.segment {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 6px 8px;
}

.segmented {
  margin-bottom: 14px;
}

.segment {
  min-height: 36px;
  color: var(--primary-2);
}

.segment.active {
  background: var(--primary);
  color: #ffffff;
}

.panel {
  padding: 14px;
}

.panel-header {
  margin-bottom: 10px;
}

.panel-header h2 {
  font-size: 1.05rem;
}

.panel-header p {
  font-size: 0.82rem;
}

.quick-search,
.drive-panel {
  margin-top: 12px;
}

.list,
.calendar-list,
.history-results,
.machine-list,
.ticket-board,
.reporting-grid {
  display: grid;
  gap: 8px;
}

.reporting-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.ticket-board {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.ticket-card,
.list-item,
.report-card {
  padding: 10px;
}

#dashboardView {
  font-size: 0.9rem;
}

#dashboardView .list-item {
  font-size: 0.82rem;
}

#dashboardView .list-item p {
  margin: 3px 0 0;
  line-height: 1.3;
}

#dashboardView .item-line {
  gap: 8px;
}

#dashboardView .chip {
  min-height: 21px;
  padding: 0 7px;
  font-size: 0.74rem;
}

#dashboardView .secondary {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

.compact-closed-ticket {
  padding: 8px 10px;
}

.compact-closed-ticket .status-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.compact-closed-ticket .status-actions .secondary {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 0.72rem;
}

.ticket-card {
  display: grid;
  gap: 7px;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.35;
}

.ticket-card .chip {
  min-height: 21px;
  padding: 0 7px;
  font-size: 12px;
}

.ticket-card .secondary {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

.ticket-card header,
.item-line,
.card-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.danger {
  color: #b42318;
  border: 1px solid #f0b8b2;
  background: #fff5f5;
}

.danger:hover {
  border-color: #d92d20;
  background: #ffe8e6;
}

.ticket-card p,
.list-item p {
  color: var(--muted);
  line-height: 1.45;
}

.ticket-board.list-mode {
  grid-template-columns: 1fr;
  gap: 7px;
}

.ticket-board.list-mode .ticket-card {
  grid-template-columns: minmax(220px, 1.2fr) minmax(250px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
}

.ticket-board.list-mode .ticket-card header,
.ticket-board.list-mode .ticket-card .chips,
.ticket-board.list-mode .ticket-card .card-actions {
  margin: 0;
}

.ticket-board.list-mode .ticket-card p {
  margin: 0;
}

.ticket-board.list-mode .ticket-card p:nth-of-type(2),
.ticket-board.list-mode .ticket-card p:nth-of-type(3) {
  display: none;
}

.ticket-board.list-mode .ticket-card .chips {
  gap: 4px;
}

.ticket-board.list-mode .ticket-card .card-actions {
  justify-content: flex-end;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  color: var(--muted);
}

.check-option input {
  width: auto;
}

.history-results {
  margin-top: 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.chip.hot {
  background: #ffe8df;
  color: var(--accent);
}

.chip.wait {
  background: #fff2d7;
  color: var(--warning);
}

.chip.warning {
  background: #fff8e6;
  color: #9a6700;
}

.chip.done {
  background: #dff2e7;
  color: var(--ok);
}

.chip.danger {
  background: #fee2e2;
  color: #b42318;
}

.chip.blue {
  background: var(--primary-3);
  color: var(--primary-2);
}

.chip.request {
  background: #eef0ff;
  color: #4051a3;
}

.chip.planned {
  background: #fff6d8;
  color: #8a5a00;
}

.chip.maintenance {
  background: #e9f7df;
  color: #3f7a21;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.search-stack {
  display: grid;
  gap: 6px;
  min-width: min(560px, 100%);
}

.search-suggestions,
.client-suggestions {
  width: 100%;
}

.suggestion-item,
.search-hint {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  font-size: 13px;
  line-height: 1.25;
}

.suggestion-item {
  display: grid;
  gap: 2px;
  margin-bottom: 5px;
  color: var(--ink);
  cursor: pointer;
}

.suggestion-item:hover {
  border-color: var(--primary);
  background: #f4f9fd;
}

.suggestion-item span,
.suggestion-item small,
.search-hint {
  color: var(--muted);
}

.search-hint.error-hint {
  border-color: #ef4444;
  background: #fff5f5;
  color: #991b1b;
}

.machine-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
  color: var(--muted);
  line-height: 1.45;
}

.manual-client,
.manual-machine {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ticket-client-suggestions {
  margin-top: -4px;
  margin-bottom: 8px;
}

.manual-client .wide {
  grid-column: span 2;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.photo-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.photo-item {
  position: relative;
  margin: 0;
}

.photo-item figcaption {
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-remove {
  position: absolute;
  right: 6px;
  top: 6px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px;
  background: rgba(180, 66, 46, 0.92);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.quality-photo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.quality-photo-toolbar strong {
  color: var(--primary-2);
  font-size: 0.92rem;
}

.quality-photo-input-preview {
  margin-top: 10px;
}

.quality-photo-input-preview figure {
  position: relative;
  margin: 0;
}

.quality-photo-input-preview figcaption {
  position: absolute;
  left: 7px;
  top: 7px;
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 79, 141, 0.9);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
}

.doc-architecture {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.doc-architecture article,
.doc-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.doc-architecture p,
.doc-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.doc-results {
  display: grid;
  gap: 10px;
}

.doc-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 1.75rem;
}

.stat-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.mic-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1.2rem;
  line-height: 1;
}

label small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.quote-followup {
  display: grid;
  gap: 10px;
}

.quote-followup.hidden {
  display: none;
}

.attachment-preview {
  min-height: 42px;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

#signaturePad,
#technicianSignaturePad {
  width: 100%;
  height: 90px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  touch-action: none;
}

.stars {
  color: #f2b705;
  font-weight: 800;
}

.report-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.report-signatures > div {
  display: grid;
  gap: 6px;
}

.dialog-subtitle,
.ai-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.logo-settings {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-top: 12px;
}

.logo-preview-box {
  display: grid;
  place-items: center;
  min-height: 128px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.logo-preview-box img {
  display: block;
  max-width: 100%;
  max-height: 96px;
  object-fit: contain;
}

.logo-controls {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.settings-stack {
  display: grid;
  gap: 22px;
}

.settings-block {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.settings-block h3 {
  margin: 0;
  color: var(--primary-2);
}

.planning-grid {
  display: grid;
  gap: 10px;
}

.planning-period {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.planning-period strong {
  min-width: 220px;
  color: var(--ink);
}

.planning-grid.week {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.planning-grid.month {
  grid-template-columns: repeat(7, minmax(90px, 1fr));
}

.planning-grid.quarter {
  grid-template-columns: repeat(7, minmax(86px, 1fr));
}

.planning-day {
  min-height: 105px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.planning-day strong {
  display: block;
  margin-bottom: 8px;
}

.planning-event {
  display: block;
  width: 100%;
  min-height: 0;
  margin-top: 6px;
  border: 0;
  border-left: 3px solid var(--primary);
  padding-left: 7px;
  color: var(--muted);
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.3;
}

.planning-list-item {
  border-left: 4px solid var(--primary);
}

.planning-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.planning-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 5px 9px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
}

.legend-dot.workshop {
  background: var(--primary);
}

.legend-dot.exterior {
  background: #c83b2b;
}

.legend-dot.maintenance {
  background: #74b83f;
}

.legend-dot.planned {
  background: #f2b705;
}

.planning-event.planning-workshop,
.planning-list-item.planning-workshop {
  border-left-color: var(--primary);
  background: #f3f9ff;
}

.planning-event.planning-exterior,
.planning-list-item.planning-exterior {
  border-left-color: #c83b2b;
  background: #fff4f2;
}

.planning-event.planning-maintenance,
.planning-list-item.planning-maintenance {
  border-left-color: #74b83f;
  background: #f4fbef;
}

.planning-event.planning-planned,
.planning-list-item.planning-planned {
  border-left-color: #f2b705;
  background: #fff8d8;
}

.planning-event.planning-workshop,
.planning-event.planning-exterior,
.planning-event.planning-maintenance,
.planning-event.planning-planned {
  padding: 7px;
  border-radius: 7px;
}

.machine-summary strong {
  color: var(--ink);
}

.dictation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: start;
}

.mic-btn {
  min-height: 44px;
}

.mic-btn.active {
  border-color: var(--ok);
  background: #e7f6ec;
  color: var(--ok);
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.share-actions .ghost {
  border: 1px solid var(--line);
  color: var(--primary-2);
  background: #f8fbfe;
  min-height: 38px;
  padding: 0 8px;
  font-size: 0.86rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#reportDialog .share-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#reportDialog .share-actions .ghost {
  font-size: 0.82rem;
  padding: 0 6px;
}

.save-ticket-inline {
  margin-top: 10px;
}

.drive-hint {
  margin-top: 10px;
  font-size: 0.88rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.search {
  flex: 1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
}

select:has(option[value=""]:checked) {
  color: #b42318;
  font-weight: 700;
}

option {
  color: var(--ink);
  font-weight: 400;
}

option[value=""] {
  color: #b42318;
  font-weight: 700;
}

#ticketForm input:required:invalid,
#ticketForm select:required:invalid,
#ticketForm textarea:required:invalid {
  border-color: #b42318;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
  background: #fff5f5;
}

#ticketForm input:disabled,
#ticketForm select:disabled,
#ticketForm textarea:disabled {
  color: #7a8699;
  background: #e9eff5;
  cursor: not-allowed;
}

#ticketForm input.required-missing,
#ticketForm select.required-missing,
#ticketForm textarea.required-missing {
  border-color: #b42318;
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.12);
  background: #fff5f5;
}

.choice-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  font-weight: 700;
}

.choice-toggle input {
  width: auto;
  accent-color: var(--primary);
}

.required-choice:has(input:required:invalid) label {
  border-color: #b42318;
  background: #fff5f5;
}

.choice-toggle label:has(input:checked) {
  color: #ffffff;
  border-color: var(--primary-2);
  background: var(--primary-2);
}

textarea {
  resize: vertical;
}

#ticketForm textarea[name="report"] {
  min-height: 420px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.machine-list {
  grid-template-columns: 1fr;
}

.machine-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.75fr) minmax(170px, 1fr) minmax(220px, 1.4fr) minmax(130px, 0.8fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 11px;
  font-size: 0.84rem;
}

.machine-row strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.machine-row span,
.machine-row small {
  color: var(--muted);
  min-width: 0;
}

.machine-row small {
  font-size: 0.78rem;
}

.clickable {
  cursor: pointer;
}

.clickable:hover {
  border-color: var(--primary);
}

.detail-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.contact-grid,
.ticket-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.contact-card,
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.client-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.client-counters article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
  padding: 9px 10px;
}

.client-counters span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
}

.client-counters strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.client-counters .warning {
  border-color: #f2ca72;
  background: #fff8e6;
}

.client-warning {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-left: 3px solid #f2b705;
  background: #fffaf0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.report-card.selected {
  border-color: var(--primary);
  background: var(--primary-3);
}

.technician-report-detail {
  margin-top: 14px;
}

.contact-actions,
.planning-filter {
  margin-bottom: 14px;
}

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

.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  min-height: 0;
  text-align: left;
  font-weight: 700;
}

.link-button.strong {
  color: var(--ink);
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
}

.compact-actions .ghost {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.archived-row {
  color: var(--muted);
  background: #f8fbfe;
}

.archived-row a {
  color: var(--muted);
}

.inline-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inline-choice legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.inline-choice label {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-weight: 800;
}

.notification-preview {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.notification-preview p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.ai-watch-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.compact-header {
  margin: 0;
}

.ai-model-list {
  display: grid;
  gap: 8px;
}

.ai-model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.ai-model-row > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ai-model-row small {
  flex-basis: 100%;
  color: var(--muted);
}

dialog {
  width: min(760px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.large-dialog {
  width: min(1180px, calc(100vw - 24px));
}

#ticketDialog.expanded {
  width: calc(100vw - 12px);
  max-width: calc(100vw - 12px);
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
}

#reportDialog.expanded {
  width: calc(100vw - 12px);
  max-width: calc(100vw - 12px);
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
}

#ticketDialog:not(.expanded) {
  width: min(980px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100vh - 24px);
}

dialog::backdrop {
  background: rgba(12, 22, 23, 0.45);
}

.choice-dialog {
  width: min(840px, calc(100vw - 24px));
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.choice-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.choice-card:hover {
  border-color: #7daed2;
  transform: translateY(-1px);
}

.choice-card strong {
  font-size: 1rem;
  line-height: 1.25;
}

.choice-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.choice-card-blue {
  border-color: #0067b1;
  background: #eef7ff;
}

.choice-card-red {
  border-color: #c83b2b;
  background: #fff4f2;
}

.dialog-form {
  padding: 20px;
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.dialog-form::-webkit-scrollbar {
  display: none;
}

.dialog-form.large {
  width: 100%;
}

#ticketDialog.expanded .dialog-form {
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
}

#ticketDialog .dialog-form {
  background: #eef7ff;
}

#ticketDialog .dialog-header,
#ticketDialog .machine-summary,
#ticketDialog .ticket-side-panel,
#ticketDialog .dialog-fields > label,
#ticketDialog .ticket-section > label,
#ticketDialog .manual-client label,
#ticketDialog .manual-machine label {
  background-color: rgba(255, 255, 255, 0.72);
}

#reportDialog.expanded .dialog-form {
  height: calc(100vh - 12px);
  max-height: calc(100vh - 12px);
}

#ticketDialog.expanded .ticket-layout {
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.62fr);
}

#reportDialog.expanded .report-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.65fr);
}

.printable-fallback-frame {
  width: 100%;
  min-height: min(72vh, 760px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#ticketDialog.request-mode .technical-only {
  display: none;
}

#ticketDialog.planned-mode .repair-only {
  display: none;
}

#ticketDialog.planned-mode .planned-hide,
#ticketDialog:not(.planned-mode) .planned-only {
  display: none;
}

#ticketDialog:not(.request-mode) .request-only {
  display: none;
}

#ticketDialog.request-mode .ticket-layout,
#ticketDialog.request-mode.expanded .ticket-layout {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.icon {
  width: 38px;
  background: var(--surface-2);
  font-size: 1.4rem;
}

.dialog-fields {
  display: grid;
  gap: 12px;
}

.ticket-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.ticket-section h3 {
  margin: 0;
  color: var(--primary-2);
  font-size: 1rem;
}

.info-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: 999px;
  background: #e5f1fb;
  color: var(--primary-2);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: help;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.52fr);
  gap: 18px;
  margin-top: 16px;
  min-width: 0;
}

.ticket-layout > * {
  min-width: 0;
}

.report-preview {
  border-left: 1px solid var(--line);
  padding-left: 18px;
  min-width: 0;
}

.report-layout {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
}

.report-document {
  font-family: Arial, sans-serif;
  color: #142235;
  line-height: 1.45;
}

.report-document .report-logo {
  width: 250px;
  margin-bottom: 22px;
}

.report-document h1 {
  color: var(--primary);
  font-size: 1.45rem;
  border-bottom: 3px solid var(--primary);
  padding-bottom: 10px;
  margin-bottom: 18px;
}

.report-document h2 {
  color: var(--primary-2);
  margin-top: 18px;
  margin-bottom: 8px;
}

.report-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 8px;
  background: #f8fbfe;
}

.report-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-photos img,
.report-signature {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

menu {
  margin: 18px 0 0;
  padding: 0;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 14px;
    gap: 14px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    min-height: 38px;
    padding: 9px 8px;
    text-align: center;
    font-size: 0.86rem;
  }

  .main {
    padding: 16px;
  }

  .brand {
    max-width: 220px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .grid.two,
  .machine-row,
  .ticket-layout {
    grid-template-columns: 1fr;
  }

  .report-preview {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0 0;
  }

  .toolbar,
  .topbar,
  .topbar-right,
  .topbar-actions,
  .dictation-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .topbar-right {
    min-width: 0;
  }

  .topbar-session {
    justify-content: space-between;
  }

  .topbar-session div {
    text-align: left;
  }

  .dictation-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .share-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-client,
  .manual-machine,
  .signature-grid,
  .signature-actions,
  .doc-architecture,
  .stats-grid,
  .planning-grid.week,
  .planning-grid.month,
  .planning-grid.quarter {
    grid-template-columns: 1fr;
  }

  .doc-card {
    display: grid;
  }

  .manual-client .wide {
    grid-column: auto;
  }

  dialog {
    width: min(100vw - 12px, 760px);
    max-width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .large-dialog,
  #ticketDialog,
  #ticketDialog.expanded {
    width: calc(100vw - 8px);
    max-width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    max-height: calc(100vh - 8px);
  }

  .dialog-form,
  #ticketDialog.expanded .dialog-form {
    max-height: calc(100vh - 8px);
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .form-row,
  .logo-settings,
  .report-meta {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-session,
  .panel-header.split,
  .dialog-header,
  menu {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions {
    justify-content: flex-end;
  }

  .metric {
    padding: 14px;
  }

  .metric strong {
    font-size: 1.6rem;
  }

  .table-wrap {
    max-width: calc(100vw - 32px);
  }
}
