:root {
  --bg: #0d1210;
  --panel: #131a17;
  --border: #24312b;
  --text: #d7e4dd;
  --muted: #6f8a7d;
  --accent: #5ee6a0;
  --accent-dim: #2e6b4c;
  --danger: #e6685e;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  min-height: 100vh;
}

.hidden { display: none !important; }

#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 32px;
  width: 320px;
  border-radius: 4px;
}

.prompt-line {
  color: var(--muted);
  margin-bottom: 16px;
}

.prompt { color: var(--accent); margin-right: 6px; }

#password-input {
  width: 100%;
  background: #0a0f0d;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  border-radius: 3px;
  margin-bottom: 12px;
}

#password-input:focus {
  outline: none;
  border-color: var(--accent-dim);
}

button {
  font-family: var(--mono);
  cursor: pointer;
  border-radius: 3px;
}

#login-btn, #add-btn {
  width: 100%;
  background: var(--accent);
  color: #06120c;
  border: none;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#login-btn:hover, #add-btn:hover { filter: brightness(1.08); }

.error-text {
  color: var(--danger);
  margin-top: 10px;
  min-height: 1em;
  font-size: 12px;
}

#app-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 18, 16, 0.95);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-status {
  color: var(--muted);
  font-size: 12px;
}

main {
  flex: 1;
  min-height: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-panel {
  flex-shrink: 0;
  padding: 14px 20px;
}

.tables-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.tables-grid .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 16px 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
}

.panel h2 {
  flex-shrink: 0;
  margin: 0 0 10px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.panel-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
}

.ghost-btn:hover { border-color: var(--accent-dim); color: var(--text); }

.add-row {
  display: flex;
  gap: 10px;
}

#add-username {
  flex: 1;
  background: #0a0f0d;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  border-radius: 3px;
}

#add-username:focus { outline: none; border-color: var(--accent-dim); }

#add-btn { width: auto; padding: 10px 16px; }

.feedback {
  margin-top: 8px;
  font-size: 12px;
  min-height: 1em;
}

.feedback.ok { color: var(--accent); }
.feedback.err { color: var(--danger); }

.table-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 6px;
}

.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(10, 15, 13, 0.4);
  border-radius: 3px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

.muted { color: var(--muted); }

.uuid-cell {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

.remove-btn:hover { border-color: var(--danger); background: rgba(230, 104, 94, 0.1); }

.allow-btn {
  background: rgba(94, 230, 160, 0.12);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
  white-space: nowrap;
  min-height: 32px;
}

.allow-btn:hover {
  background: var(--accent);
  color: #06120c;
}

.allow-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tag-allowed {
  color: var(--accent);
  font-size: 11px;
  background: rgba(94, 230, 160, 0.12);
  border: 1px solid var(--accent-dim);
  padding: 4px 8px;
  border-radius: 3px;
  white-space: nowrap;
  display: inline-block;
}

.tag-danger {
  color: var(--danger);
  font-size: 11px;
  background: rgba(230, 104, 94, 0.1);
  padding: 3px 6px;
  border-radius: 2px;
  white-space: nowrap;
}

@media (max-width: 960px) {
  #app-screen {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  main {
    max-width: 780px;
    padding: 16px;
    overflow: visible;
  }
  .tables-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .tables-grid .panel {
    height: auto;
  }
  .table-wrap {
    max-height: 400px;
  }
}

@media (max-width: 640px) {
  body { font-size: 13px; }
  main { padding: 12px; gap: 16px; }
  header { padding: 12px 14px; }
  .panel { padding: 14px; }
  .login-box { width: calc(100vw - 32px); padding: 24px; }
  .add-row { flex-direction: column; }
  #add-btn { width: 100%; min-height: 42px; }
  #password-input, #add-username { font-size: 16px; min-height: 42px; }
  #login-btn { min-height: 42px; }
  .ghost-btn { min-height: 32px; padding: 6px 12px; }
}


