:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1c2024;
  --muted: #6b7280;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --danger: #c62828;
  --ok: #17803d;
  --warn: #a15c07;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* Author rules like `.centered { display: flex }` outrank the UA stylesheet's
   [hidden] { display: none }, so the attribute needs to be enforced here or
   view switching silently stops working. */
[hidden] { display: none !important; }

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

h1 { font-size: 1.3rem; margin: 0 0 .4rem; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
h3 { font-size: 1rem; margin: 0; }

.muted { color: var(--muted); }
.centered-text { text-align: center; }

.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.login-card { width: 100%; max-width: 340px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; }

.content {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .3rem;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.field-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.field { flex: 1 1 220px; }
.field + .field { margin-top: 0; }

button {
  font: inherit;
  font-weight: 600;
  padding: .5rem .9rem;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: .55; cursor: default; }

button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
button.danger { background: var(--surface); color: var(--danger); border-color: var(--border); }
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: .15rem .3rem;
  text-decoration: underline;
}
button.small { font-size: .82rem; padding: .3rem .55rem; }

form button[type="submit"] { margin-top: .9rem; }

.error {
  color: var(--danger);
  background: #fdecec;
  border: 1px solid #f5c6c6;
  border-radius: 7px;
  padding: .5rem .65rem;
  margin: .75rem 0 0;
  font-size: .9rem;
}

/* --- Toolbar: search + result count --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.toolbar .search { flex: 1 1 260px; }
.toolbar input[type="search"] {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.toolbar input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#result-count { margin: 0; font-size: .85rem; white-space: nowrap; }

/* --- Pagination --- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: 1rem;
}
.pagination span { font-size: .85rem; }

/* --- Project cards --- */

.project-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  flex-wrap: wrap;
}
.project-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.project-meta { font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }

/* The order id is the project's identity now, so it carries the card. */
.order-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  letter-spacing: .01em;
  word-break: break-all;
}

.notice {
  font-size: .82rem;
  color: var(--warn);
  background: #fff8e6;
  border: 1px solid #f0dfae;
  border-radius: 7px;
  padding: .45rem .6rem;
  margin: .75rem 0 0;
}

/* --- Files --- */

.files { list-style: none; margin: 1rem 0 0; padding: 0; }

.file {
  border-top: 1px solid var(--border);
  padding: .7rem 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.file-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
  flex-wrap: wrap;
}
.file-name { font-weight: 600; word-break: break-all; }
.file-size { font-size: .85rem; color: var(--muted); white-space: nowrap; }

.status {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-radius: 20px;
  padding: .1rem .5rem;
}
.status-ready { color: var(--ok); background: #e6f4ea; }
.status-pending { color: var(--warn); background: #fff4e0; }
.status-expired { color: var(--muted); background: #eceef1; }
.status-error { color: var(--danger); background: #fdecec; }

.url-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.url-row input {
  flex: 1 1 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  background: #f7f8fa;
}

.public-warning { font-size: .78rem; color: var(--warn); }
.expiry-note { font-size: .78rem; color: var(--muted); }

progress {
  width: 100%;
  height: 7px;
  appearance: none;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  background: #e6e8eb;
}
progress::-webkit-progress-bar { background: #e6e8eb; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

/* --- Dropzone --- */

.dropzone {
  margin-top: .9rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
  background: #fafbfc;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: #f0f6ff;
  color: var(--accent);
}
.dropzone input[type="file"] { display: none; }

.edit-form { margin-top: .9rem; }

@media (max-width: 560px) {
  .project-head { flex-direction: column; }
  .project-actions { width: 100%; }
}
