:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #20242d;
  --border: #2a2f3a;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --accent: #4f7cff;
  --accent-hover: #6b91ff;
  --danger: #ef4565;
  --ok: #2bd576;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
}
.brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  display: grid; place-items: center;
  font-size: 18px;
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #283041; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: rgba(239,69,101,.12); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 14px;
}
.section-title h2 { margin: 0; font-size: 17px; }
.muted { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

.app-cell { display: flex; align-items: center; gap: 12px; }
.app-icon {
  width: 40px; height: 40px; border-radius: 9px; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
}
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 560px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.modal h3 { margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.empty {
  text-align: center; padding: 48px 24px; color: var(--muted);
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 32px; }
.login-card .brand { justify-content: center; margin-bottom: 24px; font-size: 20px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; }

/* Landing */
.hero { text-align: center; padding: 64px 24px 32px; }
.hero h1 { font-size: 34px; margin: 0 0 12px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 24px; font-size: 16px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin-top: 32px; }
.feature { padding: 20px; }
.feature h3 { margin: 0 0 8px; font-size: 15px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); font-size: 13px; }
