/* Kima Hub — stile allineato al sito kimasrl.it */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --secondary-color: #0f172a;
  --accent-color: #06b6d4;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --text-white: #ffffff;
  --bg-light: #f8fafc;
  --border-color: #e2e8f0;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.10);
  --radius: 12px;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--bg-light) 60%, #e8f0fe 100%);
}

.login-card {
  background: var(--text-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card img.logo {
  height: 56px;
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 0.25rem;
}

.login-card p.sub {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.login-card label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
}

.login-card input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

.login-card input:focus {
  outline: 2px solid var(--primary-light);
  border-color: var(--primary-light);
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--primary-color);
  color: var(--text-white);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-ghost {
  background: transparent;
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.btn-ghost:hover {
  background: var(--bg-light);
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.error-msg {
  color: #dc2626;
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* ---------- Layout app: footer ancorato in fondo ---------- */
#app-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Header app (bianca, come il sito kimasrl.it) ---------- */
.topbar {
  background: var(--text-white);
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.topbar img.logo {
  height: 44px;
}

.topbar .title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-color);
  letter-spacing: 0.02em;
}

.topbar .spacer { flex: 1; }

.topbar .user-email {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ---------- Griglia app ---------- */
main.grid-wrap {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.grid-wrap h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 1.25rem;
}

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

.app-card {
  background: var(--text-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem 1.3rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.app-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}

.app-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #e8f0fe;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-card .icon svg { width: 24px; height: 24px; }

.app-card .nome {
  font-weight: 700;
  font-size: 1rem;
  color: var(--secondary-color);
}

.app-card .descrizione {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.45;
}

.app-card .apri {
  margin-top: auto;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-light);
}

footer a {
  color: var(--text-light);
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 480px) {
  .topbar { padding: 0.6rem 1rem; }
  .topbar .user-email { display: none; }
  main.grid-wrap { padding: 1.25rem 1rem 2rem; }
}
