/* The portfolio's design language, carried over: same tokens, same frosted
   glass, same pill controls — so the admin feels like a back room of the
   same building, not a different site. */

:root {
  --bg: #eceded;
  --bg-soft: #e4e5e8;
  --ink: #35363b;
  --ink-soft: #67686f;
  --ink-faint: #9a9ca4;
  --line: rgba(53, 54, 59, 0.12);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.75);
  --shadow: 0 18px 50px rgba(53, 54, 59, 0.12);
  --radius: 20px;

  --fs-body: 14px;
  --fs-body-sm: 12px;
  --fs-h1: 24px;
  --fs-h2: 20px;
  --fs-h3: 16px;
  --fs-label: 14px;

  font-family: 'Outfit', system-ui, sans-serif;
}

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

/* the gate/admin swap runs on the hidden attribute; the gate's own
   display: flex would silently win over the UA's [hidden] rule */
[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: radial-gradient(circle at 50% 30%, #ffffff 0%, #f3f4f6 45%, var(--bg-soft) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- shared controls (portfolio language) ---------- */

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  color: var(--ink-soft);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.ghost-btn:hover {
  color: var(--ink);
  background: rgba(43, 38, 32, 0.05);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-weight: 500;
  font-size: var(--fs-body);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
  transition: border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.pill-btn:hover {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.65);
}

.pill-btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(53, 54, 59, 0.22);
}

.pill-btn.primary:hover {
  background: #4a4b52;
}

.pill-btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* segmented pill tabs — same shell as the portfolio's tab switch */
.tab-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 24px rgba(53, 54, 59, 0.08);
  backdrop-filter: blur(8px);
}

.tab {
  padding: 8px 22px;
  border-radius: 999px;
  font-weight: 500;
  font-size: var(--fs-body);
  color: var(--ink-soft);
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(53, 54, 59, 0.12);
}

/* ---------- password gate ---------- */

.gate {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  text-align: center;
  animation: fade-in 0.4s ease;
}

.gate-logo {
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
}

.gate-logo.small {
  font-size: 1.1rem;
}

.gate-question {
  max-width: 340px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.gate-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.gate-input {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: var(--fs-body);
  color: var(--ink);
  outline: none;
  min-width: 220px;
  transition: border-color 0.2s ease;
}

.gate-input:focus {
  border-color: var(--ink);
}

.gate-error {
  font-size: var(--fs-body-sm);
  color: #a04545;
  animation: fade-in 0.25s ease;
}

/* ---------- dashboard frame ---------- */

.admin {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px clamp(20px, 4vw, 48px) 64px;
  animation: fade-in 0.4s ease;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-title h1 {
  font-weight: 600;
  font-size: var(--fs-h1);
}

.admin-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- change password ---------- */

/* the same glass card as a grant, so it reads as part of the same surface */
.pw-panel {
  margin-top: 20px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise-in 0.3s ease;
}

.pw-title {
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--ink);
}

.pw-note {
  margin-top: 4px;
  font-size: var(--fs-body-sm);
  color: var(--ink-soft);
}

.pw-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.pw-form .gate-input {
  flex: 1 1 200px;
  min-width: 0;
}

.pw-actions {
  display: flex;
  gap: 10px;
  flex-basis: 100%;
}

/* ---------- grant cards ---------- */

.grant-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grant-card {
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  animation: rise-in 0.3s ease;
}

.grant-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.grant-who .grant-name {
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--ink);
}

.grant-who .grant-email {
  margin-top: 2px;
  font-size: var(--fs-body);
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.grant-company {
  color: var(--ink-faint);
}

/* project + status chips, same shape as the case-page meta chips */
.grant-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: var(--fs-body-sm);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--glass-border);
  box-shadow: 0 6px 18px rgba(53, 54, 59, 0.06);
  color: var(--ink);
}

/* status hues: quiet washes of the same ink, not traffic lights */
.chip.status-pending  { background: rgba(214, 158, 46, 0.14); color: #8a6414; }
.chip.status-active   { background: rgba(74, 144, 96, 0.14);  color: #2f6a44; }
.chip.status-revoked  { background: rgba(178, 76, 76, 0.12);  color: #93403f; }
.chip.status-declined { background: rgba(53, 54, 59, 0.08);   color: var(--ink-soft); }

/* dates + usage, an attribution line under the name */
.grant-meta {
  margin-top: 12px;
  font-size: var(--fs-body-sm);
  color: var(--ink-faint);
}

.grant-meta .meta-item:not(:first-child)::before {
  content: '·';
  padding: 0 8px;
}

.grant-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.grant-actions .pill-btn {
  font-size: var(--fs-body-sm);
  padding: 8px 16px;
}

/* the freshly minted code — shown once, so shown big */
.grant-code {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-border);
  animation: rise-in 0.3s ease;
}

.grant-code .code-digits {
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: var(--ink);
}

.grant-code .code-note {
  margin-top: 4px;
  font-size: var(--fs-body-sm);
  color: var(--ink-soft);
}

.list-empty {
  margin-top: 48px;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(53, 54, 59, 0.12);
  font-size: var(--fs-body-sm);
  color: var(--ink-soft);
  animation: rise-in 0.3s ease;
}

/* ---------- motion ---------- */

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.toast.rise-in,
.grant-card.rise-in {
  animation: rise-in 0.3s ease;
}

/* ---------- mobile ---------- */

@media (max-width: 560px) {
  .admin {
    padding-top: 20px;
  }

  .tab {
    padding: 8px 14px;
  }

  .grant-actions .pill-btn {
    flex: 1;
    justify-content: center;
  }
}
