:root {
  --bg: #0d0d0f;
  --surface: #13131a;
  --panel: #1a1a22;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0f0f5;
  --text-muted: #8b8b9a;
  --accent: #78c882;
  --accent-dim: rgba(120, 200, 130, 0.14);
  --danger: #e66e6e;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

/* Topbar */
.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-status {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-muted);
  font-size: 12px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-status.error {
  color: var(--danger);
  background: rgba(230, 110, 110, 0.12);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: #23232d;
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-accent {
  background: var(--accent);
  color: #07090a;
  border-color: var(--accent);
  font-weight: 700;
}

.btn-accent:hover {
  background: #8ad894;
  border-color: #8ad894;
}

.btn-danger {
  background: rgba(230, 110, 110, 0.12);
  color: var(--danger);
  border-color: rgba(230, 110, 110, 0.35);
}

.btn-danger:hover {
  background: rgba(230, 110, 110, 0.2);
}

.btn-block {
  width: 100%;
}

/* App layout */
.app {
  display: flex;
  height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.sidebar-header {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.search::placeholder {
  color: #5b5b68;
}

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.tag-item {
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.tag-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tag-item.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

.tag-id {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Preview */
.preview-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: radial-gradient(circle at 50% 20%, #181821 0%, var(--bg) 70%);
  overflow: auto;
  gap: 28px;
}

.nametag {
  width: 420px;
  min-height: 130px;
  border-radius: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 3px solid var(--accent);
  background-color: var(--panel);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
}

.pfp {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
}

.pfp[hidden] {
  display: none;
}

.nametag-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
}

.display-name {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.username {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.brand-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.brand-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--panel);
}

.brand-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

/* Properties panel */
.properties {
  width: 340px;
  flex: none;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.panel-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label,
.form-col label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  font-weight: 600;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.input,
.input-color,
.input-file,
select.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus,
select.input:focus {
  border-color: var(--accent);
}

.input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.input::placeholder {
  color: #5b5b68;
}

.input-color {
  height: 40px;
  padding: 3px;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
}

.input-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.input-color::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.input-file {
  padding: 7px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-file::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 10px;
  margin-right: 10px;
  cursor: pointer;
}

.actions-col {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 960px) {
  .sidebar {
    width: 180px;
  }

  .properties {
    width: 280px;
  }

  .nametag {
    width: 340px;
    min-height: 120px;
  }

  .pfp {
    width: 78px;
    height: 78px;
  }

  .display-name {
    font-size: 22px;
  }
}
