/*
 *= require_tree .
 *= require_self
 */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #111827;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  opacity: 0.9;
}

.admin-body {
  min-height: 100vh;
}

.admin-shell {
  min-height: 100vh;
  display: flex;
}

.admin-sidebar {
  width: 240px;
  background: #0f172a;
  color: #e5e7eb;
  padding: 24px 18px;
  flex-shrink: 0;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.admin-logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.admin-logo-title {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.admin-logo-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-nav-link {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: #cbd5e1;
  background: transparent;
  transition: all 0.15s ease;
}

.admin-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #ffffff;
}

.admin-nav-link.active {
  background: #1d4ed8;
  color: #ffffff;
  font-weight: 600;
}

.admin-nav-link-secondary {
  background: rgba(255,255,255,0.04);
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 28px;
}

.admin-topbar {
  margin-bottom: 20px;
}

.admin-page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  color: #0f172a;
}

.admin-page-subtitle {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
}

.admin-content {
  background: transparent;
}

.flash {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 14px;
}

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

.flash-alert {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.card h2,
.card h3 {
  margin-top: 0;
}

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

.data-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.data-card-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 10px;
}

.data-card-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.btn,
button,
input[type="submit"] {
  appearance: none;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-danger {
  background: #dc2626;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

thead {
  background: #f8fafc;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: #475569;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

form {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5e7eb;
}

form p {
  margin-bottom: 16px;
}

label {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

input[type="text"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 14px;
  outline: none;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

pre {
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  border-radius: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 18px;
}

.detail-label {
  color: #64748b;
  font-weight: 600;
}

.detail-value {
  color: #111827;
}

.section-title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
}

.muted {
  color: #64748b;
}

.inline-form {
  display: inline-block;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

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

@media (max-width: 768px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
  }

  .admin-main {
    padding: 18px;
  }

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

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

  table {
    display: block;
    overflow-x: auto;
  }
}

.copy-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  background: #ffffff;
  margin-bottom: 18px;
}

.copy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.copy-card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

.copy-content {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin: 0;
  line-height: 1.7;
}

.version-toggle {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.toggle-link {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

.toggle-link:hover {
  opacity: 0.95;
}

.toggle-link.active {
  background: #2563eb;
  color: #ffffff;
}

.version-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}

.admin-user-box {
  text-align: right;
}

.admin-user-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.admin-user-email {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.sidebar-logout-form {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.admin-nav-link-danger {
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  background: rgba(220, 38, 38, 0.12);
  color: #fecaca;
}

.admin-nav-link-danger:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #ffffff;
}

.guest-main {
  min-height: 100vh;
  padding: 32px 16px;
  background: #f5f7fb;
}

.guest-flash {
  max-width: 460px;
  margin: 0 auto 18px;
}

.auth-shell {
  min-height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  border: 1px solid #e5e7eb;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 14px;
  outline: none;
}

input[type="email"]:focus,
input[type="password"]:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
