* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.is-admin {
  background: #0b0b0b;
  font-family: 'Inter', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 2rem 1.2rem;
  color: #f5f5f5;
}

body.is-admin #app {
  width: min(600px, 100%);
  min-width: 0;
}

.admin-container {
  width: min(600px, 100%);
  max-width: 600px;
  min-width: 0;
  background: #0f0f0f;
  padding: 1.4rem;
  border-radius: 2px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7);
}

.admin-page {
  width: 100%;
  min-width: 0;
}

.admin-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.admin-shell h1 {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid #262626;
}

.admin-avatar-empty {
  background: #111111;
}

.admin-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  color: #5a5a5a;
  text-decoration: none;
  font-size: 1.15rem;
  border: 1px solid #262626;
  border-radius: 2px;
  transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
  color: #f5f5f5;
  border-color: #3d3d3d;
  background: #1a1a1a;
}

.admin-shell h2 {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  color: #aaaaaa;
}

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.7rem 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  border-radius: 2px;
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.75;
}

.notice-close:hover {
  opacity: 1;
}

.notice.error {
  background: #2a1111;
  border: 1px solid #ff4444;
  color: #ff6666;
}

.notice.success {
  background: #112a11;
  border: 1px solid #44ff44;
  color: #66ff66;
}

.notice.success a {
  color: #66ff66;
  word-break: break-all;
}

.link-list {
  margin-bottom: 1.5rem;
}

.admin-shell .link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111111;
  border: 1px solid #262626;
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 2px;
  font-size: 0.9rem;
  gap: 0.5rem;
  cursor: move;
  user-select: none;
}

.admin-shell .link-item.is-static {
  cursor: default;
}

.admin-shell .link-item.dragging {
  opacity: 0.5;
  border-color: #555;
}

.link-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 1;
  min-width: 0;
  pointer-events: none;
}

.link-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.drag-handle {
  color: #555;
  cursor: grab;
  padding: 0.3rem;
  font-size: 0.9rem;
}

.drag-handle:active {
  cursor: grabbing;
}

.delete-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid #3d3d3d;
  color: #ff4444;
  padding: 0;
  cursor: pointer;
  font-size: 0.75rem;
  border-radius: 2px;
  transition: all 0.2s;
  text-decoration: none;
}

.delete-btn:hover {
  background: #ff4444;
  color: white;
  border-color: #ff4444;
}

.edit-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.72rem;
}

.edit-btn,
.ghost-btn {
  background: none;
  border: 1px solid #3d3d3d;
  color: #aaaaaa;
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
  transition: all 0.2s;
}

.ghost-btn {
  padding: 0.7rem 1rem;
  white-space: nowrap;
}

.edit-btn:hover,
.ghost-btn:hover {
  background: #1a1a1a;
  color: #f5f5f5;
  border-color: #555555;
}

.admin-shell .link-item.is-editing {
  border-color: #555555;
}

.edit-note {
  color: #aaaaaa;
  font-size: 0.75rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.full-width-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.form-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}

.form-row > * {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.admin-shell input,
.admin-shell select,
.admin-shell textarea {
  background: #111111;
  border: 1px solid #262626;
  color: #f5f5f5;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  border-radius: 2px;
  font-family: inherit;
  outline: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.field-full {
  width: 100%;
}

.admin-shell textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.admin-shell input:focus,
.admin-shell select:focus,
.admin-shell textarea:focus {
  border-color: #3d3d3d;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.stat-card {
  background: #111111;
  border: 1px solid #262626;
  padding: 0.75rem 0.4rem;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.4px;
}

.stat-card span {
  color: #777777;
  font-size: 0.66rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.chart-card {
  background: #111111;
  border: 1px solid #262626;
  padding: 0.8rem 0.7rem 0.5rem;
  margin-bottom: 0.8rem;
}

.admin-shell .chart-card h2 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 1px;
  color: #888888;
}

.chart-box {
  position: relative;
  height: 220px;
}

.chart-box.is-tall {
  height: 280px;
}

.file-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  min-height: 68px;
  padding: 0.45rem 0.75rem;
  background: #111111;
  border: 1px solid #262626;
  border-radius: 2px;
  cursor: pointer;
}

.file-field:hover,
.file-field:focus-within {
  border-color: #3d3d3d;
}

.admin-shell .file-field-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.file-field-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  background: #0b0b0b;
  border: 1px solid #262626;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5a5a;
  font-size: 0.95rem;
}

.file-field.is-round .file-field-thumb {
  border-radius: 50%;
}

.file-field-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-field-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.file-field-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  color: #f5f5f5;
}

.file-field-hint {
  font-size: 0.68rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #5a5a5a;
}

.add-btn, .login-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #f5f5f5;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 2px;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
  width: 100%;
}

.add-btn:hover, .login-btn:hover {
  background: #2a2a2a;
  border-color: #555;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  color: #5a5a5a;
  text-decoration: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #aaaaaa;
}

.forgot-link {
  color: #5a5a5a;
  text-decoration: none;
  font-size: 0.8rem;
  text-align: center;
  display: block;
  margin-top: 0.5rem;
  cursor: pointer;
}

.forgot-link:hover {
  color: #aaaaaa;
}

.logout-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #262626;
  background: #111111;
  color: #f5f5f5;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  justify-self: end;
}

.logout-btn:hover {
  background: #1a1a1a;
  border-color: #3d3d3d;
}

.icon-trigger {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: #111111;
  border: 1px solid #262626;
  color: #f5f5f5;
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.icon-trigger i {
  font-size: 1.15rem;
}

.icon-trigger.is-compact {
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 0;
}

.icon-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.icon-modal-panel {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: hidden;
  background: #0f0f0f;
  border: 1px solid #262626;
  padding: 2rem 0.85rem 0.85rem;
  position: relative;
}

.icon-modal-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
}

.icon-choice {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.25rem;
  background: #111111;
  border: 1px solid #262626;
  color: #f5f5f5;
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
}

.icon-choice i {
  font-size: 1.25rem;
}

.icon-choice span {
  font-size: 0.62rem;
  letter-spacing: 0.3px;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
}

.icon-choice.selected,
.icon-choice:hover {
  border-color: #555555;
  background: #1a1a1a;
}

.platform-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.platform-row input {
  flex: 1 1 0;
  min-width: 0;
}

.remove-platform {
  background: none;
  border: 1px solid #3d3d3d;
  color: #ff4444;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 2px;
  transition: all 0.2s;
}

.remove-platform:hover {
  background: #ff4444;
  color: white;
}

.add-platform-btn {
  background: none;
  border: 1px solid #3d3d3d;
  color: #aaaaaa;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 2px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.add-platform-btn:hover {
  background: #2a2a2a;
  color: white;
}

.is-hidden {
  display: none;
}

.forgot-form {
  margin-top: 1rem;
}
