:root {
  color-scheme: light;
  --admin-page-start: #061017;
  --admin-page-mid: #0b3144;
  --admin-page-end: #f6fbfd;
  --admin-panel-bg: rgba(255, 255, 255, .97);
  --admin-panel-soft: rgba(255, 255, 255, .94);
  --admin-text: #071017;
  --admin-muted: #536372;
  --admin-line: #d8edf3;
  --admin-soft: #f6fbfd;
  --admin-shadow: 0 22px 70px rgba(5, 28, 44, .14);
  --admin-strong-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

[data-theme="dark"] {
  color-scheme: dark;
  --admin-page-start: #02070b;
  --admin-page-mid: #061925;
  --admin-page-end: #0a1118;
  --admin-panel-bg: rgba(13, 28, 37, .96);
  --admin-panel-soft: rgba(9, 24, 33, .94);
  --admin-text: #f6fbff;
  --admin-muted: #a9bdc8;
  --admin-line: rgba(255, 255, 255, .12);
  --admin-soft: rgba(255, 255, 255, .06);
  --admin-shadow: 0 22px 70px rgba(0, 0, 0, .36);
  --admin-strong-shadow: 0 30px 90px rgba(0, 0, 0, .44);
}

.admin-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgba(37, 199, 233, .18), transparent 25%),
    linear-gradient(145deg, var(--admin-page-start), var(--admin-page-mid) 48%, var(--admin-page-end) 48.2%);
}

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

.login-panel[hidden],
.admin-panel[hidden],
.admin-toast[hidden] {
  display: none !important;
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 430px);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: var(--admin-panel-bg);
  box-shadow: var(--admin-strong-shadow);
}

.admin-theme-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-theme-line img {
  width: 210px;
}

.login-card h1 {
  margin-bottom: 24px;
  color: var(--admin-text);
  font-size: 34px;
}

.login-card form,
.project-form {
  display: grid;
  gap: 18px;
}

.login-card label {
  display: grid;
  gap: 9px;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 850;
}

.admin-panel {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 22px 70px;
}

.admin-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  background: var(--admin-panel-soft);
  box-shadow: var(--admin-strong-shadow);
}

.admin-brand img {
  width: 176px;
}

.admin-topbar h1,
.project-form h2,
.project-manager h2 {
  color: var(--admin-text);
}

.admin-topbar h1 {
  font-size: clamp(30px, 4vw, 48px);
}

.admin-actions,
.manager-tools,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-actions .btn-outline {
  color: var(--primary);
  border-color: var(--admin-line);
  background: var(--admin-panel-bg);
}

.security-note {
  margin-bottom: 22px;
  padding: 16px 18px;
  border: 1px solid var(--admin-line);
  border-left: 5px solid #2d94b6;
  border-radius: 8px;
  background: var(--admin-soft);
  color: var(--admin-muted);
  line-height: 1.7;
  font-weight: 700;
}

.security-note strong {
  color: var(--admin-text);
}

.admin-toast {
  margin-bottom: 22px;
  padding: 15px 18px;
  border: 1px solid color-mix(in srgb, var(--success) 46%, var(--admin-line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--success) 12%, var(--admin-panel-bg));
  color: var(--admin-text);
  font-weight: 900;
  box-shadow: var(--admin-shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .24s ease, transform .24s ease;
}

.admin-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 22px;
  align-items: start;
}

.project-form,
.project-manager {
  padding: 24px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background: var(--admin-panel-bg);
  box-shadow: var(--admin-shadow);
}

.form-head,
.manager-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.project-form label {
  display: grid;
  gap: 9px;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 850;
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.ghost-button,
.danger-button,
.row-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--admin-line);
  border-radius: 7px;
  background: var(--admin-panel-bg);
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover,
.row-actions button:hover {
  border-color: #2d94b6;
  background: var(--admin-soft);
}

.danger-button {
  border-color: #ffd4d4;
  color: #a01818;
}

.danger-button:hover {
  background: #fff5f5;
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.import-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.project-list {
  display: grid;
  gap: 14px;
}

.admin-project {
  display: grid;
  grid-template-columns: 142px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  background: var(--admin-panel-bg);
}

.admin-thumb {
  min-height: 104px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.admin-thumb span,
.portfolio-img small {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  padding: 6px 9px;
  border-radius: 4px;
  background: #07101f;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.admin-project h3 {
  margin-bottom: 8px;
  color: var(--admin-text);
  font-size: 19px;
}

.admin-project p {
  margin-bottom: 8px;
  line-height: 1.6;
}

.admin-project small {
  color: var(--primary);
  font-weight: 900;
  text-transform: uppercase;
}

.admin-note {
  min-height: 20px;
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.locked-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 24px;
  color: #fff;
  text-align: center;
  background: #061017;
}

@media (max-width: 980px) {
  .admin-topbar,
  .admin-layout,
  .admin-project {
    grid-template-columns: 1fr;
  }

  .admin-actions,
  .manager-tools,
  .row-actions {
    width: 100%;
  }

  .admin-actions .btn,
  .manager-tools > *,
  .row-actions button {
    flex: 1 1 140px;
  }
}

@media (max-width: 620px) {
  .login-card,
  .project-form,
  .project-manager,
  .admin-topbar {
    padding: 20px;
  }

  .form-head,
  .manager-head {
    flex-direction: column;
  }
}
