/* Qayd workspace app + auth — uses go-cortex theme tokens */

.qayd-app {
  padding-block: 24px 64px;
  padding-inline: 0;
  background: var(--paper);
  color: var(--ink);
  min-height: 50vh;
  overflow-x: clip;
}

.qayd-app .wrap {
  max-width: 1280px;
  padding-inline: 16px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.qayd-app--narrow .wrap,
.qayd-app--mid .wrap {
  max-width: 960px;
}

.qayd-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-block-end: 1.5rem;
  padding-block-end: 1.25rem;
  border-block-end: 1px solid var(--line);
}

.qayd-shell__brand {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.qayd-shell__eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
}

.qayd-shell__title {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.qayd-shell__meta {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-2);
}

.qayd-shell__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.qayd-shell__actions form {
  all: unset;
  display: inline-flex;
}

.qayd-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.qayd-btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.qayd-flash {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14.5px;
}

.qayd-flash--ok {
  background: color-mix(in srgb, #059669 12%, var(--paper));
  border-color: color-mix(in srgb, #059669 35%, var(--line));
  color: #047857;
}

:root[data-theme="dark"] .qayd-flash--ok {
  color: #6ee7b7;
}

.qayd-flash--warn {
  background: color-mix(in srgb, #ea6c0a 12%, var(--paper));
  border-color: color-mix(in srgb, #ea6c0a 35%, var(--line));
  color: #9a3412;
}

:root[data-theme="dark"] .qayd-flash--warn {
  color: #fdba74;
}

.qayd-flash--err {
  background: color-mix(in srgb, #dc2626 12%, var(--paper));
  border-color: color-mix(in srgb, #dc2626 35%, var(--line));
  color: #b91c1c;
}

:root[data-theme="dark"] .qayd-flash--err {
  color: #fca5a5;
}

.qayd-panel {
  margin: 0 0 1.15rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.qayd-panel__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.qayd-panel__lead {
  margin: 0 0 1rem;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.55;
}

.qayd-callout {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, #ea6c0a 40%, var(--line));
  background: color-mix(in srgb, #ea6c0a 10%, var(--paper));
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
}

.qayd-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.85rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  max-width: 28rem;
}

.qayd-form--wide {
  max-width: none;
}

.qayd-form .f {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qayd-form .f label,
.qayd-form > label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qayd-form input[type="text"],
.qayd-form input[type="email"],
.qayd-form input[type="date"],
.qayd-form input[type="password"],
.qayd-form input[type="number"],
.qayd-form input:not([type]),
.qayd-form select,
.qayd-form textarea,
.qayd-form .form-control {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  padding: 11px 13px;
  font: inherit;
  font-size: 15.5px;
  width: 100%;
  box-sizing: border-box;
}

.qayd-form input[type="file"] {
  border: 1px dashed var(--line);
  background: var(--paper);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  font-size: 14px;
}

.qayd-form input:focus,
.qayd-form select:focus,
.qayd-form textarea:focus,
.qayd-form .form-control:focus {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

.qayd-form .btn {
  justify-content: center;
  width: fit-content;
}

.qayd-consent {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.qayd-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 14.5px;
  color: var(--ink-2);
  cursor: pointer;
  margin: 0;
}

.qayd-check input[type="checkbox"] {
  -webkit-appearance: checkbox !important;
  appearance: auto !important;
  width: 1.2rem !important;
  height: 1.2rem !important;
  min-width: 1.2rem !important;
  min-height: 1.2rem !important;
  margin: 0.15rem 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  accent-color: var(--accent, #3346e0);
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface, #fff);
}

.qayd-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.qayd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.qayd-table th,
.qayd-table td {
  padding: 0.7rem 0.85rem;
  text-align: start;
  border-block-end: 1px solid var(--line);
  vertical-align: top;
}

.qayd-table th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

.qayd-table tr:last-child td {
  border-block-end: 0;
}

.qayd-table tr.is-amber {
  background: color-mix(in srgb, #ea6c0a 10%, var(--surface));
}

.qayd-table a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.qayd-table a:hover {
  text-decoration: underline;
}

.qayd-chip {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

.qayd-chip--ok {
  background: color-mix(in srgb, #059669 16%, var(--paper));
  color: #047857;
}

:root[data-theme="dark"] .qayd-chip--ok {
  color: #6ee7b7;
}

.qayd-chip--warn {
  background: color-mix(in srgb, #ea6c0a 16%, var(--paper));
  color: #9a3412;
}

:root[data-theme="dark"] .qayd-chip--warn {
  color: #fdba74;
}

.qayd-chip--info {
  background: color-mix(in srgb, var(--brand) 16%, var(--paper));
  color: var(--brand-deep);
}

.qayd-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-block-end: 0.85rem;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}

.qayd-back:hover {
  color: var(--brand);
}

.qayd-auth {
  padding-block: 40px 72px;
  background: color-mix(in srgb, var(--brand) 8%, var(--paper));
}

.qayd-auth .wrap {
  max-width: 420px;
  padding-inline: 16px;
}

.qayd-auth__card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--ink) 6%, transparent);
}

.qayd-auth__card .h1 {
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  margin: 0 0 0.5rem;
}

.qayd-auth__card .sub {
  margin: 0 0 1.25rem;
}

.qayd-auth form.qayd-form {
  max-width: none;
}

.qayd-auth form.qayd-form .btn {
  width: 100%;
}

.qayd-auth .qayd-resend {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: 0 !important;
  padding: 0 !important;
  margin: 1rem 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none;
  max-width: none;
}

.qayd-auth .qayd-resend input[type="hidden"] {
  display: none !important;
}

.qayd-auth .qayd-resend .qayd-btn-ghost {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 16px;
  margin: 0;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  text-align: center;
}

.qayd-auth .qayd-resend .qayd-btn-ghost:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.qayd-auth .qayd-resend .qayd-btn-ghost:not(:disabled):hover {
  border-color: var(--brand);
  color: var(--brand);
}

.qayd-auth__other {
  margin-top: 1rem;
}

.qayd-code-input {
  font-family: "IBM Plex Mono", monospace !important;
  font-size: 1.35rem !important;
  letter-spacing: 0.35em;
  text-align: center;
}

.qayd-stepper-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  margin-block-end: 16px;
}

.qayd-stepper-card h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.qayd-stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.qayd-stepper__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  text-decoration: none;
  border: 0;
  background: transparent;
}

.qayd-stepper__item.is-current {
  background: var(--surface);
  color: var(--ink);
}

.qayd-stepper__item.is-later {
  opacity: .45;
  pointer-events: none;
}

.qayd-stepper__dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 2px solid var(--line-2, var(--line));
}

.qayd-stepper__item.is-done .qayd-stepper__dot {
  background: #0a6a4e;
  border-color: #0a6a4e;
  color: #fff;
}

.qayd-stepper__item.is-current .qayd-stepper__dot {
  border-color: var(--ink);
}

.qayd-stepper__line {
  width: 24px;
  height: 2px;
  background: var(--line-2, var(--line));
}

.qayd-drop {
  width: 100%;
  border: 2px dashed var(--line-2, var(--line));
  border-radius: 14px;
  background: var(--surface);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
}

.qayd-drop strong {
  display: block;
  font-size: 16px;
  margin-block-end: 6px;
}

.qayd-slot-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-start: 8px;
}

.qayd-slot-form input[type="file"] {
  max-width: 100%;
  font-size: 14px;
}

.qayd-need {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-block-end: 8px;
}

.qayd-need.is-ok {
  border-color: #0a6a4e;
}

.qayd-need.is-bad {
  border-color: #b8322a;
  background: #fbe8e6;
}

.qayd-need__dot {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1.5px dashed var(--line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.qayd-need.is-ok .qayd-need__dot {
  border-style: solid;
  border-color: #0a6a4e;
  background: #0a6a4e;
  color: #fff;
}

.qayd-task {
  border: 1px solid #9a5b06;
  background: #fbf0db;
  border-radius: 12px;
  padding: 16px;
  margin-block-end: 12px;
}

.qayd-task.is-optional {
  background: var(--paper);
  border-color: var(--line);
}

.qayd-done-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--paper);
}

.qayd-foot {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.qayd-bars {
  display: inline-flex;
  gap: 3px;
}

.qayd-bars i {
  display: block;
  width: 28px;
  height: 6px;
  border-radius: 2px;
  background: var(--line);
}

.qayd-bars i.is-on {
  background: #0a6a4e;
}

.qayd-tnum {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.qayd-col-name {
  min-width: 170px;
}

.qayd-map-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 110px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--paper);
  margin-block-end: 8px;
}

.qayd-aud-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.qayd-done-line {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.qayd-notes-editor {
  min-width: 0;
}

.qayd-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.qayd-auth form.qayd-form .btn {
  height: 48px;
}

@media (max-width: 980px) {
  .qayd-stats {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .qayd-hide-760 {
    display: none;
  }
  .qayd-file-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .qayd-notes-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (min-width: 761px) {
  .qayd-notes-editor {
    position: sticky;
    top: 72px;
  }
}

@media (max-width: 640px) {
  .qayd-shell {
    flex-direction: column;
  }
  .qayd-shell__actions {
    width: 100%;
  }
  .qayd-shell__actions .btn,
  .qayd-shell__actions .qayd-btn-ghost,
  .qayd-foot .btn {
    flex: 1;
    width: 100%;
    justify-content: center;
  }
  .qayd-panel {
    padding: 16px;
  }
  .qayd-stepper {
    width: 100%;
    justify-content: space-between;
  }
  .qayd-stepper__item:not(.is-current) .qayd-stepper__label,
  .qayd-stepper__line {
    display: none;
  }
  .qayd-need__file {
    display: none;
  }
  .qayd-map-row {
    grid-template-columns: 52px minmax(0, 1fr) 110px;
  }
  .qayd-map-row .qayd-map-target {
    grid-column: 1 / -1;
  }
  .qayd-aud-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .qayd-done-line {
    grid-template-columns: 18px minmax(0, 1fr);
  }
  .qayd-done-line a {
    grid-column: 2;
  }
}
