:root {
  color-scheme: dark;
  --bg: #050506;
  --panel: rgba(15, 15, 18, 0.72);
  --panel-solid: #121216;
  --ink: #f7f7f8;
  --muted: rgba(247, 247, 248, 0.62);
  --line: rgba(255, 255, 255, 0.12);
  --red: #ff2e42;
  --red-dark: #c91f32;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.16), rgba(5, 5, 6, 0.72)),
    #050506 url("hero-bg.jpg") center / cover fixed no-repeat;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.auth-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 48px);
  background: rgba(10, 10, 12, 0.66);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}

.auth-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.auth-header a,
.ghost-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.06);
}

.auth-main {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 440px);
  align-items: center;
  gap: clamp(24px, 6vw, 80px);
  padding: 44px 0;
}

.auth-main-single {
  width: min(520px, calc(100% - 32px));
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.96;
  font-weight: 300;
  letter-spacing: 0.04em;
}

.auth-copy p {
  width: min(620px, 100%);
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
}

.auth-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
}

.auth-card {
  padding: clamp(22px, 3vw, 32px);
}

.auth-card h2,
.admin-card h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
}

.auth-card .login-title {
  text-align: center;
}

.auth-card p,
.admin-card p {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

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

.field span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.field input {
  width: 100%;
  min-height: 46px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  padding: 0 13px;
  outline: none;
}

.field input:focus {
  border-color: rgba(255, 46, 66, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 46, 66, 0.16);
}

.field-help {
  margin: -6px 0 2px;
  color: rgba(245, 245, 247, 0.58);
  font-size: 12px;
}

.primary-button,
.danger-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--red);
  padding: 0 20px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button:hover,
.danger-button:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.danger-button {
  background: rgba(255, 46, 66, 0.72);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.status-box {
  margin-top: 16px;
  padding: 13px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 14px;
}

.status-box.is-error {
  color: #ffd5da;
  border-color: rgba(255, 46, 66, 0.42);
  background: rgba(255, 46, 66, 0.12);
}

.secret-box {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
}

.secret-box code {
  color: #ffffff;
  word-break: break-all;
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.is-hidden {
  display: none !important;
}

.ok-force-hidden,
[id*="copy-history" i],
[class*="copy-history" i],
[id*="copy_history" i],
[class*="copy_history" i],
[id*="clipboard-history" i],
[class*="clipboard-history" i],
[id*="clipboard_history" i],
[class*="clipboard_history" i],
[aria-label*="Copy history" i],
[title*="Copy history" i],
[aria-label*="Total/Max" i],
[title*="Total/Max" i] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.admin-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 42px;
}

.admin-hero h1 {
  font-size: clamp(17px, 2.8vw, 34px);
  line-height: 1.08;
  font-weight: 420;
  letter-spacing: 0.03em;
}

.admin-hero p {
  width: min(760px, 100%);
  margin-top: 10px;
  font-size: clamp(13px, 1.2vw, 16px);
}

.projects-hero h1 {
  font-size: clamp(17px, 2.8vw, 34px);
  line-height: 1.08;
  font-weight: 420;
  letter-spacing: 0.03em;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.project-option {
  min-height: 132px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.9);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  cursor: pointer;
  font-size: clamp(26px, 4vw, 54px);
  font-weight: 260;
  letter-spacing: 0.08em;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.project-option:hover {
  border-color: rgba(255, 46, 66, 0.36);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.project-option.is-selected {
  border-color: rgba(255, 46, 66, 0.78);
  background: rgba(255, 46, 66, 0.16);
  box-shadow: 0 22px 60px rgba(255, 46, 66, 0.14);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.summary-grid {
  gap: 10px;
  margin-top: 16px;
}

.admin-card {
  min-height: 190px;
  padding: 22px;
}

.summary-card {
  min-height: 104px;
  padding: 14px 16px;
}

.summary-card h2,
.system-card h2 {
  font-size: 16px;
}

.summary-card p {
  margin: 5px 0 0;
  font-size: 12px;
}

.admin-card strong {
  display: block;
  margin-top: 18px;
  font-size: 34px;
  line-height: 1;
}

.summary-card strong {
  margin-top: 12px;
  font-size: 22px;
}

.system-card {
  min-height: 0;
  margin-top: 10px;
  padding: 14px 16px;
}

.credential-card {
  min-height: 0;
  margin-top: 10px;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  margin-top: 10px;
}

.management-grid .credential-card {
  height: 100%;
  margin-top: 0;
}

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

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

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-title-row p {
  margin: 8px 0 0;
}

.access-state {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 12px;
}

.users-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.users-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.users-panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.users-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.users-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.user-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-row > div:first-child {
  min-width: 0;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row strong {
  font-size: 14px;
}

.user-row span {
  color: var(--muted);
  font-size: 12px;
}

.user-row .password-note {
  margin-top: 3px;
  color: rgba(245, 245, 247, 0.48);
  line-height: 1.3;
}

.user-row .project-list {
  margin-top: 5px;
  color: rgba(245, 245, 247, 0.68);
  line-height: 1.35;
}

.user-row-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78) !important;
  background: rgba(255, 46, 66, 0.12);
  border: 1px solid rgba(255, 46, 66, 0.28);
}

.user-delete-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 46, 66, 0.34);
  border-radius: 999px;
  color: #ffd5da;
  background: rgba(255, 46, 66, 0.1);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 180ms ease, transform 180ms ease;
}

.user-delete-button:hover {
  background: rgba(255, 46, 66, 0.18);
  transform: translateY(-1px);
}

.empty-users {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-form {
  margin-top: 18px;
}

.project-permission-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.project-permission-field legend {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 650;
}

.permission-project-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.project-permission-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.project-permission-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.project-permission-option span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.055);
  font-size: 16px;
  font-weight: 520;
  letter-spacing: 0.05em;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.project-permission-option:hover span {
  border-color: rgba(255, 46, 66, 0.38);
  background: rgba(255, 255, 255, 0.08);
}

.project-permission-option input:checked + span {
  border-color: rgba(255, 46, 66, 0.82);
  color: #ffffff;
  background: rgba(255, 46, 66, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.project-permission-option input:focus-visible + span {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

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

.admin-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: rgba(255, 255, 255, 0.78);
}

.admin-table td:last-child {
  text-align: right;
  color: #ffffff;
}

@media (max-width: 820px) {
  .auth-main {
    grid-template-columns: 1fr;
  }

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

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

  .project-option {
    min-height: 104px;
  }

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

  .management-grid .access-password-columns {
    grid-template-columns: 1fr;
  }

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

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

  .section-title-row {
    display: grid;
  }
}
