*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  min-height: 100vh;
}

/* ── Login ── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-card p  { color: #636e72; margin-bottom: 28px; font-size: .95rem; }

/* ── Form elements ── */
.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: #636e72; }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #dfe6e9;
  border-radius: 8px;
  font-size: .95rem;
  transition: border-color .2s;
  background: #fff;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #6c5ce7;
}

.field textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #6c5ce7; color: #fff; width: 100%; }
.btn-primary:hover { opacity: .9; }
.btn-sm { padding: 7px 14px; font-size: .85rem; width: auto; }
.btn-danger { background: #d63031; color: #fff; }

/* ── Error ── */
.error-msg {
  color: #d63031;
  font-size: .85rem;
  margin-top: 10px;
  min-height: 20px;
}

/* ── Admin layout ── */
.admin-header {
  background: #fff;
  border-bottom: 1px solid #dfe6e9;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-header h1 { font-size: 1.1rem; color: #6c5ce7; font-weight: 700; }

.admin-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  align-items: start;
}

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

/* ── Form card ── */
.form-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  padding: 28px;
}

.form-card h2 { font-size: 1rem; margin-bottom: 20px; color: #636e72; text-transform: uppercase; letter-spacing: .05em; }

/* ── Icon preview ── */
.icon-preview {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px dashed #dfe6e9;
  margin-bottom: 8px;
  display: block;
}
.icon-preview.has-image { border-style: solid; border-color: #6c5ce7; }

/* ── App grid ── */
.apps-section h2 { font-size: 1rem; margin-bottom: 16px; color: #636e72; text-transform: uppercase; letter-spacing: .05em; }

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.app-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .2s;
}
.app-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }

.app-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: #f5f6fa;
}

.app-card-icon.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: #ede9fe;
}

.app-card h3 { font-size: .95rem; font-weight: 700; }
.app-card p  { font-size: .85rem; color: #636e72; line-height: 1.45; flex: 1; }

.app-card a {
  font-size: .8rem;
  color: #6c5ce7;
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}
.app-card a:hover { text-decoration: underline; }

.app-card-date { font-size: .75rem; color: #b2bec3; }

/* ── Empty state ── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px;
  color: #b2bec3;
}
.empty-state span { font-size: 2.5rem; display: block; margin-bottom: 8px; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #2d3436;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: .9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s ease;
  z-index: 100;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #00b894; }
.toast.error   { background: #d63031; }
