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

:root {
  --bg: #0f172a;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #1e3a5f 100%);
}

#app { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

/* ---------- login ---------- */
.login-card {
  width: 100%; max-width: 400px; background: var(--card);
  border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.brand .logo-dot { font-size: 30px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
button.primary {
  width: 100%; margin-top: 22px; padding: 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
button.primary:hover { background: var(--accent-2); }
button.primary:disabled { opacity: .6; cursor: default; }
.aux-links { margin-top: 14px; text-align: center; font-size: 13px; }
.aux-links a { color: var(--accent); text-decoration: none; }
.aux-links a:hover { text-decoration: underline; }
.head-actions { display: flex; gap: 10px; }
.login-hint { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.7; }
.login-hint code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; cursor: pointer; color: #334155; }

/* ---------- launcher ---------- */
.launcher { width: 100%; max-width: 900px; }
.launcher-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; color: #fff; }
.launcher-head h1 { font-size: 24px; font-weight: 700; }
.launcher-head .who { font-size: 13px; opacity: .75; margin-top: 4px; }
.btn-ghost {
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,.2); }

.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.app-card {
  background: var(--card); border-radius: 16px; padding: 30px 26px; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.app-card:hover { transform: translateY(-4px); box-shadow: 0 20px 44px rgba(0,0,0,.35); }
.app-icon {
  width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; font-size: 34px;
}
.app-icon.time { background: #eef2ff; }
.app-icon.leave { background: #ecfdf5; }
.app-icon.qms { background: #fff7ed; }
.app-card h2 { font-size: 18px; }
.app-card p { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.dot.up { background: var(--ok); }
.dot.down { background: var(--warn); }
.open-hint { font-size: 13px; font-weight: 600; color: var(--accent); }

.error-banner {
  background: #fef2f2; color: var(--err); border: 1px solid #fecaca; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 18px;
}

/* ---------- toasts ---------- */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast {
  background: #1e293b; color: #fff; border-radius: 8px; padding: 12px 18px; font-size: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,.35); animation: slide-in .2s ease;
}
.toast.error { background: var(--err); }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- User Management app ---------- */
.um-wrap { width: 100%; max-width: 1100px; }
.um-panel {
  background: #fff; border-radius: 14px; padding: 22px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
.um-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.um-bar h2 { font-size: 18px; font-weight: 700; }
.um-bar .sub { margin: 2px 0 0; }
.um-search { width: 240px; margin: 0; }
.um-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.um-table th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.um-table td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.um-table tr:last-child td { border-bottom: 0; }
.um-name { font-weight: 600; color: #0f172a; }
.um-mail { color: var(--muted); font-size: 12px; }
.um-tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #f1f5f9; color: #475569;
}
.um-tag.owner { background: #ede9fe; color: #6d28d9; }
.um-tag.admin { background: #e0e7ff; color: #3730a3; }
.um-tag.ok { background: #dcfce7; color: #15803d; }
.um-tag.off { background: #fee2e2; color: #b91c1c; }
.um-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.btn-sm {
  padding: 5px 10px; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  font-size: 12px; cursor: pointer; color: #334155;
}
.btn-sm:hover { background: #f8fafc; }
.btn-sm.danger { border-color: #fecaca; color: #b91c1c; }
.btn-sm.danger:hover { background: #fef2f2; }
.btn-sm.go { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn-sm:disabled { opacity: .45; cursor: default; }
.um-modal {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px;
}
.um-dialog { background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 460px; }
.um-dialog h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.um-dialog label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin: 10px 0 4px; }
.um-dialog input, .um-dialog select { width: 100%; margin: 0; }
.um-dialog select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff;
}
.um-dialog .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.um-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.um-empty { text-align: center; color: var(--muted); padding: 28px; font-size: 13px; }
