* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

header { margin-bottom: 2rem; }
h1 { margin: 0 0 0.5rem; font-size: 2rem; }
h2 { margin-top: 2rem; font-size: 1.3rem; }
h3 { margin: 1.5rem 0 0.5rem; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6e6e73; }

.card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card.no-pad { padding: 0; overflow: hidden; }
.card.center { text-align: center; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.grid .card { margin-bottom: 0; }

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

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
}

form input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  margin-top: 0.35rem;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
}
form input:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

button, .btn {
  display: inline-block;
  background: #0071e3;
  color: white;
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: #0077ed; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-danger { background: #ff3b30; margin-top: 1rem; }
.btn-danger:hover { background: #ff453a; }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f5f5f7;
  font-size: 0.95rem;
}
th {
  background: #fafafa;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6e6e73;
  font-weight: 600;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }

.muted { color: #6e6e73; }
.truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.break { word-break: break-all; }

.qr-img {
  max-width: 100%;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.back {
  display: inline-block;
  margin-bottom: 1rem;
  color: #0071e3;
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { text-decoration: underline; }

code {
  background: #f5f5f7;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}

.stat {
  display: inline-block;
  margin-right: 2rem;
  margin-bottom: 1rem;
}
.stat-num { font-size: 2.2rem; font-weight: 600; line-height: 1; }
.stat-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6e6e73; margin-top: 0.25rem; }

.devices {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.devices li {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f7;
  text-transform: capitalize;
}
.devices li:last-child { border-bottom: none; }

a { color: #0071e3; }

.container.narrow { max-width: 420px; }

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
}
.header-row h1 { margin-bottom: 0.5rem; }
.header-row p { margin: 0; }

.btn-link {
  background: transparent;
  color: #6e6e73;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
.btn-link:hover { background: #f5f5f7; color: #1d1d1f; }

.error {
  color: #ff3b30;
  background: #fff5f5;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.login-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 1rem;
}
.login-box {
  background: white;
  padding: 2.5rem 2rem;
  border-radius: 16px;
  text-align: center;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-logo {
  max-width: 240px;
  width: 100%;
  height: auto;
  margin-bottom: 2rem;
}
.login-form input[type="password"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font-size: 1.3rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.3em;
  background: white;
}
.login-form input[type="password"]:focus {
  outline: none;
  border-color: #1d1d1f;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.login-form .error {
  margin-top: 1rem;
  margin-bottom: 0;
  text-align: center;
}
