:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef1;
  --text: #24272c;
  --muted: #6b7079;
  --border: #dde0e5;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #b3372d;
  --ok: #1d4ed8;
  --shadow: 0 1px 2px rgba(30, 35, 45, 0.05), 0 4px 16px rgba(30, 35, 45, 0.06);
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.6; cursor: default; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: 0.2px; }
.brand span { color: var(--accent); }
.topbar .who { color: var(--muted); font-size: 14px; display: flex; gap: 12px; align-items: center; }

.container { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.auth-card { max-width: 380px; margin: 64px auto; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 14px; min-height: 1.5em; margin-top: 8px; }

h1.page { font-size: 24px; margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.project-card { display: block; color: var(--text); transition: transform 0.1s; }
.project-card:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--accent); }
.project-card h3 { margin: 0 0 4px; font-size: 16px; }
.project-card p { margin: 0; font-size: 13px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  margin-top: 18px;
  cursor: pointer;
  background: var(--surface);
}
.dropzone.over { border-color: var(--accent); color: var(--accent); }

.files { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.file-row .name { font-weight: 600; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.dae { color: #1d4ed8; }
.badge.html { color: #0e7490; }

.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; margin: 0; }

.progress { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width 0.15s; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; }
  .file-row .actions { width: 100%; }
}
