/* P12 Checker — monochrome upload / result */

.p12-hero {
  min-height: calc(100dvh - var(--nav-h) - 6rem);
  display: grid;
  align-content: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  padding-top: clamp(1rem, 3vw, 2rem);
  width: 100%;
  max-width: 720px;
  min-width: 0;
}

.p12-hero h1 {
  font-size: clamp(2.2rem, 6.5vw, 4.2rem);
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 1.05;
  max-width: 12ch;
  animation: rise 0.85s var(--ease-out) 0.12s both;
}

.form-stack {
  display: grid;
  gap: 1.5rem;
  animation: rise 0.9s var(--ease-out) 0.24s both;
  width: 100%;
  min-width: 0;
}

.field-block {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.field-block label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.dropzone {
  position: relative;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.35s var(--ease), color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  cursor: pointer;
  max-width: 100%;
}

.dropzone:hover,
.dropzone.is-drag {
  background: var(--glow);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--fg);
}

.dropzone.has-file {
  color: var(--fg);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone .dz-title {
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  color: inherit;
}

.dropzone .dz-sub {
  font-size: 0.82rem;
  word-break: break-all;
}

.text-input {
  appearance: none;
  width: 100%;
  min-height: 52px;
  padding: 0 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
  box-shadow: inset 0 -1px 0 var(--line);
}

.text-input:focus {
  box-shadow: inset 0 -1px 0 var(--fg);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 0.75rem;
  background: var(--glow);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok {
  color: #1a7f4b;
  background: rgba(26, 127, 75, 0.1);
}
.badge-danger {
  color: #b42318;
  background: rgba(180, 35, 24, 0.1);
}
.badge-warn {
  color: #b54708;
  background: rgba(181, 71, 8, 0.12);
}
.badge-info {
  color: #175cd3;
  background: rgba(23, 92, 211, 0.1);
}
.badge-neutral {
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  .badge-ok {
    color: #6ce9a6;
    background: rgba(108, 233, 166, 0.12);
  }
  .badge-danger {
    color: #f97066;
    background: rgba(249, 112, 102, 0.14);
  }
  .badge-warn {
    color: #fdb022;
    background: rgba(253, 176, 34, 0.14);
  }
  .badge-info {
    color: #84caff;
    background: rgba(132, 202, 255, 0.14);
  }
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.88rem;
  letter-spacing: 0.01em;
}

.pill-ok {
  color: #1a7f4b;
  background: rgba(26, 127, 75, 0.12);
}
.pill-danger {
  color: #b42318;
  background: rgba(180, 35, 24, 0.12);
}
.pill-warn {
  color: #b54708;
  background: rgba(181, 71, 8, 0.14);
}
.pill-info {
  color: #175cd3;
  background: rgba(23, 92, 211, 0.12);
}
.pill-neutral {
  color: var(--fg);
  background: var(--glow);
}

@media (prefers-color-scheme: dark) {
  .pill-ok {
    color: #6ce9a6;
    background: rgba(108, 233, 166, 0.14);
  }
  .pill-danger {
    color: #f97066;
    background: rgba(249, 112, 102, 0.16);
  }
  .pill-warn {
    color: #fdb022;
    background: rgba(253, 176, 34, 0.16);
  }
  .pill-info {
    color: #84caff;
    background: rgba(132, 202, 255, 0.16);
  }
}

.result-wrap {
  max-width: 720px;
  width: 100%;
  min-width: 0;
  padding-top: clamp(1rem, 4vw, 2rem);
}

.result-section {
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-top: 1.5rem;
  position: relative;
}

.result-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 1px;
  background: var(--fg);
  opacity: 0.35;
}

.result-section h2 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 550;
  letter-spacing: -0.025em;
  margin: 0.75rem 0 1rem;
}

.kv {
  display: grid;
  gap: 0;
}

.kv-row {
  display: grid;
  grid-template-columns: minmax(96px, 140px) minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  position: relative;
  min-width: 0;
}

.kv-row + .kv-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

.kv-k {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.2rem;
}

.kv-v {
  font-size: 0.98rem;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
  white-space: pre-wrap;
}

.kv-v.mono {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.result-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  font-weight: 560;
  margin-top: 0.5rem;
}

.drop-banner {
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  position: relative;
}

.drop-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 1px;
  background: var(--fg);
  opacity: 0.35;
}

.drop-banner-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.drop-banner-title {
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  margin: 0.35rem 0 0.4rem;
}

.drop-banner-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.drop-banner.is-ok .drop-banner-title {
  color: #1a7f4b;
}
.drop-banner.is-dropped .drop-banner-title {
  color: #b42318;
}
.drop-banner.is-unknown .drop-banner-title {
  color: #b54708;
}

@media (prefers-color-scheme: dark) {
  .drop-banner.is-ok .drop-banner-title {
    color: #6ce9a6;
  }
  .drop-banner.is-dropped .drop-banner-title {
    color: #f97066;
  }
  .drop-banner.is-unknown .drop-banner-title {
    color: #fdb022;
  }
}

.result-badges {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.result-actions {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.device-list,
.ent-list {
  display: grid;
  gap: 0;
}

.device-item {
  padding: 0.85rem 0;
  position: relative;
  font-size: 0.9rem;
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  word-break: break-all;
}

.device-idx {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.device-item .mono {
  font-family: var(--mono);
  font-size: 0.88rem;
}

.device-item + .device-item::before,
.ent-item + .ent-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

.ent-item {
  padding: 1.15rem 0 1.15rem 0.85rem;
  position: relative;
  border-left: 2px solid var(--line);
}

.ent-item.ent-ok {
  border-left-color: #1a7f4b;
}
.ent-item.ent-info {
  border-left-color: #175cd3;
}
.ent-item.ent-warn {
  border-left-color: #b54708;
}
.ent-item.ent-danger {
  border-left-color: #b42318;
}
.ent-item.ent-neutral {
  border-left-color: var(--line);
}

@media (prefers-color-scheme: dark) {
  .ent-item.ent-ok { border-left-color: #6ce9a6; }
  .ent-item.ent-info { border-left-color: #84caff; }
  .ent-item.ent-warn { border-left-color: #fdb022; }
  .ent-item.ent-danger { border-left-color: #f97066; }
}

.ent-label {
  font-size: 1.02rem;
  font-weight: 550;
  letter-spacing: -0.015em;
  margin-bottom: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ent-tone-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.ent-ok .ent-tone-dot { background: #1a7f4b; }
.ent-info .ent-tone-dot { background: #175cd3; }
.ent-warn .ent-tone-dot { background: #b54708; }
.ent-danger .ent-tone-dot { background: #b42318; }

@media (prefers-color-scheme: dark) {
  .ent-ok .ent-tone-dot { background: #6ce9a6; }
  .ent-info .ent-tone-dot { background: #84caff; }
  .ent-warn .ent-tone-dot { background: #fdb022; }
  .ent-danger .ent-tone-dot { background: #f97066; }
}

.ent-tag {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
}

.ent-tag-ok {
  color: #1a7f4b;
  background: rgba(26, 127, 75, 0.12);
}
.ent-tag-info {
  color: #175cd3;
  background: rgba(23, 92, 211, 0.12);
}
.ent-tag-warn {
  color: #b54708;
  background: rgba(181, 71, 8, 0.14);
}
.ent-tag-danger {
  color: #b42318;
  background: rgba(180, 35, 24, 0.12);
}
.ent-tag-neutral {
  color: var(--muted);
  background: var(--glow);
}

@media (prefers-color-scheme: dark) {
  .ent-tag-ok {
    color: #6ce9a6;
    background: rgba(108, 233, 166, 0.14);
  }
  .ent-tag-info {
    color: #84caff;
    background: rgba(132, 202, 255, 0.16);
  }
  .ent-tag-warn {
    color: #fdb022;
    background: rgba(253, 176, 34, 0.16);
  }
  .ent-tag-danger {
    color: #f97066;
    background: rgba(249, 112, 102, 0.16);
  }
}

.ent-key {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 0.45rem;
}

.ent-val {
  font-family: var(--mono);
  font-size: 0.88rem;
  word-break: break-all;
  white-space: pre-wrap;
  display: grid;
  gap: 0.35rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.error-box {
  padding: 1.5rem 0;
  color: var(--fg);
}

@media (max-width: 640px) {
  .p12-hero h1 {
    max-width: none;
  }

  .kv-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
