:root {
  --archify-accent: #7c8cff;
  --archify-cyan: #39d7e8;
  --archify-panel: rgba(10, 15, 30, .96);
  --archify-surface: rgba(255, 255, 255, .055);
  --archify-line: rgba(163, 181, 255, .18);
  --archify-text: #f5f7ff;
  --archify-muted: #a7b0cb;
}

.archify-shell, .archify-shell * { box-sizing: border-box; }

.archify-shell {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: none;
  color: var(--archify-text);
  background:
    radial-gradient(circle at 14% 8%, rgba(92, 93, 228, .24), transparent 30%),
    radial-gradient(circle at 86% 88%, rgba(30, 197, 214, .18), transparent 34%),
    #070a14;
  overflow: auto;
}

.archify-shell[data-open="true"] { display: block; }
.archify-app { width: min(1500px, 100%); min-height: 100%; margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem); }
.archify-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.archify-heading { min-width: 0; }
.archify-kicker { color: #5eead4; font-size: .73rem; font-weight: 850; letter-spacing: .14em; }
.archify-title { margin: .32rem 0; color: #fff; font-size: clamp(1.75rem, 4vw, 2.85rem); font-weight: 850; letter-spacing: -.06em; }
.archify-desc { max-width: 650px; margin: 0; color: #a9b6d5; }
.archify-top-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.archify-close { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; white-space: nowrap; }

.archify-layout { display: grid; grid-template-columns: minmax(360px, .82fr) minmax(480px, 1.18fr); gap: 22px; align-items: start; min-width: 0; }
.archify-layout > * { min-width: 0; }
.archify-card { border: 1px solid var(--archify-line); border-radius: 24px; background: var(--archify-panel); box-shadow: 0 22px 70px rgba(0,0,0,.24); backdrop-filter: blur(18px); }
.archify-create { padding: 24px; position: sticky; top: 22px; }
.archify-card-title { margin: 0 0 7px; font-size: 1.05rem; }
.archify-card-desc { margin: 0 0 20px; color: var(--archify-muted); font-size: .88rem; line-height: 1.6; }
.archify-field { display: grid; gap: 8px; margin-top: 16px; }
.archify-field label, .archify-toggle-label { color: #dce2f8; font-size: .84rem; font-weight: 650; }
.archify-field textarea, .archify-field select {
  width: 100%;
  border: 1px solid rgba(153,171,236,.23);
  border-radius: 14px;
  color: var(--archify-text);
  background: rgba(4,8,19,.76);
  outline: none;
}
.archify-field textarea { min-height: 210px; padding: 15px 16px; resize: vertical; line-height: 1.62; }
.archify-field select { height: 46px; padding: 0 13px; }
.archify-field textarea:focus, .archify-field select:focus { border-color: rgba(88,216,232,.72); box-shadow: 0 0 0 3px rgba(56,214,231,.1); }
.archify-field option { color: #101529; background: #fff; }
.archify-input-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: -2px; }
.archify-input-help { min-width: 0; color: #7f89a7; font-size: .72rem; line-height: 1.45; }
.archify-counter { flex: 0 0 auto; color: #7f89a7; font-size: .73rem; }
.archify-options { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.archify-toggle { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 13px; border: 1px solid rgba(153,171,236,.18); border-radius: 14px; background: rgba(255,255,255,.035); }
.archify-toggle input { width: 18px; height: 18px; accent-color: var(--archify-accent); }
.archify-primary { width: 100%; min-height: 50px; margin-top: 20px; border: 0; border-radius: 15px; color: #fff; background: linear-gradient(120deg, #6978ef, #26b9cc); font-weight: 750; cursor: pointer; box-shadow: 0 14px 34px rgba(62,89,213,.25); }
.archify-primary:hover { filter: brightness(1.08); }
.archify-primary:disabled { opacity: .5; cursor: wait; }
.archify-contract { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 17px; }
.archify-contract span { padding: 8px 6px; border: 1px solid rgba(152,173,240,.14); border-radius: 10px; color: #aeb7d4; background: rgba(255,255,255,.025); text-align: center; font-size: .7rem; }

.archify-history { min-width: 0; min-height: 620px; padding: 22px; overflow: hidden; }
.archify-history-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.archify-history-head h2 { margin: 0; font-size: 1.05rem; }
.archify-refresh { border: 1px solid var(--archify-line); border-radius: 11px; padding: 8px 11px; color: #dce3fc; background: rgba(255,255,255,.04); cursor: pointer; }
.archify-list { display: grid; min-width: 0; max-width: 100%; gap: 12px; }
.archify-empty { display: grid; place-items: center; min-height: 390px; color: var(--archify-muted); text-align: center; line-height: 1.7; }
.archify-task { min-width: 0; max-width: 100%; padding: 17px; overflow: hidden; border: 1px solid rgba(150,170,237,.16); border-radius: 17px; background: rgba(255,255,255,.034); }
.archify-task-head { display: flex; min-width: 0; max-width: 100%; align-items: flex-start; justify-content: space-between; gap: 14px; }
.archify-task-title { flex: 1 1 auto; min-width: 0; max-width: 100%; overflow: hidden; }
.archify-task-title strong { display: block; width: 100%; overflow: hidden; color: #f4f6ff; text-overflow: ellipsis; white-space: nowrap; }
.archify-task-title small { display: block; margin-top: 5px; color: #8993b2; }
.archify-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #bfc7e7; background: rgba(255,255,255,.08); font-size: .72rem; }
.archify-status--completed { color: #8bf0cf; background: rgba(43,205,156,.12); }
.archify-status--failed { color: #ff9f9f; background: rgba(255,91,91,.12); }
.archify-status--active { color: #9be9ff; background: rgba(51,190,225,.12); }
.archify-phase { display: flex; min-width: 0; justify-content: space-between; gap: 12px; margin-top: 13px; color: #b3bdd9; font-size: .78rem; }
.archify-phase > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archify-phase > :last-child { flex: 0 0 auto; }
.archify-progress { height: 5px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.archify-progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6c7cf3, #31cede); transition: width .35s ease; }
.archify-quality { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.archify-quality span { padding: 5px 8px; border: 1px solid rgba(117,224,194,.18); border-radius: 9px; color: #a9e8d6; background: rgba(31,193,146,.06); font-size: .7rem; }
.archify-error { margin-top: 11px; padding: 10px 12px; border-left: 3px solid #ff7474; border-radius: 8px; color: #ffb4b4; background: rgba(255,74,74,.07); font-size: .78rem; line-height: 1.55; white-space: pre-wrap; }
.archify-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.archify-action { border: 1px solid rgba(153,174,242,.2); border-radius: 10px; padding: 7px 10px; color: #d8dff7; background: rgba(255,255,255,.045); cursor: pointer; font-size: .75rem; }
.archify-action:hover { border-color: rgba(81,215,230,.5); background: rgba(65,200,219,.08); }
.archify-action--open { color: #071522; border-color: transparent; background: linear-gradient(120deg, #8f9aff, #62e2e6); font-weight: 700; }
.archify-action--danger { color: #ffadad; }
.archify-toast { position: fixed; left: 50%; bottom: 28px; z-index: 2200; max-width: min(560px, calc(100vw - 30px)); padding: 12px 16px; border: 1px solid rgba(160,180,245,.25); border-radius: 12px; color: #f7f8ff; background: rgba(13,19,38,.96); box-shadow: 0 18px 50px rgba(0,0,0,.32); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; transition: .2s ease; }
.archify-toast[data-show="true"] { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 940px) {
  .archify-layout { grid-template-columns: 1fr; }
  .archify-create { position: static; }
  .archify-history { min-height: 420px; }
}

@media (max-width: 680px) {
  .archify-topbar { flex-direction: column; }
  .archify-top-actions { width: 100%; }
}

@media (max-width: 560px) {
  .archify-app { padding: 16px 12px 30px; }
  .archify-brand p { display: none; }
  .archify-card { border-radius: 18px; }
  .archify-create, .archify-history { padding: 17px; }
  .archify-options { grid-template-columns: 1fr; }
  .archify-contract { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .archify-progress > i, .archify-toast { transition: none; }
}
