:root {
  --bg: #0f1720;
  --panel: #18232f;
  --panel-2: #213041;
  --text: #e6edf3;
  --muted: #8ea0b2;
  --accent: #2f9be0;
  --accent-2: #1f7fbf;
  --danger: #e05a4f;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-2);
}
#header:empty { display: none; }

.brand { font-weight: 700; font-size: 18px; }
.brand span { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.header-right { min-width: 0; }
.header-right .user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-right button { flex-shrink: 0; padding: 8px 12px; }

#content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

button, .btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
button:hover { background: var(--accent-2); }
button.secondary { background: var(--panel-2); color: var(--text); }
button.secondary:hover { background: #2b3e53; }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select {
  font: inherit;
  width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--panel-2);
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }

/* Login */
.login-wrap {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid var(--panel-2);
}
.login-box h1 { margin: 0 0 4px; font-size: 24px; text-align: center; }
.login-box h1 span { color: var(--accent); }
.login-box p.sub { margin: 0 0 10px; color: var(--muted); text-align: center; font-size: 14px; }
.login-box button { width: 100%; margin-top: 20px; }
.form-error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 18px; }

/* Ecran principal: 3 butoane */
.page-title { margin: 0 0 6px; font-size: 22px; }
.page-sub { margin: 0 0 22px; color: var(--muted); }

.modality-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.modality-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 170px;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 20px;
}
.modality-btn:hover { background: var(--panel-2); border-color: var(--accent); }
.modality-btn .icon { font-size: 42px; line-height: 1; }
.modality-btn .desc { font-size: 13px; font-weight: 400; color: var(--muted); }

@media (max-width: 640px) {
  .modality-grid { grid-template-columns: 1fr; }
  .modality-btn { min-height: 110px; }
}

/* Ecran modalitate */
.back-link { margin-bottom: 18px; }
.card {
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 18px; }

.upload-zone {
  margin-top: 16px;
  border: 2px dashed var(--panel-2);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
}
.upload-zone.drag { border-color: var(--accent); background: rgba(47,155,224,.08); }
.upload-zone input[type=file] { display: none; }
.upload-zone p { margin: 10px 0 0; font-size: 13px; }

.file-list { list-style: none; padding: 0; margin: 16px 0 0; }
.file-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--panel-2);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.file-item canvas {
  width: 100%;
  height: auto;
  background: #000;
  border-radius: 8px;
}
.file-item .no-preview {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; background: #000; border-radius: 8px;
  color: var(--muted); font-size: 13px; text-align: center; padding: 10px;
}
.file-name { font-weight: 600; word-break: break-all; margin-bottom: 8px; }
.meta { width: 100%; border-collapse: collapse; font-size: 13px; }
.meta td { padding: 3px 0; vertical-align: top; }
.meta td:first-child { color: var(--muted); width: 140px; padding-right: 10px; }
.file-error { color: var(--danger); font-size: 14px; }

@media (max-width: 640px) {
  .file-item { grid-template-columns: 1fr; }
}

.disclaimer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.placeholder { color: var(--muted); }

/* Imagine mărită pe tot ecranul */
.file-item canvas.zoomable { cursor: zoom-in; }
.file-item canvas.zoomable:hover { outline: 2px solid var(--accent); }

body.no-scroll { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 14px;
}
.viewer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar button { flex-shrink: 0; }
.viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px 16px;
  cursor: zoom-out;
}
.viewer-body canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Butoane sub fișier + rezultatul interpretării */
.file-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.interpretation {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  font-size: 14px;
  white-space: pre-wrap;
}

/* Conturi: login, parolă, utilizatori */
.brand-btn {
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}
.brand-btn:hover { background: none; }
.login-hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.login-box button.secondary { margin-top: 10px; }
.notice {
  background: rgba(47, 155, 224, .12);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
}
button.small { padding: 6px 10px; font-size: 13px; }

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr 180px auto;
  gap: 12px;
  align-items: end;
}
.inline-form label { margin-top: 10px; }
@media (max-width: 760px) {
  .inline-form { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; margin-top: 12px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.users-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-2);
  white-space: nowrap;
}
.users-table td { padding: 10px; border-bottom: 1px solid var(--panel-2); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions button + button { margin-left: 6px; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok { background: rgba(70, 190, 120, .15); color: #6fd39a; }
.badge-wait { background: rgba(230, 170, 50, .15); color: #f0c060; }
.badge-off { background: rgba(224, 90, 79, .15); color: #f08a80; }

.code-card { border-color: var(--accent); }
.code-table td:first-child { width: 140px; }
.activation-code { font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: 1px; }
