/* MCD Bug Tracker — MCD SERVICES brand theme (navy + lime). No build step. */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --border: #dbe1ea;
  --text: #0b1b3a;
  --muted: #5b6b86;
  --brand: #052561;          /* MCD Services navy */
  --brand-dark: #041d4d;
  --lime: #9bee00;           /* MCD Services lime accent */
  --lime-hover: #8ad400;
  --green: #27a74a;
  --accent: #052561;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(5, 37, 97, 0.10), 0 1px 2px rgba(5, 37, 97, 0.06);
  --ok: #16a34a;
  --warn: #d97706;
  --crit: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06122b; --surface: #0d2149; --surface-2: #0a1a3a; --border: #1c3563;
    --text: #e8eef8; --muted: #97a7c4; --shadow: 0 1px 3px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }

/* --- Layout --- */
.navbar {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--brand); border-bottom: 3px solid var(--lime);
  padding: 0 1.5rem; height: 58px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: .5rem; color: #fff; }
.brand .mark { color: var(--lime); font-weight: 900; letter-spacing: -1px; }
.brand .name { font-weight: 800; letter-spacing: .5px; }
.brand .name small { font-weight: 600; color: rgba(255,255,255,.7); }
.brand .tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand); background: var(--lime); padding: .1rem .45rem; border-radius: 5px;
}
.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-links a {
  padding: .4rem .85rem; border-radius: 8px; color: rgba(255,255,255,.78); font-weight: 600;
}
.nav-links a:hover { background: rgba(255,255,255,.10); color: #fff; text-decoration: none; }
.nav-links a.active { color: var(--lime); background: rgba(255,255,255,.08); }
.nav-user { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: rgba(255,255,255,.85); }
.nav-user .muted { color: rgba(255,255,255,.55); }

.container { max-width: 1120px; margin: 1.5rem auto; padding: 0 1.5rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.4rem; margin: 0; color: var(--brand); font-weight: 800; }
@media (prefers-color-scheme: dark) { .page-head h1 { color: var(--text); } }

/* --- Cards & grid --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.charts { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { text-align: left; border-top: 3px solid var(--lime); }
.stat .value { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--brand); }
@media (prefers-color-scheme: dark) { .stat .value { color: var(--text); } }
.stat .label { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.chart-card h3 { margin: 0 0 .75rem; font-size: .95rem; color: var(--muted); font-weight: 700; }
.chart-wrap { position: relative; height: 240px; }

/* --- Forms --- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .3rem; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .5rem .9rem; border-radius: 8px; font: inherit; font-weight: 700;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
/* Lime CTA — echoes the MCD Services emphasis button. Navy text for contrast. */
.btn-accent { background: var(--lime); border-color: var(--lime); color: var(--brand); }
.btn-accent:hover { background: var(--lime-hover); text-decoration: none; }
.btn-danger { color: var(--crit); border-color: var(--crit); background: var(--surface); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }

/* --- Badges --- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.badge.status-open { background: #dbeafe; color: #1d4ed8; }
.badge.status-in_progress { background: #fef3c7; color: #b45309; }
.badge.status-resolved { background: #dcfce7; color: #15803d; }
.badge.status-closed { background: #e2e8f0; color: #475569; }
.badge.pri-low { background: #e0f2fe; color: #0369a1; }
.badge.pri-medium { background: #e2e8f0; color: #475569; }
.badge.pri-high { background: #ffedd5; color: #c2410c; }
.badge.pri-critical { background: #fee2e2; color: #b91c1c; }
.badge.cat { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* --- Login --- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(155,238,0,.28), transparent 60%),
    linear-gradient(135deg, #041d4d 0%, #052561 45%, #0a3d2f 100%);
}
.login-card { width: 100%; max-width: 400px; border-top: 4px solid var(--lime); }
.login-card h1 { text-align: center; margin: 0 0 .25rem; color: var(--brand); font-weight: 800; }
.login-card h1 .mark { color: var(--lime); }
.login-card .sub { text-align: center; color: var(--muted); margin: 0 0 1.5rem; font-size: .9rem; }
@media (prefers-color-scheme: dark) { .login-card h1 { color: var(--text); } }

/* --- Ticket detail --- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
@media (max-width: 780px) { .detail-grid { display: block; } }
.comment { border-bottom: 1px solid var(--border); padding: .75rem 0; }
.comment:last-child { border-bottom: none; }
.comment .meta { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.event { font-size: .82rem; color: var(--muted); padding: .3rem 0; border-bottom: 1px dashed var(--border); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters > div { min-width: 140px; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 2.5rem; }
.error-text { color: var(--crit); font-size: .85rem; margin-top: .5rem; min-height: 1.2em; }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; padding: .7rem 1.2rem; border-radius: 8px;
  box-shadow: var(--shadow); z-index: 100; font-size: .9rem; border-left: 4px solid var(--lime);
}
.toast.err { background: var(--crit); border-left-color: #fff; }

/* --- Mobile --- */
@media (max-width: 720px) {
  .container { padding: 0 .8rem; margin: 1rem auto; }
  .page-head { gap: .6rem; }
  .page-head h1 { font-size: 1.2rem; }

  /* Navbar wraps: brand + user on top, links (scrollable) below */
  .navbar { flex-wrap: wrap; height: auto; min-height: 52px; padding: .5rem .8rem; gap: .5rem .75rem; }
  .brand .tag { display: none; }
  .nav-links { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: .15rem; gap: .1rem; }
  .nav-links a { white-space: nowrap; }
  .nav-user { margin-left: auto; font-size: .82rem; }

  /* Wide tables scroll horizontally inside their card */
  .card { overflow-x: auto; }
  table { min-width: 560px; }

  /* Stack form fields and the ticket detail columns */
  .row > * { min-width: 100%; }
  .detail-grid { display: block; }
  .toast { left: .75rem; right: .75rem; transform: none; text-align: center; }
}
