/* Styles for dialogs. Prefix every class with the view name. */

/* ---------- form layout ---------- */
.dlg-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dlg-form .field { min-width: 0; }
.dlg-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dlg-hint { font-size: 13px; color: var(--muted); }
.dlg-wrap { overflow-wrap: anywhere; }

/* An empty error line takes no room; a wrong field gets a red edge. */
.dlg-form .field-error:empty { display: none; }
.dlg-form [aria-invalid="true"] { border-color: var(--rej-bar); }
.dlg-form [aria-invalid="true"]:focus { border-color: var(--rej-bar); box-shadow: 0 0 0 3px rgba(212, 72, 59, 0.18); }
.dlg-form .input::placeholder, .dlg-form .textarea::placeholder { color: var(--muted); opacity: 0.75; }

.dlg-date { min-width: 0; text-align: left; }
.dlg-date::-webkit-date-and-time-value { text-align: left; }

/* ---------- choices ---------- */
.dlg-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-choice-solid { padding: 0 18px; }
.dlg-choice-solid[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* "Used before" chips: 32px tall to the eye, 44px to the finger. */
.dlg-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: -14px 0 -6px; min-width: 0; }
.dlg-chip { height: 44px; max-width: 100%; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; }
.dlg-chip span { height: 32px; line-height: 32px; padding: 0 12px; border-radius: 16px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-chip:hover span { filter: brightness(0.96); }
.dlg-chip[aria-pressed="true"] span { box-shadow: inset 0 0 0 2px currentColor; }

/* ---------- footer: hint on the left, buttons on the right ---------- */
.dlg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-foot .modal-foot { margin-left: auto; }
.dlg-main-btn { padding: 0 22px; }

.dlg-draft { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 4px 12px; }
.dlg-link { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent-ink); font-weight: 600; cursor: pointer; }
.dlg-link:hover { text-decoration: underline; }

/* ---------- input with a button beside it ---------- */
.dlg-with-btn { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-with-btn .input { flex: 1 1 200px; width: auto; min-width: 0; }
.dlg-with-btn .btn { flex: none; height: 46px; }

/* ---------- content pieces in the new-content form ---------- */
.dlg-form [hidden] { display: none !important; }
.dlg-pieces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dlg-piece { min-height: 46px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--off); display: flex; align-items: center; gap: 8px; color: var(--accent-ink); }
.dlg-piece-name { flex: 1 1 0; min-width: 0; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-piece-state { font-weight: 600; color: var(--accent-ink); white-space: nowrap; }
.dlg-piece-state:empty { display: none; }
.dlg-adder { display: flex; flex-direction: column; gap: 8px; }
.dlg-adder .btn { display: inline-flex; }

/* ---------- team ---------- */
.dlg-people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.dlg-person { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.dlg-person + .dlg-person { border-top: 1px solid var(--line); }
.dlg-person-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; }
.dlg-person-who { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
.dlg-person-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dlg-person-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.dlg-person-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.dlg-person-email { overflow-wrap: anywhere; }
.dlg-person-role { flex: none; display: flex; align-items: center; gap: 8px; }
.dlg-person-off { background: var(--off); }
.dlg-person-off .dlg-person-name { color: var(--muted); }
.dlg-person-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-role-boss { background: var(--soft); color: var(--accent-ink); }
.dlg-role-member { background: var(--bg); color: var(--muted); }
.dlg-role-admin { background: var(--ink); color: #fff; }
.dlg-noboss { padding: 10px 12px; background: var(--wait-bg); color: var(--wait-fg); font-weight: 500; }
.dlg-noboss[hidden] { display: none; }

/* The Admin's role dropdown */
.dlg-role-btn { height: 44px; min-width: 124px; padding: 0 10px 0 14px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; }
.dlg-role-btn:hover, .dlg-role-btn[aria-expanded="true"] { background: var(--off); border-color: var(--accent); }
.dlg-role-menu { position: fixed; z-index: 70; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.dlg-role-item { min-height: 56px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); }
.dlg-role-item:hover, .dlg-role-item:focus-visible { background: var(--off); }
.dlg-role-item[aria-checked="true"] { background: var(--soft); color: var(--accent-ink); }
.dlg-role-item-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dlg-role-item-name { font-weight: 600; }

.dlg-inline { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--r); background: var(--off); border: 1px solid var(--line); }
.dlg-person-off .dlg-inline { background: var(--surface); }

.dlg-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; background: var(--soft); color: var(--accent-ink); }
.dlg-secret-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; font-weight: 600; padding: 4px 8px; border-radius: var(--r-sm); background: var(--surface); color: var(--ink); user-select: all; overflow-wrap: anywhere; }
.dlg-secret-hint { flex-basis: 100%; }

.dlg-add { display: flex; flex-direction: column; gap: 16px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- phone ---------- */
@media (max-width: 560px) {
  .dlg-grid2 { grid-template-columns: minmax(0, 1fr); }
  .dlg-foot .modal-foot { flex: 1 1 100%; }
  .dlg-foot .modal-foot .btn { flex: 1 1 auto; }
  .dlg-person-actions { flex: 1 1 100%; gap: 6px; }
  .dlg-person-role > .dlg-hint { display: none; }
  .dlg-role-btn { min-width: 108px; }
  .dlg-person { padding: 12px; }
  .dlg-person-actions .btn { flex: 1 1 auto; padding: 0 8px; font-size: 13px; }
  .dlg-with-btn .btn { flex: 1 1 auto; }
}
