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

:root {
  --bg:           #f4f6f8;
  --surface:      #ffffff;
  --border:       #dde1e7;
  --accent:       #0055cc;
  --accent-hover: #003d99;
  --accent-light: #f0f4ff;
  --text:         #1a1a2e;
  --muted:        #6b7280;
  --danger:       #c0392b;
  --success:      #1a7f37;
  --warn:         #b45309;
  --radius:       8px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Top nav ─────────────────────────────────────────────────────── */
.topnav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topnav-brand img { height: 30px; }
.topnav-right { display: flex; align-items: center; gap: 16px; font-size: .875rem; }
.topnav-right a { color: var(--muted); text-decoration: none; }
.topnav-right a:hover { color: var(--accent); }
.topnav-user { font-weight: 600; color: var(--text); }

/* ── Page wrapper ────────────────────────────────────────────────── */
.page { max-width: 900px; margin: 0 auto; padding: 32px 20px 64px; }
.page-narrow { max-width: 480px; margin: 0 auto; padding: 40px 20px 64px; }
.page-wide   { max-width: 1100px; margin: 0 auto; padding: 32px 20px 64px; }

/* ── Typography ──────────────────────────────────────────────────── */
h1 { font-size: 1.5rem; margin-bottom: 6px; }
h2 { font-size: 1.15rem; margin-bottom: 12px; }
h3 { font-size: 1rem; margin-bottom: 8px; }
.subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }
.muted { color: var(--muted); }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

/* ── App grid ────────────────────────────────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.app-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.app-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  background: var(--accent-light);
}
.app-tile-icon { font-size: 2rem; line-height: 1; }
.app-tile-label { font-weight: 700; font-size: 1rem; }
.app-tile-desc  { font-size: .85rem; color: var(--muted); }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 5px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, outline .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: 3px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a93226; }
.btn-full { width: 100%; text-align: center; }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .9rem;
  border: 1px solid;
}
.alert-error   { background: #fdecea; border-color: #f5c6cb; color: var(--danger); }
.alert-success { background: #d4edda; border-color: #c3e6cb; color: var(--success); }
.alert-warn    { background: #fffbeb; border-color: #fde68a; color: var(--warn); }
.alert-info    { background: #e8f0fe; border-color: #c7d7f9; color: var(--accent); }

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-light); }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-open      { background: #dbeafe; color: #1d4ed8; }
.badge-progress  { background: #fef3c7; color: #92400e; }
.badge-resolved  { background: #d1fae5; color: #065f46; }
.badge-closed    { background: #f3f4f6; color: #4b5563; }
.badge-low       { background: #f3f4f6; color: #4b5563; }
.badge-medium    { background: #fef3c7; color: #92400e; }
.badge-high      { background: #fee2e2; color: #b91c1c; }
.badge-urgent    { background: #b91c1c; color: #fff; }

/* ── Login / register layout ─────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 36px;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.auth-logo img { height: 40px; display: block; margin: 0 auto 8px; }
.auth-footer { margin-top: 18px; font-size: .85rem; text-align: center; color: var(--muted); }
.auth-footer a { color: var(--accent); text-decoration: none; }
