/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  background: #f1f5f9;
  color: #0f172a;
  min-height: 100vh;
}

[hidden] { display: none !important; }

/* ─── Auth ─────────────────────────────────────────────────────────────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-card {
  background: white;
  border-radius: 14px;
  padding: 44px 40px 40px;
  width: 360px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.08);
  text-align: center;
}

.auth-logo {
  width: 48px;
  height: 48px;
  background: #6366f1;
  color: white;
  font-weight: 800;
  font-size: 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.auth-card > p {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-card input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.15s;
  text-align: center;
}

.auth-card input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px #eef2ff; }

.auth-card button {
  width: 100%;
  padding: 10px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-card button:hover  { background: #4f46e5; }
.auth-card button:disabled { opacity: 0.6; cursor: not-allowed; }

.msg {
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}
.msg.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.msg.error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ─── Header ───────────────────────────────────────────────────────────────── */
header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 32px;
  height: 32px;
  background: #6366f1;
  color: white;
  font-weight: 800;
  font-size: 11px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right > span {
  font-size: 13px;
  color: #64748b;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover    { background: #4f46e5; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: white;
  border: 1px solid #e2e8f0;
  color: #374151;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-danger {
  background: white;
  border: 1px solid #fca5a5;
  color: #dc2626;
  border-radius: 7px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: #fef2f2; }

.btn-icon {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1;
}
.btn-icon:hover { background: #f1f5f9; color: #475569; }

/* ─── Filters ──────────────────────────────────────────────────────────────── */
.filters {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filters select,
.filters input[type="text"] {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  background: white;
  color: #374151;
  outline: none;
  transition: border-color 0.15s;
}

.filters select:focus,
.filters input:focus { border-color: #6366f1; }

.filters input[type="text"] { min-width: 160px; }

.archive-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  padding: 0 4px;
}

.archive-toggle input { cursor: pointer; }

.filters .btn-primary { margin-left: auto; }

/* ─── Table bar ────────────────────────────────────────────────────────────── */
.table-bar {
  padding: 10px 24px 6px;
  font-size: 12px;
  color: #94a3b8;
}

/* ─── Table ────────────────────────────────────────────────────────────────── */
.table-wrapper {
  margin: 0 24px 32px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: #6366f1; }

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: #f8fafc; }

td {
  padding: 11px 14px;
  font-size: 13px;
  color: #374151;
  vertical-align: middle;
}

.title-col {
  font-weight: 500;
  color: #0f172a;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-col  { color: #94a3b8; font-size: 12px; white-space: nowrap; }

td.empty,
td.loading {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
  font-style: italic;
}

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Priority */
.pri-critical { background: #fef2f2; color: #dc2626; }
.pri-high     { background: #fff7ed; color: #ea580c; }
.pri-medium   { background: #eff6ff; color: #2563eb; }
.pri-low      { background: #f1f5f9; color: #64748b; }

/* Type */
.type-bug         { background: #fef2f2; color: #be123c; }
.type-enhancement { background: #f0fdf4; color: #15803d; }
.type-work-item   { background: #f5f3ff; color: #6d28d9; }

/* Status */
.status { background: #f1f5f9; color: #475569; font-weight: 600; }

/* External */
.ext-badge {
  display: inline-block;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

/* ─── Modal ────────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 0;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.modal-body {
  padding: 0 24px;
}

.form-row {
  margin-bottom: 16px;
}

.form-row.full { grid-column: 1 / -1; }

.form-row label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.req { color: #dc2626; }

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px #eef2ff;
}

.form-row textarea { resize: vertical; line-height: 1.5; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-top: 1px solid #f1f5f9;
  margin-top: 20px;
  gap: 12px;
}

.modal-footer-right {
  display: flex;
  gap: 10px;
}
