/* Login, dashboard, tasks, administration. */

/* ---------------------------------------------------------------- login */

.login-root {
  height: 100%;
}

.login-page {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  padding: 20px;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: float-orb 14s ease-in-out infinite;
  pointer-events: none;
}

.orb-a { width: 420px; height: 420px; top: -120px; left: -80px; background: var(--accent); }
.orb-b { width: 360px; height: 360px; bottom: -120px; right: -60px; background: var(--accent-2); animation-delay: -5s; }
.orb-c { width: 240px; height: 240px; top: 45%; left: 55%; background: color-mix(in srgb, var(--accent) 50%, var(--accent-2)); opacity: 0.3; animation-delay: -9s; }

.login-card {
  position: relative;
  display: grid;
  width: min(410px, 100%);
  padding: 34px 32px 30px;
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow);
  animation: scale-in 0.6s var(--ease);
}

.login-card.shake {
  animation: shake 0.5s var(--ease);
}

.login-card h1 {
  margin-top: 16px;
  font-size: 1.5rem;
}

.login-card p {
  margin: 6px 0 22px;
}

.login-card .btn {
  margin-top: 20px;
  height: 46px;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ------------------------------------------------------------ dashboard */

.usage-card {
  margin-bottom: 18px;
}

.limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.limit {
  --ring: var(--ok);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  animation: fade-up 0.5s var(--ease) both;
}

.limit[data-level="warn"] { --ring: var(--warn); }
.limit[data-level="danger"] { --ring: var(--danger); }

.ring {
  position: relative;
  flex: none;
  width: 112px;
  height: 112px;
}

.ring-svg {
  width: 100%;
  height: 100%;
}

.ring-track {
  stroke: var(--surface-3);
}

.ring-progress {
  stroke: var(--ring);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ring) 55%, transparent));
  transition: stroke-dashoffset 1.2s var(--ease), stroke 0.4s;
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 38px;
  font-weight: 750;
}

.ring-num {
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.ring-pct {
  margin-left: 2px;
  font-size: 0.9rem;
  color: var(--text-2);
}

.limit-title {
  font-weight: 700;
}

.limit-reset {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.usage-unavailable {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
}

.usage-unavailable > div {
  flex: 1;
}

.usage-unavailable-title {
  font-weight: 650;
  color: var(--text);
}

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

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: transform 0.2s var(--ease), border-color 0.2s;
  animation: fade-up 0.5s var(--ease) both;
}

.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }

.stat:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
}

.stat-num {
  font-size: 1.6rem;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-2);
}

.usage-body .skeleton-group {
  max-width: 420px;
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .limit {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------------------------------------------------------------- tasks */

.tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

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

.task-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.3s, transform 0.2s var(--ease);
  animation: fade-up 0.4s var(--ease) both;
}

.task-card:hover {
  transform: translateY(-1px);
}

.task-card[data-status="running"] { border-left-color: var(--accent); }
.task-card[data-status="done"] { border-left-color: var(--ok); }
.task-card[data-status="failed"] { border-left-color: var(--danger); }

.task-card.flash {
  animation: flash-bg 1.2s ease-out;
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.task-title {
  font-weight: 700;
  font-size: 1rem;
}

.task-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  color: var(--text-2);
  font-size: 0.9rem;
}

.task-activity {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 550;
  background: linear-gradient(90deg, var(--text-3) 30%, var(--text) 50%, var(--text-3) 70%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2.2s linear infinite;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-3);
}

.task-result {
  margin-top: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.task-result summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

.task-result-body {
  padding: 0 14px 12px;
  font-size: 0.9rem;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.sessions-card {
  position: sticky;
  top: 0;
}

.sessions-card .li {
  padding: 8px 10px;
}

@media (max-width: 1100px) {
  .tasks-layout {
    grid-template-columns: 1fr;
  }

  .sessions-card {
    position: static;
  }
}

@media (max-width: 560px) {
  .task-card {
    flex-direction: column;
  }

  .task-actions {
    justify-content: flex-start;
  }
}

/* ---------------------------------------------------------------- admin */

.account-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.account-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: var(--text-2);
  background: var(--surface-3);
}

.account-avatar.ok {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 14%, transparent);
}

.account-text {
  flex: 1;
  min-width: 0;
}

.account-title {
  font-size: 1.1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.account-badges {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-card {
  animation: scale-in 0.35s var(--ease);
}

.flow-wait {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  color: var(--text-2);
}

.flow-steps {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-step {
  display: flex;
  gap: 14px;
}

.flow-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.flow-step-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.flow-step-title {
  font-weight: 650;
  padding-top: 3px;
}

.link-row,
.code-form {
  display: flex;
  gap: 8px;
}

.table-card {
  padding: 8px;
}

.table {
  display: grid;
}

.trow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px;
  border-radius: 12px;
  transition: background 0.15s;
  animation: fade-up 0.35s var(--ease) both;
}

.trow + .trow {
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
}

.trow:hover {
  background: var(--surface-2);
}

.trow.disabled .trow-main {
  opacity: 0.55;
}

.trow-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.trow-main {
  flex: 1;
  min-width: 0;
}

.trow-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.trow-sub {
  font-size: 0.82rem;
  color: var(--text-2);
}

.trow-sub code {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.trow-sub.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-3);
}

.trow-col {
  flex: none;
  width: 140px;
  font-size: 0.85rem;
}

.trow-col-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.trow-actions {
  display: flex;
  flex: none;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.kv + .kv {
  border-top: 1px solid var(--border);
}

.note {
  display: flex;
  gap: 14px;
  padding: 12px 0;
}

.note + .note {
  border-top: 1px solid var(--border);
}

.note-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.note-title {
  font-weight: 650;
}

@media (max-width: 900px) {
  .trow {
    flex-wrap: wrap;
  }

  .trow-col {
    width: auto;
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  .account-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .tab-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .link-row,
  .code-form {
    flex-direction: column;
  }
}
