:root {
  --bg: #06101f;
  --bg-soft: #0b1830;
  --panel: rgba(11, 22, 43, 0.88);
  --panel-border: rgba(84, 133, 255, 0.22);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f9ff;
  --muted: rgba(214, 226, 255, 0.72);
  --blue: #4588ff;
  --violet: #7d62ff;
  --cyan: #3ccfff;
  --green: #4fd493;
  --orange: #ffb45a;
  --red: #ff6e78;
  --danger-soft: rgba(255, 110, 120, 0.14);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.33);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-ui: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(69, 136, 255, 0.24), transparent 28%),
    radial-gradient(circle at top right, rgba(125, 98, 255, 0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(60, 207, 255, 0.12), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

body.is-locked {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.atelier-shell {
  width: min(1480px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.atelier-auth-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(4, 9, 19, 0.74), rgba(4, 9, 19, 0.86)),
    radial-gradient(circle at top left, rgba(69, 136, 255, 0.2), transparent 32%),
    radial-gradient(circle at bottom right, rgba(125, 98, 255, 0.24), transparent 30%);
  backdrop-filter: blur(16px);
}

.atelier-auth-screen[hidden] {
  display: none;
}

.atelier-auth-card {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(17, 29, 56, 0.96), rgba(8, 16, 31, 0.98)),
    var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 22px;
}

.atelier-auth-form {
  gap: 16px;
}

.atelier-auth-error,
.atelier-auth-caption {
  margin: 0;
  line-height: 1.55;
}

.atelier-auth-error {
  color: #ffd8dc;
}

.atelier-auth-caption {
  color: var(--muted);
}

.atelier-hero,
.atelier-panel {
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(17, 29, 56, 0.92), rgba(8, 16, 31, 0.97)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.atelier-hero {
  display: grid;
  gap: 22px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.atelier-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.atelier-brand-mark {
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.atelier-brand-mark img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.atelier-kicker,
.atelier-panel-kicker,
.atelier-card-code,
.atelier-meta-label {
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(184, 204, 255, 0.82);
}

.atelier-brand-copy h1,
.atelier-panel h2,
.atelier-detail-title,
.atelier-stat-value,
.atelier-empty-card h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.atelier-brand-copy h1 {
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 0.96;
}

.atelier-brand-copy p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.atelier-hero-actions,
.atelier-form-actions,
.atelier-inline-actions,
.atelier-filter-group,
.atelier-message-actions,
.atelier-detail-badges,
.atelier-view-switch,
.atelier-attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.atelier-primary-button,
.atelier-secondary-button,
.atelier-mini-button,
.atelier-icon-button,
.atelier-filter-chip,
.atelier-view-chip,
.atelier-step-button,
.atelier-stock-button,
.atelier-danger-button,
.atelier-link-button {
  border: 0;
  border-radius: var(--radius-md);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.atelier-primary-button:hover,
.atelier-secondary-button:hover,
.atelier-mini-button:hover,
.atelier-icon-button:hover,
.atelier-filter-chip:hover,
.atelier-view-chip:hover,
.atelier-step-button:hover,
.atelier-stock-button:hover,
.atelier-danger-button:hover,
.atelier-link-button:hover,
.atelier-ticket-card:hover {
  transform: translateY(-1px);
}

.atelier-primary-button,
.atelier-secondary-button,
.atelier-danger-button {
  min-height: 48px;
  padding: 0 18px;
  font-weight: 700;
}

.atelier-primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 18px 30px rgba(61, 124, 255, 0.25);
}

.atelier-secondary-button,
.atelier-mini-button,
.atelier-icon-button,
.atelier-filter-chip,
.atelier-view-chip,
.atelier-stock-button,
.atelier-step-button,
.atelier-link-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.atelier-mini-button,
.atelier-filter-chip,
.atelier-view-chip {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 700;
}

.atelier-mini-button.is-active,
.atelier-filter-chip.is-active,
.atelier-view-chip.is-active {
  background: linear-gradient(135deg, rgba(69, 136, 255, 0.22), rgba(125, 98, 255, 0.18));
  border-color: rgba(112, 152, 255, 0.36);
}

.atelier-icon-button {
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

.atelier-danger-soft,
.atelier-danger-button {
  color: #ffd9dc;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 110, 120, 0.22);
}

.atelier-sync-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.atelier-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.atelier-sync-dot.is-ready {
  background: var(--green);
  box-shadow: 0 0 18px rgba(79, 212, 147, 0.58);
}

.atelier-sync-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.atelier-stat-card,
.atelier-empty-card,
.atelier-ticket-card,
.atelier-stock-card,
.atelier-note-card,
.atelier-detail-box,
.atelier-attachment-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.atelier-stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
}

.atelier-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.atelier-stat-value {
  margin-top: 12px;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}

.atelier-stat-meta {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.atelier-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.28fr);
  gap: 18px;
  margin-top: 18px;
}

.atelier-layout-bottom {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.atelier-panel {
  padding: 22px;
  border-radius: var(--radius-xl);
}

.atelier-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.atelier-panel-head-stack {
  align-items: flex-start;
}

.atelier-panel-head h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.atelier-panel-copy {
  max-width: 48rem;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.atelier-count-pill,
.atelier-chip,
.atelier-priority-chip,
.atelier-alert-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.atelier-toolbar {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
}

.atelier-field {
  display: grid;
  gap: 8px;
}

.atelier-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.atelier-field input,
.atelier-field textarea,
.atelier-field select,
.atelier-sync-input {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.14);
  color: var(--text);
  resize: vertical;
}

.atelier-field textarea {
  min-height: 100px;
}

.atelier-ticket-list,
.atelier-stock-list,
.atelier-note-list,
.atelier-attachment-list {
  display: grid;
  gap: 12px;
}

.atelier-ticket-card {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-lg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.atelier-ticket-card.is-selected {
  background: linear-gradient(135deg, rgba(69, 136, 255, 0.16), rgba(125, 98, 255, 0.14));
  border-color: rgba(114, 156, 255, 0.34);
}

.atelier-ticket-top,
.atelier-stock-top,
.atelier-note-top,
.atelier-attachment-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.atelier-ticket-main {
  display: grid;
  gap: 6px;
}

.atelier-ticket-title,
.atelier-stock-name,
.atelier-note-title,
.atelier-detail-title,
.atelier-attachment-name {
  font-size: 1.08rem;
  font-weight: 700;
}

.atelier-ticket-meta,
.atelier-note-text,
.atelier-stock-caption,
.atelier-empty-text,
.atelier-detail-subtitle,
.atelier-help-text,
.atelier-attachment-meta,
.atelier-detail-caption {
  color: var(--muted);
  line-height: 1.55;
}

.atelier-ticket-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.atelier-chip[data-stage="intake"] {
  color: #d9f7ff;
  background: rgba(56, 217, 255, 0.14);
}

.atelier-chip[data-stage="diagnostic"] {
  color: #dce7ff;
  background: rgba(69, 136, 255, 0.16);
}

.atelier-chip[data-stage="quote"] {
  color: #fff3d7;
  background: rgba(255, 180, 90, 0.16);
}

.atelier-chip[data-stage="repair"] {
  color: #ece6ff;
  background: rgba(125, 98, 255, 0.16);
}

.atelier-chip[data-stage="testing"] {
  color: #dafcff;
  background: rgba(60, 207, 255, 0.16);
}

.atelier-chip[data-stage="ready"] {
  color: #ddfff0;
  background: rgba(79, 212, 147, 0.16);
}

.atelier-priority-chip[data-priority="normal"] {
  color: #edf3ff;
}

.atelier-priority-chip[data-priority="high"] {
  color: #fff1d3;
  background: rgba(255, 180, 90, 0.14);
}

.atelier-priority-chip[data-priority="urgent"] {
  color: #ffe4e6;
  background: rgba(255, 110, 120, 0.16);
}

.atelier-empty-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius-lg);
}

.atelier-detail-grid,
.atelier-form-grid,
.atelier-inline-form-grid {
  display: grid;
  gap: 14px;
}

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

.atelier-inline-form-grid {
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr));
}

.atelier-field-wide {
  grid-column: 1 / -1;
}

.atelier-detail-stack,
.atelier-detail-form {
  display: grid;
  gap: 18px;
}

.atelier-detail-head {
  display: grid;
  gap: 12px;
}

.atelier-detail-subtitle {
  margin: 0;
}

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

.atelier-detail-box {
  padding: 16px;
  border-radius: var(--radius-lg);
}

.atelier-detail-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.atelier-note-card,
.atelier-attachment-card {
  padding: 14px;
  border-radius: var(--radius-md);
}

.atelier-note-caption,
.atelier-stock-caption,
.atelier-note-date,
.atelier-attachment-meta {
  font-size: 0.88rem;
}

.atelier-message-output {
  width: 100%;
  min-height: 220px;
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  line-height: 1.65;
  resize: vertical;
}

.atelier-inline-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.atelier-stock-card {
  padding: 14px;
  border-radius: var(--radius-md);
}

.atelier-stock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.atelier-step-button,
.atelier-stock-button,
.atelier-link-button {
  min-height: 40px;
  padding: 0 12px;
  font-weight: 700;
}

.atelier-step-button {
  min-width: 40px;
}

.atelier-stock-qty {
  min-width: 52px;
  text-align: center;
  font-weight: 800;
}

.atelier-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.atelier-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 40;
}

.atelier-modal[hidden] {
  display: none;
}

.atelier-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 12, 0.72);
}

.atelier-modal-card {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  padding: 22px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(17, 29, 56, 0.96), rgba(8, 16, 31, 0.98));
  box-shadow: var(--shadow);
}

.atelier-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.atelier-form,
.atelier-sync-sheet {
  display: grid;
  gap: 18px;
}

.atelier-sync-explainer,
.atelier-sync-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.atelier-sensitive-box {
  display: grid;
  gap: 12px;
}

.atelier-sensitive-toggle {
  justify-self: flex-start;
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

.atelier-sensitive-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 110, 120, 0.28);
  background: rgba(255, 110, 120, 0.05);
}

.atelier-sensitive-panel[hidden] {
  display: none;
}

.atelier-sync-status.is-error {
  color: #ffd8dc;
}

.atelier-quote-queue {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.atelier-quote-queue[hidden] {
  display: none;
}

.atelier-quote-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(85, 136, 255, 0.22);
  background: linear-gradient(145deg, rgba(85, 136, 255, 0.12), rgba(130, 78, 255, 0.07));
}

.atelier-quote-list {
  display: grid;
  gap: 12px;
}

.atelier-pdf-modal .atelier-modal-card {
  width: min(1120px, 100%);
}

.atelier-pdf-frame-wrap {
  overflow: hidden;
  min-height: min(72vh, 720px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.96);
}

.atelier-pdf-frame {
  width: 100%;
  height: min(72vh, 720px);
  border: 0;
  background: #fff;
}

.atelier-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(8, 16, 31, 0.94);
  border: 1px solid rgba(85, 136, 255, 0.26);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 60;
}

@media (max-width: 1180px) {
  .atelier-layout,
  .atelier-layout-bottom,
  .atelier-stats,
  .atelier-detail-grid.three-columns {
    grid-template-columns: 1fr;
  }

  .atelier-inline-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .atelier-shell {
    width: min(100vw - 18px, 100%);
    padding: 10px 0 22px;
  }

  .atelier-auth-card,
  .atelier-hero,
  .atelier-panel,
  .atelier-modal-card {
    padding: 18px;
    border-radius: 24px;
  }

  .atelier-brand {
    align-items: flex-start;
  }

  .atelier-brand-mark {
    width: 74px;
    height: 74px;
    border-radius: 22px;
  }

  .atelier-brand-mark img {
    width: 60px;
    height: 60px;
  }

  .atelier-detail-grid,
  .atelier-form-grid,
  .atelier-inline-form-grid {
    grid-template-columns: 1fr;
  }

  .atelier-ticket-top,
  .atelier-stock-top,
  .atelier-note-top,
  .atelier-attachment-top,
  .atelier-panel-head {
    flex-direction: column;
  }

  .atelier-message-output {
    min-height: 180px;
  }
}
