/* ============ DESIGN TOKENS ============ */
:root {
  --brand-50:  #ecfdf7;
  --brand-100: #d1faec;
  --brand-200: #a7f3d8;
  --brand-300: #6ee7bf;
  --brand-400: #34d3a3;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --brand-900: #064e3b;

  --ink-50:  #f8fafc;
  --ink-100: #f1f5f9;
  --ink-200: #e2e8f0;
  --ink-300: #cbd5e1;
  --ink-400: #94a3b8;
  --ink-500: #64748b;
  --ink-600: #475569;
  --ink-700: #334155;
  --ink-800: #1e293b;
  --ink-900: #0f172a;

  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow:    0 4px 12px rgba(15, 23, 42, .08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .10);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, .14);

  --transition: 160ms cubic-bezier(.4, 0, .2, 1);

  --teal: var(--brand-600);
  --navy: var(--ink-900);
  --bg:   var(--ink-50);
  --ink:  var(--ink-800);
}

/* ============ RESET ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background: var(--ink-50);
  color: var(--ink-800);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ HEADER ============ */
header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px max(24px, calc((100vw - 1600px) / 2));
  background: linear-gradient(180deg, var(--ink-900) 0%, #0b1a2e 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header b {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

header b::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(52, 211, 163, .18);
}

header span {
  margin-left: auto;
  font-size: 13px;
  color: rgba(255, 255, 255, .7);
  font-weight: 500;
  padding: 6px 12px;
  background: rgba(255, 255, 255, .06);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08);
}

header a {
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

header a:hover {
  color: white;
  background: rgba(255, 255, 255, .1);
}

/* ============ LOGIN ============ */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(52, 211, 163, .25), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(59, 130, 246, .18), transparent 60%),
    linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  position: relative;
  overflow: hidden;
}

.login::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 440px;
  max-width: 100%;
  padding: 44px 40px;
  background: rgba(255, 255, 255, .98);
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .5) inset,
    0 24px 64px rgba(0, 0, 0, .4),
    0 2px 8px rgba(0, 0, 0, .2);
  animation: cardIn .5s cubic-bezier(.16, 1, .3, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.login-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: white;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(16, 185, 129, .35);
  margin-bottom: 4px;
}

.login-overline {
  margin: 20px 0 6px;
  color: var(--brand-700);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.login h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink-900);
}

.login-copy {
  color: var(--ink-500);
  margin: 10px 0 28px;
  font-size: 15px;
}

/* ============ FORMS ============ */
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-700);
  letter-spacing: .01em;
}

.login label {
  margin: 18px 0;
}

input, select, textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--ink-900);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

input::placeholder, textarea::placeholder {
  color: var(--ink-400);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--ink-300);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

small {
  color: var(--ink-500);
  font-weight: 400;
}

/* ============ BUTTONS ============ */
button, .tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: white;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .2) inset,
    0 1px 2px rgba(0, 0, 0, .1),
    0 4px 12px rgba(16, 185, 129, .25);
}

button:hover, .tile:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .2) inset,
    0 4px 8px rgba(0, 0, 0, .12),
    0 8px 20px rgba(16, 185, 129, .35);
}

button:active, .tile:active {
  transform: translateY(0);
}

button:focus-visible, .tile:focus-visible {
  outline: 3px solid rgba(16, 185, 129, .4);
  outline-offset: 2px;
}

.login button {
  width: 100%;
  margin-top: 12px;
  min-height: 48px;
  font-size: 15px;
}

/* ============ HOME ============ */
.home {
  width: min(100% - 40px, 1100px);
  min-height: calc(100dvh - 70px);
  margin: 0 auto;
  padding: 80px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -.025em;
  margin: 8px 0 12px;
  color: var(--ink-900);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 760px;
  margin-top: 40px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 28px;
  background: white;
  color: var(--ink-800);
  font-size: 19px;
  font-weight: 700;
  text-align: left;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, .06), transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.tile:hover {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(16, 185, 129, .08);
  transform: translateY(-3px);
  color: var(--brand-700);
}

.tile:hover::before { opacity: 1; }

.tile small {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  margin: 0;
}

/* ============ MESSAGES ============ */
.msg {
  padding: 14px 18px;
  margin: 16px 0;
  border-radius: var(--radius);
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  color: var(--brand-800);
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown .3s ease-out;
}

.msg::before {
  content: '✓';
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-500);
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.msg.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.msg.bad::before {
  content: '!';
  background: var(--danger);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  header {
    padding: 12px 16px;
    gap: 10px;
  }
  header b { font-size: 13px; }
  header span { display: none; }
  header a { padding: 6px 10px; font-size: 12px; }

  .login { padding: 16px; }
  .login-card {
    padding: 32px 24px;
    border-radius: var(--radius-lg);
  }
  .login h1 { font-size: 26px; }

  .home {
    padding: 40px 16px;
    align-items: stretch;
    text-align: left;
    min-height: auto;
  }

  input, select, textarea, button { font-size: 16px; min-height: 48px; }
}