/* ==========================================================
   _dialog.css — Dialog padrão e dialog-card
   ========================================================== */

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  margin: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  width: min(520px, 95vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-card {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
  gap: 12px;
}

.dialog-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.dialog-close {
  all: unset;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.dialog-close:hover { background: var(--line); color: var(--text); }

.dialog-card form {
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-card fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.logo-upload-label {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.logo-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--line-dark);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg);
  transition: border-color .2s;
}
.logo-preview:hover { border-color: var(--brand); }
.logo-preview img   { width: 100%; height: 100%; object-fit: cover; }
.logo-preview .logo-placeholder {
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  padding: 4px;
}

.logo-upload-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.logo-upload-info .upload-btn-text {
  font-size: .875rem;
  font-weight: 600;
  color: var(--brand);
  display: block;
}
.logo-upload-info .upload-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================
   Workshop Manager Dialog
   ========================================================== */

.wm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  overflow-y: auto;
  padding: 24px;
}

.wm-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  margin: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
.wm-card--wide {
  max-width: 600px;
}
.wm-card h2 {
  margin: 0 0 24px;
  font-size: 1.3rem;
}
.wm-card > p {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: .9rem;
}

.wm-card form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wm-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wm-option-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color var(--t), background var(--t);
}
.wm-option-btn:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.wm-option-btn strong {
  display: block;
  font-size: .9375rem;
  color: var(--text);
}
.wm-option-btn p {
  margin: 4px 0 0;
  font-size: .825rem;
  color: var(--text-muted);
}

.wm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.wm-field {
  margin-bottom: 16px;
}
.wm-field:last-of-type {
  margin-bottom: 24px;
}
.wm-label {
  display: block;
  font-weight: 600;
  font-size: .8125rem;
  margin-bottom: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.wm-input,
.wm-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t);
}
.wm-input:focus,
.wm-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.wm-chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wm-chip {
  padding: 6px 14px;
  border: 1.5px solid var(--line-dark);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: border-color var(--t), background var(--t), color var(--t);
}
.wm-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.wm-chip.is-active,
.wm-chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.wm-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.wm-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}
.wm-check-row label {
  font-weight: 500;
  cursor: pointer;
  font-size: .9375rem;
  color: var(--text);
}

.wm-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wm-time-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-muted);
}
.wm-time-input {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
}
.wm-time-sep {
  font-size: .8125rem;
  color: var(--text-muted);
  font-weight: 600;
}

.wm-skip-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.wm-skip-row input[type="date"] {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .875rem;
  background: var(--surface);
  outline: none;
}
.wm-skip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.wm-skip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1.5px solid var(--line-dark);
  border-radius: 999px;
  background: var(--brand-soft);
}
.wm-skip-item span {
  font-size: .875rem;
  color: var(--text);
}
.wm-skip-remove {
  border: none;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 600;
  font-size: .8125rem;
}

/* Reschedule items */
.wm-reschedule-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 24px;
  padding: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wm-reschedule-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.wm-reschedule-grid {
  display: grid;
  grid-template-columns: 40px 1fr 52px;
  gap: 12px;
  align-items: center;
}
.wm-reschedule-img {
  width: 40px;
  height: 40px;
  background: var(--brand-soft);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wm-reschedule-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.wm-reschedule-select {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .875rem;
  background: var(--surface);
}
.wm-reschedule-del {
  border: 1.5px solid var(--line-dark);
  background: var(--surface);
  border-radius: var(--radius-md);
  height: 34px;
  cursor: pointer;
  font-size: .875rem;
  transition: border-color var(--t);
}
.wm-reschedule-del:hover {
  border-color: var(--danger);
}
.wm-reschedule-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wm-reschedule-date {
  padding: 6px 8px;
  border: 1.5px solid var(--line-dark);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: .875rem;
  background: var(--surface);
}

/* ==========================================================
   Dialog padrão do sistema — .dlg
   Uso: <dialog class="dlg"><div class="dlg__header">...
   ========================================================== */
/* ==========================================================
   Dialog semântico — estilo aplicado diretamente em <dialog>
   Estrutura: <dialog><header><h2>… <footer>
   ========================================================== */
dialog {
  width: min(720px, 95vw);
  max-height: 88vh;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(15,23,42,.2);
  padding: 0;
  overflow: hidden;
  flex-direction: column;
}
dialog::backdrop {
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
}
dialog[open] { display: flex; }

/* Cabeçalho */
dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

dialog > header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}

dialog > header p {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
}

dialog > header button {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
}
dialog > header button:hover { background: var(--line); color: var(--text); }

/* Corpo scrollável */
dialog > div {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Form como corpo scrollável do dialog (layout, não estilos de formulário) */
dialog > form {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* Rodapé */
dialog > footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

/* Responsivo */
@media (max-width: 480px) {
  dialog { width: 100vw; max-width: 100vw; border-radius: var(--radius) var(--radius) 0 0; margin-top: auto; max-height: 92vh; }
}
