* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b2440, #05060b);
  background-attachment: fixed;
  min-height: 100vh;
  color: #f5f5ff;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  background: rgba(10, 12, 26, 0.95);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(120, 120, 255, 0.4);
  backdrop-filter: blur(10px);
}

header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.subtitle {
  margin-top: 0.35rem;
  color: #b8b8ff;
  font-size: 0.95rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
  justify-content: space-between;
}

#search {
  flex: 1 1 220px;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 140, 255, 0.7);
  background: rgba(5, 5, 20, 0.9);
  color: #f5f5ff;
  outline: none;
}

#search::placeholder {
  color: #7777aa;
}

#search:focus {
  box-shadow: 0 0 0 2px rgba(180, 120, 255, 0.7);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #ff7aca, #7a7aff);
  color: #080612;
  box-shadow: 0 10px 20px rgba(0,0,0,0.45);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, filter 0.08s ease-out;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 14px 26px rgba(0,0,0,0.55);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(0,0,0,0.6);
}

.table-wrapper {
  margin-top: 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(110, 110, 230, 0.6);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(5, 7, 18, 0.98);
}

thead {
  background: linear-gradient(135deg, rgba(120, 120, 255, 0.3), rgba(255, 120, 240, 0.2));
  backdrop-filter: blur(6px);
}

th, td {
  padding: 0.6rem 0.6rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(40, 40, 90, 0.9);
  vertical-align: top;
}

th {
  text-align: left;
  font-weight: 600;
  color: #dedcff;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(20, 20, 60, 0.65);
}

tbody tr:hover {
  background: rgba(80, 50, 130, 0.7);
}

td:first-child {
  width: 2.5rem;
  text-align: center;
  color: #a6a3ff;
  font-weight: 600;
}

td[contenteditable="true"] {
  cursor: text;
}

td[contenteditable="true"]:focus {
  outline: 1px solid rgba(225, 180, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(225, 180, 255, 0.95);
  background: rgba(35, 15, 70, 0.9);
}

footer {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #8d8bd9;
}

.status {
  margin-top: 0.3rem;
  min-height: 1rem;
}

.status.ok {
  color: #7bffb2;
}

.status.error {
  color: #ff8b9a;
}

/* header + account buttons */
.header-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.account {
  display: flex;
  gap: 0.4rem;
}

button.ghost {
  background: transparent;
  color: #b8b8ff;
  border: 1px solid rgba(140, 140, 255, 0.5);
  box-shadow: none;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
}

button.ghost:hover {
  color: #f5f5ff;
  border-color: rgba(225, 180, 255, 0.95);
  box-shadow: 0 0 12px rgba(180, 120, 255, 0.35);
}

/* login screen + password dialog */
.app.login {
  max-width: 420px;
  margin-top: 12vh;
}

.app.login header h1 {
  font-size: 1.6rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.25rem;
}

.login-form h2 {
  margin: 0;
  font-size: 1.15rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #b8b8ff;
}

.login-form input {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(140, 140, 255, 0.7);
  background: rgba(5, 5, 20, 0.9);
  color: #f5f5ff;
  font: inherit;
  outline: none;
}

.login-form input:focus {
  box-shadow: 0 0 0 2px rgba(180, 120, 255, 0.7);
}

.login-form > button {
  margin-top: 0.25rem;
  padding: 0.6rem 0.9rem;
}

.login-form .status {
  margin: 0;
}

.login-form .hint {
  margin: 0;
  font-size: 0.75rem;
  color: #8d8bd9;
}

dialog {
  width: min(400px, 92vw);
  padding: 1.5rem;
  border-radius: 18px;
  border: 1px solid rgba(120, 120, 255, 0.4);
  background: rgba(10, 12, 26, 0.98);
  color: #f5f5ff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

dialog::backdrop {
  background: rgba(3, 3, 12, 0.7);
  backdrop-filter: blur(3px);
}

dialog .login-form {
  margin-top: 0;
}

/* small screens */
@media (max-width: 700px) {
  .app {
    margin: 1rem;
    padding: 1rem;
  }

  th, td {
    font-size: 0.8rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .app.login {
    margin-top: 6vh;
  }
}
