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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f3;
  color: #1a1a1a;
  min-height: 100vh;
}

.container { max-width: 820px; margin: 0 auto; padding: 2.5rem 1.5rem; }

/* ---- Alerts ---- */
.alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 1.5rem;
}
.alert-error { background: #fcebeb; color: #a32d2d; border: 0.5px solid #f09595; }
.alert-info  { background: #e6f1fb; color: #185fa5; border: 0.5px solid #85b7eb; }

/* ---- Login ---- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.5rem;
}
.login-card {
  background: #fff;
  border: 0.5px solid rgba(0,0,0,0.12);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 20px;
}
.login-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: #e6f1fb; color: #185fa5;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; font-weight: 500; }

/* ---- Form fields ---- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; color: #555; font-weight: 500; }
.field input {
  border: 0.5px solid rgba(0,0,0,0.2);
  border-radius: 8px; padding: 10px 12px;
  font-size: 15px; font-family: inherit;
  background: #fff; color: #1a1a1a; outline: none;
  transition: border-color 0.15s;
}
.field input:focus {
  border-color: #185fa5;
  box-shadow: 0 0 0 3px rgba(24,95,165,0.12);
}

/* ---- Buttons ---- */
.btn-primary {
  width: 100%; padding: 11px;
  background: #185fa5; color: #fff;
  border: none; border-radius: 8px;
  font-size: 15px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #0c447c; }
.btn-primary:active { transform: scale(0.98); }

.btn-small {
  font-size: 12px; font-weight: 500; font-family: inherit;
  padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-small:hover { opacity: 0.85; }
.btn-blue   { background: #185fa5; color: #fff; }
.btn-danger { background: none; color: #a32d2d; border: 0.5px solid #f09595; }

/* ---- Launcher header ---- */
.header { margin-bottom: 2.5rem; }
.header-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 1rem;
}
.header h1 { font-size: 28px; font-weight: 500; margin-bottom: 4px; }
.header p  { font-size: 15px; color: #666; }

.user-info { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.username  { font-size: 13px; color: #555; font-weight: 500; }

.admin-link, .logout-btn {
  font-size: 12px; text-decoration: none;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: 6px; padding: 3px 10px;
  transition: background 0.15s, color 0.15s;
}
.admin-link { color: #185fa5; }
.logout-btn { color: #888; }
.admin-link:hover, .logout-btn:hover { background: #f0f0ee; color: #333; }

/* ---- App grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.app-card {
  background: #fff; border: 0.5px solid rgba(0,0,0,0.12); border-radius: 16px;
  padding: 2rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-decoration: none; color: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.app-card:hover { border-color: rgba(0,0,0,0.25); background: #fafaf8; }
.app-card:active { transform: scale(0.98); }

.icon-wrap {
  width: 68px; height: 68px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
}
.icon-blue  { background: #e6f1fb; color: #185fa5; }
.icon-green { background: #eaf3de; color: #3b6d11; }

.app-info { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.app-name  { font-size: 17px; font-weight: 500; }
.app-desc  { font-size: 13px; color: #666; line-height: 1.5; }

/* ---- Badges ---- */
.badge { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 6px; }
.badge-new   { background: #eaf3de; color: #3b6d11; }
.badge-admin { background: #faeeda; color: #854f0b; margin-left: 6px; }

/* ---- Admin page ---- */
.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 1rem; border-bottom: 0.5px solid rgba(0,0,0,0.1);
  margin-bottom: 1.5rem;
}
.admin-header h1 { font-size: 22px; font-weight: 500; }
.back-link { font-size: 13px; color: #555; text-decoration: none; }
.back-link:hover { color: #1a1a1a; }

.section { margin-bottom: 2.5rem; }
.section-title {
  font-size: 12px; font-weight: 500; color: #888;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 12px 16px;
  background: #fff; border: 0.5px solid rgba(0,0,0,0.1); border-radius: 10px;
  margin-bottom: 8px;
}
.user-left { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #e6f1fb; color: #185fa5;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; flex-shrink: 0;
}
.avatar-admin { background: #faeeda; color: #854f0b; }
.uname { font-size: 14px; font-weight: 500; }

.user-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Reset password inline */
.reset-details { position: relative; }
.reset-summary {
  font-size: 12px; color: #555; cursor: pointer; list-style: none;
  border: 0.5px solid rgba(0,0,0,0.15); border-radius: 6px; padding: 4px 10px;
  user-select: none;
}
.reset-summary::-webkit-details-marker { display: none; }
.reset-summary:hover { background: #f0f0ee; }
.reset-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10;
  background: #fff; border: 0.5px solid rgba(0,0,0,0.15); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.reset-form input {
  border: 0.5px solid rgba(0,0,0,0.2); border-radius: 6px;
  padding: 7px 10px; font-size: 13px; font-family: inherit; outline: none;
}
.reset-form input:focus { border-color: #185fa5; }

/* New user form */
.form-card {
  background: #fff; border: 0.5px solid rgba(0,0,0,0.1);
  border-radius: 12px; padding: 1.25rem 1.5rem;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.form-footer .btn-primary { width: auto; padding: 9px 20px; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #555; cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  body { background: #1a1a1a; color: #f0f0ee; }
  .login-card, .form-card, .user-row, .app-card, .reset-form {
    background: #242424; border-color: rgba(255,255,255,0.1);
  }
  .login-icon { background: #0c447c; color: #b5d4f4; }
  .field label, .section-title { color: #aaa; }
  .field input, .reset-form input {
    background: #2c2c2c; border-color: rgba(255,255,255,0.15); color: #f0f0ee;
  }
  .alert-info  { background: #042c53; color: #b5d4f4; border-color: #185fa5; }
  .alert-error { background: #501313; color: #f7c1c1; border-color: #a32d2d; }
  .header h1, .uname, .app-name { color: #f0f0ee; }
  .header p, .app-desc, .username, .back-link { color: #999; }
  .admin-link  { color: #b5d4f4; }
  .admin-link:hover, .logout-btn:hover, .reset-summary:hover { background: #2c2c2c; color: #f0f0ee; }
  .logout-btn, .reset-summary { border-color: rgba(255,255,255,0.12); color: #888; }
  .icon-blue   { background: #0c447c; color: #b5d4f4; }
  .icon-green  { background: #27500a; color: #c0dd97; }
  .avatar      { background: #0c447c; color: #b5d4f4; }
  .avatar-admin { background: #633806; color: #fac775; }
  .badge-new   { background: #27500a; color: #c0dd97; }
  .badge-admin { background: #633806; color: #fac775; }
  .checkbox-label { color: #aaa; }
  .btn-danger  { color: #f7c1c1; border-color: #a32d2d; }
  .app-card:hover { background: #2c2c2c; border-color: rgba(255,255,255,0.2); }
}
