:root {
  --navy: #0b1f33;
  --navy-2: #122a42;
  --navy-3: #1a3650;
  --accent: #2f80ed;
  --teal: #14b8a6;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #132033;
  --muted: #6b7c90;
  --border: #e2e8f0;
  --danger: #e11d48;
  --warn: #d97706;
  --ok: #059669;
  --sidebar-w: 248px;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 35, 60, 0.06);
  font-family: "IBM Plex Sans", "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 10% 0%, rgba(47,128,237,0.18), transparent 60%),
    radial-gradient(700px 400px at 90% 100%, rgba(20,184,166,0.16), transparent 55%),
    linear-gradient(160deg, #0b1f33 0%, #143752 45%, #1c4664 100%);
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); margin: 0 0 20px; }
.auth-brand {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.auth-brand .mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: grid; place-items: center; color: #fff; font-weight: 700;
}

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #dbe7f5;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.sidebar .brand {
  padding: 20px 18px 14px;
  display: flex; gap: 12px; align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #2f80ed, #14b8a6);
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.sidebar .brand h1 { margin: 0; font-size: 1.05rem; color: #fff; }
.sidebar .brand p { margin: 2px 0 0; font-size: 0.75rem; color: #8fa6bf; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.nav a {
  color: #c5d5e8; padding: 10px 12px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 0.92rem;
}
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav a.active { background: rgba(47,128,237,0.22); color: #fff; box-shadow: inset 0 0 0 1px rgba(47,128,237,0.35); }
.nav .ico { width: 18px; text-align: center; opacity: 0.9; }
.sidebar-foot {
  padding: 14px; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.82rem; color: #9bb0c6;
}
.sidebar-foot strong { color: #fff; display: block; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.topbar .sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.bell {
  position: relative; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center;
}
.bell .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 0.65rem; display: grid; place-items: center; padding: 0 4px;
}
.main { padding: 22px 24px 40px; }

.grid-kpi { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin-top: 6px; letter-spacing: -0.03em; }
.kpi.critical .value { color: var(--danger); }
.kpi.warn .value { color: var(--warn); }
.kpi.ok .value { color: var(--ok); }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.panel-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.panel-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,35,60,0.1); }
.panel-card .code {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--accent); background: rgba(47,128,237,0.1); padding: 3px 8px; border-radius: 999px;
}
.panel-card h3 { margin: 10px 0 4px; font-size: 1.05rem; }
.panel-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.panel-card .meta { margin-top: 14px; display: flex; gap: 12px; font-size: 0.82rem; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 1rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

label.field, .field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
}
.field-label { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.field-label .opt { text-transform: none; font-weight: 500; letter-spacing: 0; opacity: 0.8; }
input, select, textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  background: #fff; color: var(--text); width: 100%;
  font-weight: 500;
}
textarea { min-height: 90px; resize: vertical; }
textarea.ta-md { min-height: 88px; }
textarea.ta-sm { min-height: 72px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(47,128,237,0.15);
}

.btn {
  border: none; border-radius: 10px; padding: 10px 14px; font-weight: 600;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: #eef3f9; color: var(--text); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.teal { background: var(--teal); }
.btn.sm { padding: 7px 10px; font-size: 0.85rem; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; color: var(--muted); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.data td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: #f8fbff; }
table.data .linkish { color: var(--accent); font-weight: 600; cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge.OPEN, .badge.REOPENED { background: #fee2e2; color: #b91c1c; }
.badge.ASSIGNED, .badge.IN_PROGRESS { background: #dbeafe; color: #1d4ed8; }
.badge.FIXED, .badge.PENDING_QA { background: #ffedd5; color: #c2410c; }
.badge.VERIFIED, .badge.CLOSED, .badge.PASSED, .badge.RELEASED { background: #d1fae5; color: #047857; }
.badge.CRITICAL { background: #ffe4e6; color: #be123c; }
.badge.HIGH { background: #ffedd5; color: #c2410c; }
.badge.MEDIUM { background: #e0e7ff; color: #4338ca; }
.badge.LOW { background: #f1f5f9; color: #475569; }
.badge.FAILED, .badge.BLOCKED { background: #fee2e2; color: #b91c1c; }
.badge.DRAFT, .badge.READY, .badge.PLANNED { background: #e2e8f0; color: #334155; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 0.85rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,31,51,0.5); display: grid; place-items: center;
  z-index: 50; padding: 16px; overflow: auto;
}
.modal {
  background: #fff; width: min(720px, 100%); max-height: min(90vh, 920px);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  padding: 18px 22px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--text); }
.modal-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; font-weight: 500; }
.modal-body { padding: 16px 22px; overflow: auto; flex: 1; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 22px 16px; border-top: 1px solid var(--border); flex-shrink: 0; background: #fafbfd;
}
.modal-report { width: min(640px, 100%); }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-section {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcfe;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 1100px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .grid-kpi { grid-template-columns: 1fr 1fr; }
}

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 0.9rem; margin: 8px 0; }
.success { color: var(--ok); }
.dup-list { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 10px; margin-top: 8px; }
.dup-list li { margin: 4px 0; }
.activity li { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment .who { font-weight: 600; font-size: 0.85rem; }
.comment .when { color: var(--muted); font-size: 0.75rem; margin-left: 8px; }

.toast {
  position: fixed; right: 18px; bottom: 18px; background: var(--navy); color: #fff;
  padding: 12px 16px; border-radius: 10px; z-index: 80; box-shadow: var(--shadow);
  animation: rise .25s ease;
}

.btn-lg { padding: 14px 18px; font-size: 1rem; border-radius: 12px; }
.flow-hero {
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 55%, #f0fdfa 100%);
  border-color: #cfe0f5;
}
.action-bar {
  background: #f8fbff;
  border: 1px dashed #b6cfe8;
  margin-bottom: 16px;
}
.action-row .toolbar { gap: 12px; }

.check-list {
  max-height: 160px; overflow: auto; border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; background: #fff; margin-top: 2px;
}
.check-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 0; padding: 8px 10px; border-radius: 8px;
  font-weight: 500; color: var(--text); cursor: pointer;
  box-sizing: border-box;
}
.check-row:hover { background: #f1f5f9; }
.check-row:has(input:checked) { background: #eff6ff; }
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; flex: 0 0 auto; accent-color: var(--accent);
}
.check-text {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  font-size: 0.92rem; color: var(--text);
}
.check-text strong { font-weight: 600; }
.role-tag {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  color: #64748b; background: #e2e8f0; padding: 2px 6px; border-radius: 999px;
}
.empty-mini { padding: 10px; color: var(--muted); font-size: 0.85rem; font-weight: 500; }

.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 18px 12px; border: 1.5px dashed #b6cfe8; border-radius: 12px;
  background: #f8fbff; cursor: pointer; text-align: center; color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.file-drop:hover, .file-drop.has-files { border-color: var(--accent); background: #eff6ff; }
.file-drop-icon { font-size: 1.25rem; color: var(--accent); line-height: 1; }
.file-drop-title { font-size: 0.92rem; font-weight: 650; }
.file-drop-hint { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

.img-preview-row, .img-gallery {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;
}
.img-preview-row img, .img-tile img {
  width: 88px; height: 88px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--border); background: #f8fafc; display: block;
}
.img-chip { width: 88px; }
.img-chip span {
  display: block; margin-top: 4px; font-size: 0.68rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.img-tile { display: block; }
.assignee-list { list-style: none; padding: 0; margin: 8px 0 0; }
.assignee-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.solved-banner {
  background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 0.95rem;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
