:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --card: #14171c;
  --card-alt: #101317;
  --border: #262b33;
  --text: #e8eaed;
  --muted: #8b93a1;
  --accent: #c9a227;
  --accent-hover: #e0b62f;
  --accent-soft: rgba(201, 162, 39, 0.12);
  --error: #e5484d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 24px;
}

.view.hidden { display: none; }

#login-view {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#app-view {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #14100a;
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1 { font-size: 19px; margin: 0; }

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

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 13px;
  gap: 2px;
}

#user-name { font-weight: 600; }

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}

.panel-title {
  font-size: 15px;
  margin: 0 0 16px;
  color: var(--text);
}

.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.login-card h1 { margin: 8px 0 0; font-size: 22px; }
.login-card .subtitle { margin-bottom: 8px; }
.login-card input { width: 100%; }

input {
  background: var(--card-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
}

input:focus { outline: 1px solid var(--accent); }

button {
  background: var(--accent);
  color: #14100a;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

button:hover { background: var(--accent-hover); }

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.link-btn {
  background: none;
  color: var(--muted);
  font-weight: 400;
  padding: 4px;
  width: auto;
}

.link-btn:hover { color: var(--text); background: none; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }

.upload-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.dropzone p { margin: 4px 0; }

.hint { color: var(--muted); font-size: 12px; }

.selected-file {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#selected-file-name {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.progress {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: var(--accent);
  animation: progress-slide 1.3s ease-in-out infinite;
}

@keyframes progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.preview-frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-alt);
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-placeholder {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.preview-placeholder p { margin: 4px 0; }

.preview-media {
  width: 100%;
  max-height: 420px;
  display: block;
  object-fit: contain;
}

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

.result-ok {
  color: var(--accent);
  font-weight: 600;
  margin: 0;
  font-size: 14px;
}

.error-msg {
  color: var(--error);
  font-size: 13px;
  margin: 12px 0 0;
  min-height: 1em;
}

.hidden { display: none !important; }
