:root {
  --purple: #7b2d8b;
  --purple-light: #f3e5f5;
  --green: #1e9e57;
  --bg: #f5f5f8;
  --text: #1d1d27;
  --muted: #6b6b78;
  --border: #e4e4ea;
  --danger: #c62828;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

h1, h2, h3 { margin: 0; }
p { margin: 0; }

/* ── buttons ── */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  min-height: 48px;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost {
  background: rgba(255, 255, 255, .16);
  color: #fff;
  padding: 8px 14px;
  min-height: 40px;
  font-size: 14px;
}
.btn-link {
  background: none; border: 0; color: var(--purple); font: inherit; font-weight: 600;
  cursor: pointer; padding: 6px 8px;
}
.btn-icon {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 16px;
  cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
.btn-icon:hover { background: #f0f0f4; }

/* ── login ── */
.login {
  max-width: 420px;
  margin: 0 auto;
  padding: 40px 28px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.login .logo { display: block; margin: 0 auto 14px; height: auto; }
.login h1 { font-size: 22px; color: var(--purple); }
.subtitle { color: var(--muted); font-size: 13px; margin-bottom: 34px; }

#login-form { text-align: left; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 0 0 8px;
}
#phone {
  width: 100%;
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming the page on focus */
  padding: 14px 14px;
  border: 1.5px solid #d4d4dc;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 26px;
}
#phone:focus, .pin input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 1px var(--purple); }

.pin { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pin input {
  width: 100%;
  max-width: 72px;
  height: 64px;
  text-align: center;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  color: var(--purple);
  border: 1.5px solid #d4d4dc;
  border-radius: 12px;
  background: #fff;
  padding: 0;
}
.pin input.filled { background: var(--purple-light); border-color: var(--purple); }

.error { color: var(--danger); font-size: 14px; margin: 12px 0; }
#login-btn { margin-top: 22px; }

.links { text-align: center; margin: 24px 0 6px; }
.links a { color: var(--purple); font-size: 14px; text-decoration: none; padding: 8px 10px; display: inline-block; }
.version { text-align: center; font-size: 11px; color: #9a9aa6; }

/* ── top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--green);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title img { background: #fff; border-radius: 8px; padding: 2px; flex: none; }
.topbar-title strong { display: block; font-size: 17px; }
.topbar-sub { display: block; font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 4px; }
.muted { color: #5d5d6a; font-size: 13px; }
.small { font-size: 12px; }
#drop-zone .btn { margin-top: 14px; }
.drop-hint { text-align: center; margin-top: 10px; }
#drop-zone.dragging { border-color: var(--green); background: #effaf3; border-style: dashed; }
@media (hover: none) { .drop-hint { display: none; } }

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff7e6;
  border: 1px solid #ffe0a3;
  border-radius: 10px;
  font-size: 13px;
}

section h3 { font-size: 15px; margin: 22px 0 10px; }

/* ── this session ── */
.items, .recent { list-style: none; margin: 0; padding: 0; }
.item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px 10px 12px;
  margin-bottom: 8px;
}
.item-top { display: flex; align-items: center; gap: 10px; }
.item-icon { font-size: 18px; flex: none; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-size { font-size: 11px; color: var(--muted); }
.item-status { display: flex; align-items: center; flex: none; }
.status-text { font-size: 12px; color: var(--muted); }
.status-text.strong { font-weight: 700; color: var(--text); padding-right: 8px; }
.status-done { color: var(--green); font-size: 20px; font-weight: 700; padding: 0 10px; }
.bar { height: 4px; background: #e9e9ef; border-radius: 4px; margin: 8px 6px 0 0; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--green); transition: width .15s linear; }
.item-error { font-size: 12px; color: var(--danger); margin: 4px 6px 0 0; }

/* ── recent ── */
.recent { padding: 0; overflow: hidden; }
.recent-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; }
.recent-row + .recent-row { border-top: 1px solid #f0f0f4; }
