:root {
  --bg: #ffffff;
  --text: #000000;
  --accent: #521a41;
  --accent-hover: #3f1332;
  --panel: #f7f7f8;
  --panel-2: #fcfcfd;
  --border: #e6e6e8;
  --muted: #6b7280;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --bad: #991b1b;
  --bad-bg: #fee2e2;
  --radius: 12px;
  --shadow-sm: 0 2px 12px rgba(18, 18, 23, 0.06);
  --shadow-md: 0 12px 30px rgba(18, 18, 23, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  animation: fade-in 0.35s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--panel-2);
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  background: #fff;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 16px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(82, 26, 65, 0.1);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #202731;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.93rem;
}

.nav-icon {
  width: 20px;
  height: 20px;
  text-align: center;
  color: #5b6172;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-link:hover {
  background: #f7f6f9;
}

.nav-link.active {
  border-color: #e8d6e2;
  color: var(--accent);
  background: rgba(82, 26, 65, 0.08);
  font-weight: 600;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 8px;
  background: var(--accent);
}

.main-pane {
  background: var(--panel-2);
}

.top-bar {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-bar h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.top-bar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.user-chip strong {
  display: block;
  font-size: 0.87rem;
}

.user-chip small {
  color: var(--muted);
  font-size: 0.76rem;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 700;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu[open] form {
  position: absolute;
  right: 0;
  top: 42px;
  z-index: 10;
}

.menu-logout {
  min-width: 120px;
  box-shadow: var(--shadow-sm);
}

.content {
  padding: 24px;
}

.panel,
.stat-card,
.auth-card,
.verify-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.stat-card {
  padding: 18px;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(82, 26, 65, 0.1);
}

.stat-card h3 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 400;
}

.stat-card strong {
  margin-top: 8px;
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
}

.panel {
  padding: 20px;
}

.panel h3,
.panel h4 {
  margin: 0;
  font-weight: 600;
}

.panel h4 {
  margin-top: 18px;
  margin-bottom: 10px;
  font-size: 0.98rem;
}

.panel-subtitle {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.info-row:first-of-type {
  margin-top: 10px;
}

.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.chip {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #374151;
  font-size: 0.86rem;
  transition: all 0.2s ease;
}

.chip.active {
  background: rgba(82, 26, 65, 0.08);
  border-color: #e8d6e2;
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: var(--panel);
  color: #465062;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #fafbfd;
}

.table-action {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.table-action:hover {
  background: rgba(82, 26, 65, 0.08);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.84rem;
  color: #4b5563;
  font-weight: 600;
}

.full-row {
  grid-column: 1 / -1;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid #d1d5db;
  border-radius: 11px;
  padding: 11px 13px;
  min-height: 44px;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 26, 65, 0.12);
}

.btn {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  display: inline-block;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(82, 26, 65, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: #111827;
}

.btn-secondary:hover {
  background: #f9fafb;
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.93rem;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: #fef2f2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
}

.status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.status.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 82% 10%, rgba(82, 26, 65, 0.08), transparent 30%),
    linear-gradient(180deg, #fff, #fafafc);
}

.auth-card {
  width: min(470px, 100%);
  padding: 28px;
}

.auth-card h1 {
  margin: 6px 0 8px;
  font-size: 1.6rem;
  font-weight: 600;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.verify-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 10%, rgba(82, 26, 65, 0.1), transparent 32%),
    linear-gradient(180deg, #ffffff, #fafafe);
}

.verify-main {
  width: min(740px, 100%);
}

.verify-card {
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.verify-card h1 {
  margin: 8px 0 8px;
  font-size: 1.7rem;
  font-weight: 600;
}

.verify-brand-logo {
  max-width: 160px;
  width: 100%;
  height: auto;
  margin-bottom: 5px;
}

.verify-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
}

.verify-note {
  margin: -8px 0 14px;
  color: #4b5563;
  font-size: 0.9rem;
}

.search-form {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-form input {
  min-height: 48px;
}

.verify-badge {
  margin: 14px 0 22px;
  padding: 12px 15px;
  border-radius: 10px;
  font-weight: 700;
}

.verify-badge-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.certificate-verify-badge.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.status-detail-box {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 100px;
  padding: 22px 24px;
  overflow: hidden;
}

.status-detail-box > span {
  margin: 0;
}

.status-detail-box strong {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  line-height: 1.15;
  margin: 0;
  padding: 0;
  min-height: 100px;
}

.status-content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 220px);
  z-index: 2;
}

.status-detail-box .status-text {
  display: inline-block;
  color: inherit;
  font-size: 0.88em;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  margin: 10px 0 0;
}

.status-inline-icon {
  width: 78px;
  height: 78px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
  margin: 0;
}

.status-stamp {
  position: absolute;
  right: -23px;
  top: -20px;
  width: 150px;
  height: 150px;
  object-fit: contain;
  opacity: 0.9;
  pointer-events: none;
}

.status-box-ok {
  border-color: #86efac !important;
  background: var(--ok-bg) !important;
}

.status-box-ok strong {
  color: var(--ok);
}

.status-box-bad {
  border-color: #fca5a5 !important;
  background: var(--bad-bg) !important;
}

.status-box-bad strong {
  color: var(--bad);
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid #86efac;
}

.badge-bad {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid #fca5a5;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-grid div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.full-width-detail {
  grid-column: 1 / -1;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.detail-grid strong {
  display: block;
  font-weight: 600;
}

.subtle {
  color: var(--muted);
}

.site-footer {
  padding: 12px 20px 18px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: #6b7280;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.site-footer-link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-bar-right {
    width: 100%;
    justify-content: space-between;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .top-bar {
    padding: 16px;
  }

  .user-chip {
    display: none;
  }

  .form-grid.two-col,
  .search-form,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    width: 100%;
  }

  .action-row .btn {
    width: 100%;
    text-align: center;
  }

  .status-detail-box {
    min-height: 170px;
  }

  .status-content {
    max-width: calc(100% - 120px);
  }

  .status-inline-icon {
    width: 58px;
    height: 58px;
  }

  .status-stamp {
    width: 150px;
    height: 150px;
    right: -18px;
    top: -10px;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
