* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f4f6f8;
  color: #1c1f23;
}

header {
  padding: 16px;
  background: #1f3b5c;
  color: #fdfdfd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

main {
  padding: 16px;
  flex: 1;
}

.app {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 220px;
  background: #e7ecef;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  background: #ffffff;
  border: 1px solid #ccd2da;
  color: #1c1f23;
  text-align: left;
}

.nav-item.active {
  background: #1f3b5c;
  color: #fff;
  border-color: #1f3b5c;
}

.panel {
  display: none;
  gap: 16px;
}

.panel.active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-content: start;
}

.card {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.section-label {
  margin: 12px 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5c6975;
}

.section-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.section-actions button {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-bar input {
  flex: 1;
}

.filter-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f4d6d6;
  color: #7a1e1e;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.filter-indicator button {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  font-size: 11px;
}

.pack-detail-actions {
  justify-content: space-between;
  gap: 12px;
}

.pack-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pack-card {
  border: 1px solid #e3e7ed;
  border-radius: 10px;
  padding: 12px;
  background: #f9fbfc;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-card {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

.pack-card .pack-category {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.pack-card .pack-category .category-count {
  font-weight: 600;
  color: #1f2a33;
}

.pack-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.home-card {
  cursor: default;
}

.home-card:hover {
  transform: none;
  box-shadow: none;
}

.pack-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.pack-card .pack-category {
  margin: 6px 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2a33;
}

.pack-card .pack-type {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #34404b;
  padding-left: 10px;
}

.pack-card .pack-tagged {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 4px;
  color: #34404b;
}

.pack-card .pack-tagged-count {
  color: #b02222;
  font-weight: 700;
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 8px 0 4px;
}

label input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

input,
select,
button {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccd2da;
  font-size: 14px;
}

button {
  background: #1f3b5c;
  color: #fff;
  border: none;
  cursor: pointer;
}

button.secondary {
  background: #8aa0c9;
}

button.danger {
  background: #a73f3f;
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-row input {
  flex: 1;
}

.form-row button {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.list li {
  padding: 8px 0;
  border-bottom: 1px solid #e3e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-list li {
  justify-content: initial;
}

.editable-list li {
  cursor: pointer;
}

.item-label {
  flex: 1;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 0;
  align-items: center;
}

.login-card .actions {
  margin-top: 12px;
}

.actions button {
  padding: 4px 8px;
  font-size: 12px;
  width: auto;
}

.table-header {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1f2a33;
  padding: 8px 10px;
  background: #e1e6ea;
  border-bottom: 1px solid #cbd4db;
}

.table-header + .table-list {
  margin-top: 0;
}

.table-header span[data-key] {
  cursor: pointer;
}

.table-actions-label {
  text-align: right;
}

.table-list li {
  display: grid;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  padding: 8px 10px;
}

.table-list li:nth-child(even) {
  background: rgba(242, 245, 247, 0.7);
}

.table-list li.tagged-down {
  background: #f9e2e2;
}

.tagged-yes {
  font-weight: 700;
  color: #b02222;
}

.table-header span,
.table-list li > * {
  border-right: 1px solid #e3e7ed;
  padding-right: 8px;
}

.table-header span:last-child,
.table-list li > :last-child {
  border-right: none;
  padding-right: 0;
}

.table-list li > * {
  padding-left: 4px;
}

.table-list li > :first-child {
  padding-left: 0;
}

.table-grid {
  --actions-width: 140px;
}

.table-header.columns-2,
.table-list.columns-2 li {
  grid-template-columns: 1fr var(--actions-width);
}

.table-header.columns-3,
.table-list.columns-3 li {
  grid-template-columns: 1.2fr 0.8fr var(--actions-width);
}

.table-header.columns-4,
.table-list.columns-4 li {
  grid-template-columns: 1.2fr 1fr 1fr var(--actions-width);
}

.table-header.columns-5,
.table-list.columns-5 li {
  grid-template-columns: 1fr 1fr 1fr 1fr 0.6fr var(--actions-width);
}

.table-list .actions {
  justify-content: flex-end;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dfe7f3;
  font-size: 12px;
  margin-left: 6px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#login-overlay {
  background: #33404a;
}

.login-card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 1 45%;
    text-align: center;
  }
}
