:root {
  --fg: #111;
  --muted: #666;
  --bg: #fafafa;
  --border: #ddd;
  --accent: #1463b3;
  --error: #b32d2d;
  --row-alt: #f3f5f8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.4;
}

header { padding: 24px 32px 12px; background: white; border-bottom: 1px solid var(--border); }
header h1 { margin: 0 0 4px; font-size: 20px; }
header .hint { margin: 0; color: var(--muted); }
header code { background: #eee; padding: 1px 5px; border-radius: 3px; }

section { padding: 16px 32px; }

#auth { display: flex; align-items: center; gap: 8px; background: white; border-bottom: 1px solid var(--border); }
#auth label { margin-right: 6px; }
#auth input { flex: 0 0 360px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 3px; }
#auth .status { color: var(--muted); margin-left: 8px; }
#auth .status.ok { color: #2a8a3a; }
#auth .status.err { color: var(--error); }

#search form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#search #query { flex: 1; min-width: 240px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; }
#search button[type="submit"] { padding: 8px 16px; background: var(--accent); color: white; border: none; border-radius: 3px; cursor: pointer; }
#search button[type="submit"]:disabled { opacity: 0.5; cursor: wait; }
#search .check { display: inline-flex; align-items: center; gap: 4px; }
#searchError { color: var(--error); margin-top: 8px; }

main { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; padding: 0 32px 32px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }

main h2 { font-size: 15px; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin: 16px 0 8px; }
main .count { color: var(--muted); font-weight: normal; font-size: 12px; margin-left: 6px; }
main .empty { color: var(--muted); font-style: italic; }

table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
th { background: #f1f3f6; font-weight: 600; }
tbody tr:nth-child(even) { background: var(--row-alt); }
td.price { text-align: right; font-variant-numeric: tabular-nums; }

#punchoutList { list-style: none; padding: 0; margin: 0; }
#punchoutList li { background: white; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#punchoutList .vname { font-weight: 600; }
#punchoutList .vmeta { color: var(--muted); font-size: 12px; }
#punchoutList button { padding: 6px 12px; background: var(--accent); color: white; border: none; border-radius: 3px; cursor: pointer; white-space: nowrap; }
#punchoutList button:disabled { opacity: 0.5; cursor: wait; }
#punchoutList .verr { color: var(--error); font-size: 12px; margin-top: 4px; }

/* Header with user block + sign-out */
header .header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.user-block { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 4px 6px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }

/* Login page */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef2f7 0%, #fafafa 100%);
}
.login-container { width: 100%; max-width: 360px; padding: 24px; }
.login-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  padding: 32px 28px;
}
.login-title { margin: 0 0 4px; font-size: 22px; text-align: center; }
.login-subtitle { margin: 0 0 24px; color: var(--muted); text-align: center; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--fg); }
.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}
.form-group input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.error-message { color: var(--error); font-size: 13px; margin: 8px 0 12px; }
.btn { display: inline-block; cursor: pointer; border-radius: 4px; padding: 9px 14px; font-size: 14px; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: white; width: 100%; }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
