:root {
  color-scheme: dark;
  font-family: Inter, "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0c0e;
  color: #f7f7f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: #0b0c0e;
  color: #f7f7f5;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid #292b30;
  background: rgba(11, 12, 14, 0.92);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; }

.account-actions { display: flex; align-items: center; gap: 10px; }
.account-actions form { margin: 0; }
.account-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #363940;
  border-radius: 5px;
  color: #bfc2c8;
  font-size: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 30px;
  border-radius: 5px;
  background: #e9ff5b;
  color: #0b0c0e;
  font-size: 12px;
  font-weight: 800;
}

.page-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 72px; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.page-heading h1, .login-heading h1 { margin: 8px 0 10px; font-size: clamp(36px, 5vw, 68px); line-height: 0.98; letter-spacing: 0; }
.page-heading p, .login-heading p, .action-band p { margin: 0; color: #a5a8ae; line-height: 1.6; }
.eyebrow { color: #e9ff5b; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }

.stats { display: flex; gap: 12px; }
.stats div { min-width: 126px; padding: 16px 18px; border: 1px solid #303238; border-radius: 6px; background: #14161a; }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 26px; }
.stats span { margin-top: 4px; color: #90939a; font-size: 12px; }

.action-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
  padding: 22px 24px;
  border: 1px solid #303238;
  border-left: 3px solid #e9ff5b;
  background: #14161a;
}
.action-band h2 { margin: 0 0 6px; font-size: 18px; }

.readonly-band {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  padding: 16px 18px;
  border: 1px solid #303238;
  border-left: 3px solid #6bd7ff;
  background: #14161a;
}
.readonly-band strong { color: #fff; }
.readonly-band span { color: #a5a8ae; }

.inline-form, .upload-form { display: flex; align-items: center; gap: 10px; }
input[type="text"], input:not([type]) , input[type="password"] {
  width: min(320px, 100%);
  height: 44px;
  padding: 0 14px;
  border: 1px solid #3a3d43;
  border-radius: 5px;
  outline: none;
  background: #0d0f12;
  color: #fff;
}
input:focus { border-color: #e9ff5b; box-shadow: 0 0 0 2px rgba(233, 255, 91, 0.12); }

.primary-button, .icon-button, .file-picker span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 650;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.primary-button { background: #e9ff5b; color: #0b0c0e; }
.primary-button:hover { background: #fff; }
.icon-button { height: 36px; border: 1px solid #363940; background: transparent; color: #d7d8da; }
.icon-button:hover { border-color: #fff; color: #fff; }

.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.role-card { min-width: 0; overflow: hidden; border: 1px solid #292c31; border-radius: 6px; background: #131519; transition: border-color 160ms ease, transform 160ms ease; }
.role-card:hover { transform: translateY(-2px); border-color: #6a6e76; }
.role-cover { aspect-ratio: 4 / 3; overflow: hidden; background: #1c1e23; }
.role-cover img, .image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empty-cover { display: grid; place-items: center; align-content: center; height: 100%; gap: 8px; color: #e9ff5b; }
.empty-cover span { font-size: 52px; font-weight: 700; }
.empty-cover small { color: #848890; }
.role-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; padding: 15px 16px; }
.role-meta h2 { margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.role-meta p { margin: 0; color: #8e9299; font-size: 12px; }
.role-meta > div { min-width: 0; }
.open-mark { color: #e9ff5b; font-size: 22px; }

.back-link { display: inline-block; margin-bottom: 30px; color: #b7bac0; }
.back-link:hover { color: #fff; }
.role-heading { margin-bottom: 28px; }
.upload-band { border-left-color: #6bd7ff; }
.file-picker { position: relative; cursor: pointer; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker span { border: 1px solid #454950; background: #202328; color: #fff; }
.file-picker:hover span { border-color: #fff; }

.image-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.image-item { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #292c31; border-radius: 6px; background: #131519; }
.image-item img { aspect-ratio: 4 / 3; }
.image-item figcaption { padding: 10px 12px; overflow: hidden; color: #9ca0a7; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.empty-state { padding: 72px 24px; border: 1px dashed #373a40; text-align: center; color: #a6a9af; }
.empty-state h2 { margin: 0 0 8px; color: #fff; }
.empty-state p { margin: 0; }

.login-panel { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 72px; min-height: calc(100vh - 230px); max-width: 980px; margin: 0 auto; }
.stack-form { display: grid; gap: 18px; padding: 28px; border: 1px solid #303238; border-radius: 6px; background: #14161a; }
.stack-form label { display: grid; gap: 8px; color: #c9cbd0; font-size: 13px; }
.stack-form input { width: 100%; }
.stack-form .primary-button { width: 100%; margin-top: 4px; }

.flash-stack { display: grid; gap: 8px; margin-bottom: 20px; }
.flash { padding: 13px 15px; border: 1px solid; border-radius: 5px; }
.flash-success { border-color: #4d6b37; background: #172114; color: #d8f6c3; }
.flash-error { border-color: #723d46; background: #261519; color: #ffcbd3; }

footer { padding: 24px; border-top: 1px solid #24262a; color: #6f737a; text-align: center; font-size: 12px; }

@media (max-width: 980px) {
  .gallery-grid, .image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-panel { grid-template-columns: 1fr; gap: 28px; min-height: auto; max-width: 620px; }
}

@media (max-width: 720px) {
  .topbar { padding: 0 18px; }
  .page-shell { width: min(100% - 28px, 1440px); padding-top: 34px; }
  .page-heading, .action-band { align-items: stretch; flex-direction: column; }
  .stats { width: 100%; }
  .stats div { flex: 1; min-width: 0; }
  .inline-form, .upload-form { align-items: stretch; flex-direction: column; }
  .inline-form input, .inline-form button, .upload-form button, .file-picker span { width: 100%; }
  .gallery-grid, .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .page-heading h1, .login-heading h1 { font-size: 42px; }
}

@media (max-width: 430px) {
  .gallery-grid, .image-grid { grid-template-columns: 1fr; }
  .brand > span:last-child { display: none; }
  .account-badge { display: none; }
}
