/* Signed-in account dashboard. Reuses the tokens, .wrap, .mono, .btn and
 * .btn-primary from styles.css; only the layout and components specific to
 * this page live here. */

/* The [hidden] attribute must win over component display rules (.btn etc.). */
.dash-page [hidden] {
  display: none;
}

.dash-page :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------ header ------------------------------------ */

.dash-signout {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dash-signout:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

.dash-signout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ------------------------------ layout ------------------------------------ */

.dash {
  padding: clamp(28px, 6vw, 56px) var(--pad) clamp(48px, 10vw, 96px);
}

.dash-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  max-width: none;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.dash-lede {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.dash-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.dash-anchors a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.dash-anchors a:hover {
  color: var(--text);
  border-color: var(--accent);
}

.dash-section {
  margin-top: clamp(28px, 5vw, 48px);
  padding: 0;
  scroll-margin-top: 90px;
}

.dash-section > h2 {
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  margin-bottom: 16px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 4vw, 28px);
  min-width: 0;
}

.dash-card h3 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.dash-split {
  display: grid;
  gap: 18px;
}

@media (min-width: 860px) {
  .dash-split {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ------------------------------- stats ------------------------------------ */

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 14px;
  margin: 0;
}

.dash-stat dt {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.dash-stat dd {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dash-stat dd.dash-stat-small {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: normal;
  padding-top: 0.55rem;
}

/* ------------------------------- lists ------------------------------------ */

.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-item {
  display: grid;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.dash-item:first-child {
  border-top: 0;
  padding-top: 4px;
}

.dash-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dash-item-info {
  flex: 1 1 220px;
  min-width: 0;
}

.dash-item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dash-item-sub,
.dash-item-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.dash-item-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dash-empty,
.dash-hint {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.dash-hint {
  margin: 8px 0 12px;
}

.dash-empty {
  padding: 8px 0;
}

.dash-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.dash-actions:empty {
  display: none;
}

/* ------------------------------- badges ----------------------------------- */

.dash-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dash-badge[data-tone='ok'] {
  background: var(--accent-soft);
  border-color: var(--accent-3);
  color: var(--accent);
}

.dash-badge[data-tone='warn'] {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}

/* ------------------------------ buttons ----------------------------------- */

.dash-btn-quiet {
  background: transparent;
  background-image: none;
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

.dash-btn-quiet:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--accent);
}

.dash-btn-small {
  padding: 6px 12px;
  min-height: 0;
  font-size: 0.82rem;
}

/* ------------------------------ reveal ------------------------------------ */

.dash-reveal {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 16px;
}

.dash-cred {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 0;
}

.dash-cred-label {
  flex: 0 0 84px;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.dash-cred-value {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--text);
  user-select: all;
}

.dash-reveal-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dash-reveal-note {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ------------------------------- forms ------------------------------------ */

.dash-field {
  margin-bottom: 16px;
}

.dash-field .dash-hint {
  margin-bottom: 0;
}

.dash-input {
  display: block;
  width: 100%;
  min-height: 46px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s ease;
}

.dash-input:hover {
  border-color: var(--text-muted);
}

.dash-input:focus-visible {
  border-color: var(--accent);
}

.dash-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.dash-card form .btn {
  margin-top: 4px;
}

/* ------------------------------ messages ---------------------------------- */

.dash-msg {
  margin-top: 12px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.dash-msg:empty {
  display: none;
}

.dash-msg[data-kind='error'] {
  color: var(--danger);
}

.dash-msg[data-kind='ok'] {
  color: var(--accent);
}

/* ------------------------------ pager ------------------------------------- */

.dash-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* ------------------------------ ticket detail ----------------------------- */

.dash-detail {
  margin-top: 18px;
}

.dash-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dash-detail-head h3 {
  margin: 0;
  flex: 1 1 240px;
  min-width: 0;
}

.dash-pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.dash-detail-label {
  margin: 18px 0 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dash-reply {
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
}

/* ------------------------------ small screens ----------------------------- */

@media (max-width: 640px) {
  .dash-item-side {
    width: 100%;
  }

  .dash-cred-label {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-signout,
  .dash-anchors a,
  .dash-input {
    transition: none;
  }
}